public class BasicAuthenticator extends AuthenticatorBase implements Authenticator
Modifier and Type | Class and Description |
---|---|
static class |
BasicAuthenticator.Builder
This Builder class is used to construct BasicAuthenticator instances.
|
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
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
Constructor and Description |
---|
BasicAuthenticator(java.util.Map<java.lang.String,java.lang.String> config)
Deprecated.
As of 9.7.0, use BasicAuthenticator.fromConfiguration() instead.
|
BasicAuthenticator(java.lang.String username,
java.lang.String password)
Deprecated.
As of 9.7.0, use the Builder class instead.
|
Modifier and Type | Method and Description |
---|---|
void |
authenticate(okhttp3.Request.Builder builder)
This method is called to authenticate an outgoing REST API request.
|
java.lang.String |
authenticationType()
Returns the authentication type associated with the Authenticator instance.
|
static BasicAuthenticator |
fromConfiguration(java.util.Map<java.lang.String,java.lang.String> config)
Construct a BasicAuthenticator instance using properties retrieved from the specified Map.
|
java.lang.String |
getPassword() |
java.lang.String |
getUsername() |
BasicAuthenticator.Builder |
newBuilder()
Returns a new Builder instance pre-loaded with the configuration from "this".
|
void |
validate()
Validates the current set of configuration information in the Authenticator.
|
constructBasicAuthHeader, constructBearerTokenAuthHeader
@Deprecated public BasicAuthenticator(java.lang.String username, java.lang.String password)
username
- the basic auth usernamepassword
- the basic auth password@Deprecated public BasicAuthenticator(java.util.Map<java.lang.String,java.lang.String> config)
config
- a map containing the username and password valuespublic BasicAuthenticator.Builder newBuilder()
public static BasicAuthenticator fromConfiguration(java.util.Map<java.lang.String,java.lang.String> config)
config
- a map containing the configuration propertiespublic void validate()
Authenticator
validate
in interface Authenticator
public java.lang.String authenticationType()
Authenticator
authenticationType
in interface Authenticator
public java.lang.String getUsername()
public java.lang.String getPassword()
public void authenticate(okhttp3.Request.Builder builder)
authenticate
in interface Authenticator
builder
- the Request.Builder
instance to authenticateCopyright © 2022 IBM Cloud Developer Experience. All rights reserved.