You are currently browsing legacy 4.0 version of documentation. Click here to switch to the newest 5.1 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Client API: Setting up Authentication and Authorization

Authentication and authorization is based on client X.509 certificates.

The certificate property allows you to pass a certificate which will be used by the RavenDB client to connect to a server.


If your RavenDB instance is running on 'https', then your application has to use a client certificate in order to be able to access the server. You can find more information here.


// load certificate
KeyStore clientStore = KeyStore.getInstance("PKCS12");
clientStore.load(new FileInputStream("c:\\ravendb\\client-cert.pfx"), "passwordToPfx".toCharArray());

try (DocumentStore store = new DocumentStore())  {
    store.setUrls(new String[]{ "https://my_secured_raven" });


    // do your work here