Class CouchDbSessionAuthenticator

java.lang.Object
com.ibm.cloud.sdk.core.security.AuthenticatorBase
com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken>
com.ibm.cloud.cloudant.security.CouchDbSessionAuthenticator
All Implemented Interfaces:
com.ibm.cloud.sdk.core.security.Authenticator

public class CouchDbSessionAuthenticator extends com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken> implements com.ibm.cloud.sdk.core.security.Authenticator
Implementation of Authenticator that provides authentication via the Apache CouchDB _session endpoint.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Implements TokenServerResponse for an Apache CouchDB session cookie.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from class com.ibm.cloud.sdk.core.security.AuthenticatorBase

    ERRORMSG_ATLEAST_ONE_PROP_ERROR, ERRORMSG_ATMOST_ONE_PROP_ERROR, ERRORMSG_EXCLUSIVE_PROP_ERROR, ERRORMSG_PROP_INVALID, ERRORMSG_PROP_INVALID_INTEGER_VALUE, ERRORMSG_PROP_MISSING, ERRORMSG_REQ_FAILED

    Fields inherited from interface com.ibm.cloud.sdk.core.security.Authenticator

    AUTHTYPE_BASIC, AUTHTYPE_BEARER_TOKEN, AUTHTYPE_CONTAINER, AUTHTYPE_CP4D, AUTHTYPE_CP4D_SERVICE, AUTHTYPE_CP4D_SERVICE_INSTANCE, AUTHTYPE_IAM, AUTHTYPE_MCSP, AUTHTYPE_NOAUTH, AUTHTYPE_VPC, PROPNAME_APIKEY, PROPNAME_AUTH_TYPE, PROPNAME_BEARER_TOKEN, PROPNAME_CLIENT_ID, PROPNAME_CLIENT_SECRET, PROPNAME_CR_TOKEN_FILENAME, PROPNAME_DISABLE_SSL, PROPNAME_DISPLAY_NAME, PROPNAME_EXPIRATION_TIME, PROPNAME_IAM_PROFILE_CRN, PROPNAME_IAM_PROFILE_ID, PROPNAME_IAM_PROFILE_NAME, PROPNAME_PASSWORD, PROPNAME_PERMISSIONS, PROPNAME_SCOPE, PROPNAME_SERVICE_BROKER_SECRET, PROPNAME_SERVICE_INSTANCE_ID, PROPNAME_UID, PROPNAME_URL, PROPNAME_USERNAME
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    authenticate(okhttp3.Request.Builder requestBuilder)
     
     
    com.ibm.cloud.sdk.core.http.ServiceCookieJar
    Getter for the cookie jar used to store the session information.
    void
    For internal use to invalidate the local token and force a refresh cycle with the server.
    static com.ibm.cloud.sdk.core.security.Authenticator
    newAuthenticator(String username, String password)
    Get a new Authenticator instance for the supplied service URL and credentials that provides authentication via the Apache CouchDB _session endpoint.
     
    void
     
    void
    setHttpConfigOptions(com.ibm.cloud.sdk.core.http.HttpConfigOptions options)
    Setter to configure this authenticator with HttpConfigOptions.
    void
    setSessionUrl(String serviceUrl)
    Setter to configure this authenticator with a new session URL derived from the supplied service URL.
    void
     

    Methods inherited from class com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator

    getClient, getDisableSSLVerification, getHeaders, getProxy, getProxyAuthenticator, getToken, setClient, setDisableSSLVerification, setProxy, setProxyAuthenticator

    Methods inherited from class com.ibm.cloud.sdk.core.security.AuthenticatorBase

    constructBasicAuthHeader, constructBearerTokenAuthHeader

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • newAuthenticator

      public static com.ibm.cloud.sdk.core.security.Authenticator newAuthenticator(String username, String password)
      Get a new Authenticator instance for the supplied service URL and credentials that provides authentication via the Apache CouchDB _session endpoint.
      Parameters:
      username - the username
      password - the password
      Returns:
      new Authenticator instance
    • getCookieJar

      public com.ibm.cloud.sdk.core.http.ServiceCookieJar getCookieJar()
      Getter for the cookie jar used to store the session information.
      Returns:
      the cookie jar
    • setHttpConfigOptions

      public void setHttpConfigOptions(com.ibm.cloud.sdk.core.http.HttpConfigOptions options)
      Setter to configure this authenticator with HttpConfigOptions. This is called internally to apply the configuration options of the service client automatically.
      Parameters:
      options -
    • setSessionUrl

      public void setSessionUrl(String serviceUrl)
      Setter to configure this authenticator with a new session URL derived from the supplied service URL. This is called internally to apply the service URL from the service client automatically.
      Parameters:
      serviceUrl -
    • setHeaders

      public void setHeaders(Map<String,String> headers)
      Overrides:
      setHeaders in class com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken>
      Parameters:
      headers -
    • validate

      public void validate()
      Specified by:
      validate in interface com.ibm.cloud.sdk.core.security.Authenticator
      Specified by:
      validate in class com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken>
    • authenticationType

      public String authenticationType()
      Specified by:
      authenticationType in interface com.ibm.cloud.sdk.core.security.Authenticator
      Specified by:
      authenticationType in class com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken>
    • authenticate

      public void authenticate(okhttp3.Request.Builder requestBuilder)
      Specified by:
      authenticate in interface com.ibm.cloud.sdk.core.security.Authenticator
      Overrides:
      authenticate in class com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken>
    • requestToken

      Specified by:
      requestToken in class com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken>
    • invalidateToken

      public void invalidateToken()
      For internal use to invalidate the local token and force a refresh cycle with the server.