Interface OAuth2Settings<T>

Type Parameters:
T - the type of object returned by methods, usually the object itself

public interface OAuth2Settings<T>
Configuration to retrieve a token using the OAuth 2 Client Credentials flow.

OAuth 2 requires RabbitMQ 4.1 or more.

Since:
0.4.0
  • Method Details

    • tokenEndpointUri

      OAuth2Settings<T> tokenEndpointUri(String uri)
      Set the URI to access to get the token.

      TLS is supported by providing a HTTPS URI and setting a SSLContext. See tls() for more information. Applications in production should always use HTTPS to retrieve tokens.

      Parameters:
      uri - access URI
      Returns:
      OAuth 2 settings
      See Also:
    • clientId

      OAuth2Settings<T> clientId(String clientId)
      Set the OAuth 2 client ID

      The client ID usually identifies the application that requests a token.

      Parameters:
      clientId - client ID
      Returns:
      OAuth 2 settings
    • clientSecret

      OAuth2Settings<T> clientSecret(String clientSecret)
      Set the secret (password) to use to get a token.
      Parameters:
      clientSecret - client secret
      Returns:
      OAuth 2 settings
    • grantType

      OAuth2Settings<T> grantType(String grantType)
      Set the grant type to use when requesting the token.

      The default is client_credentials, but some OAuth 2 servers can use non-standard grant types to request tokens with extra-information.

      Parameters:
      grantType - grant type
      Returns:
      OAuth 2 settings
    • parameter

      OAuth2Settings<T> parameter(String name, String value)
      Set a parameter to pass in the request.

      The OAuth 2 server may require extra parameters to narrow down the identity of the user.

      Parameters:
      name - name of the parameter
      value - value of the parameter
      Returns:
      OAuth 2 settings
    • shared

      OAuth2Settings<T> shared(boolean shared)
      Whether to share the same token between connections.

      Default is true (the token is shared between connections).

      Parameters:
      shared - flag to share the token between connections
      Returns:
      OAuth 2 settings
    • tls

      OAuth2Settings.TlsSettings<? extends T> tls()
      TLS configuration for requesting the token.
      Returns:
      TLS configuration
    • connection

      T connection()
      Connection settings.
      Returns:
      connections settings