Class OAuth2ClientCredentialsStrategy

  • All Implemented Interfaces:
    AuthStrategy, RocketSSL.SSLAware

    public class OAuth2ClientCredentialsStrategy
    extends AbstractOAuth2Strategy
    Authentication strategy that implements OAuth 2.0 client credentials flow. This strategy gets and refreshes OAuth 2.0 access tokens using client credentials.
    • Constructor Detail

      • OAuth2ClientCredentialsStrategy

        public OAuth2ClientCredentialsStrategy​(String clientId,
                                               String clientSecret,
                                               String tokenUrl)
        Creates a new OAuth 2.0 client credentials strategy.
        Parameters:
        clientId - the OAuth 2.0 client ID
        clientSecret - the OAuth 2.0 client secret
        tokenUrl - the OAuth 2.0 token endpoint URL
      • OAuth2ClientCredentialsStrategy

        public OAuth2ClientCredentialsStrategy​(String clientId,
                                               String clientSecret,
                                               String tokenUrl,
                                               Map<String,​String> additionalParams)
        Creates a new OAuth 2.0 client credentials strategy with additional parameters.
        Parameters:
        clientId - the OAuth 2.0 client ID
        clientSecret - the OAuth 2.0 client secret
        tokenUrl - the OAuth 2.0 token endpoint URL
        additionalParams - additional parameters to include in the token request
    • Method Detail

      • getType

        public AuthStrategy.AuthType getType()
        Description copied from interface: AuthStrategy
        Returns the auth type of this strategy.
        Returns:
        the authentication type
      • prepareTokenRequestParams

        protected Map<String,​String> prepareTokenRequestParams()
        Prepares the parameters for the token request.

        Prepares parameters for the client credentials grant type, including grant_type, client_id, and client_secret.

        Specified by:
        prepareTokenRequestParams in class AbstractOAuth2Strategy
        Returns:
        map of parameters to include in the token request