Class CouchDbSessionAuthenticator
java.lang.Object
com.ibm.cloud.sdk.core.security.AuthenticatorBase
com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticatorImmutable<CouchDbSessionAuthenticator.CouchDbSessionToken, CouchDbSessionAuthenticator.CouchDbSessionToken>
com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken, CouchDbSessionAuthenticator.CouchDbSessionToken>
com.ibm.cloud.cloudant.security.CouchDbSessionAuthenticator
- All Implemented Interfaces:
Authenticator
public class CouchDbSessionAuthenticator
extends TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken, CouchDbSessionAuthenticator.CouchDbSessionToken>
Implementation of
Authenticator that provides authentication via the Apache CouchDB
_session endpoint.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classImplementsTokenServerResponsefor an Apache CouchDB session cookie. -
Field Summary
FieldsFields inherited from class AuthenticatorBase
ERRORMSG_ACCOUNTID_PROP_ERROR, ERRORMSG_ATLEAST_ONE_PROP_ERROR, ERRORMSG_ATMOST_ONE_PROP_ERROR, ERRORMSG_EXCLUSIVE_PROP_ERROR, ERRORMSG_PROP_INVALID, ERRORMSG_PROP_INVALID_BOOL, ERRORMSG_PROP_INVALID_INTEGER_VALUE, ERRORMSG_PROP_MISSING, ERRORMSG_REQ_FAILEDFields inherited from interface Authenticator
AUTHTYPE_BASIC, AUTHTYPE_BEARER_TOKEN, AUTHTYPE_CONTAINER, AUTHTYPE_CP4D, AUTHTYPE_CP4D_SERVICE, AUTHTYPE_CP4D_SERVICE_INSTANCE, AUTHTYPE_IAM, AUTHTYPE_IAM_ASSUME, AUTHTYPE_MCSP, AUTHTYPE_MCSPV2, AUTHTYPE_NOAUTH, AUTHTYPE_VPC, PROPNAME_APIKEY, PROPNAME_AUTH_TYPE, PROPNAME_BEARER_TOKEN, PROPNAME_CALLER_EXT_CLAIM, PROPNAME_CLIENT_ID, PROPNAME_CLIENT_SECRET, PROPNAME_CR_TOKEN_FILENAME, PROPNAME_DISABLE_SSL, PROPNAME_DISPLAY_NAME, PROPNAME_EXPIRATION_TIME, PROPNAME_IAM_ACCOUNT_ID, PROPNAME_IAM_PROFILE_CRN, PROPNAME_IAM_PROFILE_ID, PROPNAME_IAM_PROFILE_NAME, PROPNAME_INCLUDE_BUILTIN_ACTIONS, PROPNAME_INCLUDE_CUSTOM_ACTIONS, PROPNAME_INCLUDE_ROLES, PROPNAME_PASSWORD, PROPNAME_PERMISSIONS, PROPNAME_PREFIX_ROLES, PROPNAME_SCOPE, PROPNAME_SCOPE_COLLECTION_TYPE, PROPNAME_SCOPE_ID, PROPNAME_SERVICE_BROKER_SECRET, PROPNAME_SERVICE_INSTANCE_ID, PROPNAME_UID, PROPNAME_URL, PROPNAME_USERNAME -
Method Summary
Modifier and TypeMethodDescriptionvoidauthenticate(okhttp3.Request.Builder requestBuilder) Getter for the cookie jar used to store the session information.voidFor internal use to invalidate the local token and force a refresh cycle with the server.static AuthenticatornewAuthenticator(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.voidsetHeaders(Map<String, String> headers) voidsetSessionUrl(String serviceUrl) Setter to configure this authenticator with a new session URL derived from the supplied service URL.voidvalidate()Methods inherited from class TokenRequestBasedAuthenticator
setClient, setDisableSSLVerification, setProxy, setProxyAuthenticatorMethods inherited from class TokenRequestBasedAuthenticatorImmutable
getClient, getDisableSSLVerification, getHeaders, getProxy, getProxyAuthenticator, getTokenMethods inherited from class AuthenticatorBase
constructBasicAuthHeader, constructBearerTokenAuthHeader
-
Field Details
-
AUTH_TYPE
- See Also:
-
-
Method Details
-
newAuthenticator
Get a new Authenticator instance for the supplied service URL and credentials that provides authentication via the Apache CouchDB _session endpoint.- Parameters:
username- the usernamepassword- the password- Returns:
- new Authenticator instance
-
getCookieJar
Getter for the cookie jar used to store the session information.- Returns:
- the cookie jar
-
setSessionUrl
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
- Overrides:
setHeadersin classTokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken, CouchDbSessionAuthenticator.CouchDbSessionToken>- Parameters:
headers-
-
validate
public void validate()- Specified by:
validatein interfaceAuthenticator- Specified by:
validatein classTokenRequestBasedAuthenticatorImmutable<CouchDbSessionAuthenticator.CouchDbSessionToken, CouchDbSessionAuthenticator.CouchDbSessionToken>
-
authenticationType
- Specified by:
authenticationTypein interfaceAuthenticator- Specified by:
authenticationTypein classTokenRequestBasedAuthenticatorImmutable<CouchDbSessionAuthenticator.CouchDbSessionToken, CouchDbSessionAuthenticator.CouchDbSessionToken>
-
authenticate
public void authenticate(okhttp3.Request.Builder requestBuilder) - Specified by:
authenticatein interfaceAuthenticator- Overrides:
authenticatein classTokenRequestBasedAuthenticatorImmutable<CouchDbSessionAuthenticator.CouchDbSessionToken, CouchDbSessionAuthenticator.CouchDbSessionToken>
-
requestToken
-
invalidateToken
public void invalidateToken()For internal use to invalidate the local token and force a refresh cycle with the server.
-