Class IamAuthenticator

  • All Implemented Interfaces:
    Authenticator

    public class IamAuthenticator
    extends IamRequestBasedAuthenticator
    implements Authenticator
    This class provides an Authenticator implementation for IAM (Identity and Access Management). This authenticator will use the url and apikey values to automatically fetch an access token from the IAM token service via the "POST /identity/token" operation. When the access token expires, a new access token will be fetched.
    • Constructor Detail

      • IamAuthenticator

        @Deprecated
        public IamAuthenticator​(java.lang.String apikey)
        Deprecated.
        As of 9.7.0, use IamAuthenticator.Builder() instead
        Constructs an IamAuthenticator with required properties.
        Parameters:
        apikey - the apikey to be used when retrieving the access token
      • IamAuthenticator

        @Deprecated
        public IamAuthenticator​(java.lang.String apikey,
                                java.lang.String url,
                                java.lang.String clientId,
                                java.lang.String clientSecret,
                                boolean disableSSLVerification,
                                java.util.Map<java.lang.String,​java.lang.String> headers)
        Deprecated.
        As of 9.7.0, use IamAuthenticator.Builder() instead
        Constructs an IamAuthenticator with all properties.
        Parameters:
        apikey - the apikey to be used when retrieving the access token
        url - the base URL of the IAM token service (if null/empty, then "https://iam.cloud.ibm.com" is used)
        clientId - the clientId to be used in token server interactions
        clientSecret - the clientSecret to be used in token server interactions
        disableSSLVerification - a flag indicating whether SSL hostname verification should be disabled
        headers - a set of user-supplied headers to be included in token server interactions
      • IamAuthenticator

        @Deprecated
        public IamAuthenticator​(java.lang.String apikey,
                                java.lang.String url,
                                java.lang.String clientId,
                                java.lang.String clientSecret,
                                boolean disableSSLVerification,
                                java.util.Map<java.lang.String,​java.lang.String> headers,
                                java.lang.String scope)
        Deprecated.
        As of 9.7.0, use IamAuthenticator.Builder() instead
        Constructs an IamAuthenticator with all properties.
        Parameters:
        apikey - the apikey to be used when retrieving the access token
        url - the base URL of the IAM token service (if null/empty, then "https://iam.cloud.ibm.com" is used)
        clientId - the clientId to be used in token server interactions
        clientSecret - the clientSecret to be used in token server interactions
        disableSSLVerification - a flag indicating whether SSL hostname verification should be disabled
        headers - a set of user-supplied headers to be included in token server interactions
        scope - the "scope" to use when fetching the bearer token from the IAM token server. This can be used to obtain an access token with a specific scope.
      • IamAuthenticator

        @Deprecated
        public IamAuthenticator​(java.util.Map<java.lang.String,​java.lang.String> config)
        Deprecated.
        As of 9.7.0, use IamAuthenticator.Builder() instead
        Construct an IamAuthenticator instance using properties retrieved from the specified Map.
        Parameters:
        config - a map containing the configuration properties
    • Method Detail

      • newBuilder

        public IamAuthenticator.Builder newBuilder()
        Returns a new Builder instance pre-loaded with the configuration from "this".
        Returns:
        the Builder instance
      • fromConfiguration

        public static IamAuthenticator fromConfiguration​(java.util.Map<java.lang.String,​java.lang.String> config)
        Construct a IamAuthenticator instance using properties retrieved from the specified Map.
        Parameters:
        config - a map containing the configuration properties
        Returns:
        the IamAuthenticator instance
      • getApiKey

        public java.lang.String getApiKey()
        Returns:
        the apikey configured on this Authenticator.
      • getUsername

        public java.lang.String getUsername()
        Deprecated.
        As of 9.7.0, use getClientId() instead
        Returns:
        the basic auth username (clientId) configured for this Authenticator.
      • getPassword

        public java.lang.String getPassword()
        Deprecated.
        As of 9.7.0, use getClientSecret() instead
        Returns:
        the basic auth password (clientSecret) configured for this Authenticator.
      • setBasicAuthInfo

        @Deprecated
        public void setBasicAuthInfo​(java.lang.String clientId,
                                     java.lang.String clientSecret)
        Deprecated.
        As of 9.7.0, use IamAuthenticator.setClientIdAndSecret() instead
        Sets the basic auth username and password values in this Authenticator. These values will be used to build a basic auth Authorization header that will be sent with each request to the token service.
        Parameters:
        clientId - the basic auth username
        clientSecret - the basic auth password