Package com.ibm.cloud.cloudant.security
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:
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
Modifier and TypeClassDescriptionstatic class
ImplementsTokenServerResponse
for an Apache CouchDB session cookie. -
Field Summary
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 TypeMethodDescriptionvoid
authenticate
(okhttp3.Request.Builder requestBuilder) 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 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
setHeaders
(Map<String, String> headers) void
setSessionUrl
(String serviceUrl) Setter to configure this authenticator with a new session URL derived from the supplied service URL.void
validate()
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
-
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:
setHeaders
in classTokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,
CouchDbSessionAuthenticator.CouchDbSessionToken> - Parameters:
headers
-
-
validate
public void validate()- Specified by:
validate
in interfaceAuthenticator
- Specified by:
validate
in classTokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,
CouchDbSessionAuthenticator.CouchDbSessionToken>
-
authenticationType
- Specified by:
authenticationType
in interfaceAuthenticator
- Specified by:
authenticationType
in classTokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,
CouchDbSessionAuthenticator.CouchDbSessionToken>
-
authenticate
public void authenticate(okhttp3.Request.Builder requestBuilder) - Specified by:
authenticate
in interfaceAuthenticator
- Overrides:
authenticate
in classTokenRequestBasedAuthenticator<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.
-