Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-12325

Improvement for Authentication page | Couchbase Docs

    XMLWordPrintable

Details

    Description

      It would be nice to have a working code piece in this part of Authentication article: https://docs.couchbase.com/java-sdk/3.4/howtos/sdk-authentication.html#authenticating-the-java-client-by-certificate

      Currently we have this:
      KeyStore keyStore = loadKeyStore();

      Authenticator authenticator = CertificateAuthenticator.fromKeyStore(
      keyStore,
      "keyStorePassword"
      );

      And it's a generic pseudocode piece. We need to substitute it with a working snippet:

      private static KeyStore loadKeyStore() {
      try (FileInputStream fis = new FileInputStream("/home/ihor/Java/src/main/java/my.keystore"))

      { KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(fis, "storepass".toCharArray()); return ks; }

      catch (IOException | GeneralSecurityException e)

      { throw new RuntimeException(e); }

      }

      Authenticator authenticator = CertificateAuthenticator.fromKeyStore(ks, "storepass");

      Browser environment: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

      Reporter: Ihor Pavlov
      E-mail: ihor.pavlov@couchbase.com

      Attachments

        Activity

          People

            richard.smedley Richard Smedley
            ihor.pavlov Ihor Pavlov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              PagerDuty