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:
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 ofAuthenticator
that provides authentication via the Apache CouchDB _session endpoint.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CouchDbSessionAuthenticator.CouchDbSessionToken
ImplementsTokenServerResponse
for an Apache CouchDB session cookie.
-
Field Summary
Fields Modifier and Type Field Description static String
AUTH_TYPE
-
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_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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
authenticate(okhttp3.Request.Builder requestBuilder)
String
authenticationType()
com.ibm.cloud.sdk.core.http.ServiceCookieJar
getCookieJar()
Getter for the cookie jar used to store the session information.void
invalidateToken()
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.CouchDbSessionAuthenticator.CouchDbSessionToken
requestToken()
void
setHeaders(Map<String,String> headers)
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
validate()
-
Methods inherited from class com.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator
getDisableSSLVerification, getHeaders, getProxy, getProxyAuthenticator, getToken, setDisableSSLVerification, setProxy, setProxyAuthenticator
-
-
-
-
Field Detail
-
AUTH_TYPE
public static final String AUTH_TYPE
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 usernamepassword
- 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 classcom.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken>
- Parameters:
headers
-
-
validate
public void validate()
- Specified by:
validate
in interfacecom.ibm.cloud.sdk.core.security.Authenticator
- Specified by:
validate
in classcom.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken>
-
authenticationType
public String authenticationType()
- Specified by:
authenticationType
in interfacecom.ibm.cloud.sdk.core.security.Authenticator
- Specified by:
authenticationType
in classcom.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken>
-
authenticate
public void authenticate(okhttp3.Request.Builder requestBuilder)
- Specified by:
authenticate
in interfacecom.ibm.cloud.sdk.core.security.Authenticator
- Overrides:
authenticate
in classcom.ibm.cloud.sdk.core.security.TokenRequestBasedAuthenticator<CouchDbSessionAuthenticator.CouchDbSessionToken,CouchDbSessionAuthenticator.CouchDbSessionToken>
-
requestToken
public CouchDbSessionAuthenticator.CouchDbSessionToken requestToken()
- Specified by:
requestToken
in classcom.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.
-
-