Class OpenIdConfiguration

All Implemented Interfaces:
Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle

public class OpenIdConfiguration extends ContainerLifeCycle
Holds the configuration for an OpenID Connect service. This uses the OpenID Provider URL with the path CONFIG_PATH to discover the required information about the OIDC service.
  • Field Details

    • LOG

      private static final Logger LOG
    • CONFIG_PATH

      private static final String CONFIG_PATH
      See Also:
    • httpClient

      private final HttpClient httpClient
    • issuer

      private final String issuer
    • clientId

      private final String clientId
    • clientSecret

      private final String clientSecret
    • scopes

      private final List<String> scopes
    • authMethod

      private final String authMethod
    • authEndpoint

      private String authEndpoint
    • tokenEndpoint

      private String tokenEndpoint
  • Constructor Details

    • OpenIdConfiguration

      public OpenIdConfiguration(String provider, String clientId, String clientSecret)
      Create an OpenID configuration for a specific OIDC provider.
      Parameters:
      provider - The URL of the OpenID provider.
      clientId - OAuth 2.0 Client Identifier valid at the Authorization Server.
      clientSecret - The client secret known only by the Client and the Authorization Server.
    • OpenIdConfiguration

      public OpenIdConfiguration(String issuer, String authorizationEndpoint, String tokenEndpoint, String clientId, String clientSecret, HttpClient httpClient)
      Create an OpenID configuration for a specific OIDC provider.
      Parameters:
      issuer - The URL of the OpenID provider.
      authorizationEndpoint - the URL of the OpenID provider's authorization endpoint if configured.
      tokenEndpoint - the URL of the OpenID provider's token endpoint if configured.
      clientId - OAuth 2.0 Client Identifier valid at the Authorization Server.
      clientSecret - The client secret known only by the Client and the Authorization Server.
      httpClient - The HttpClient instance to use.
    • OpenIdConfiguration

      public OpenIdConfiguration(String issuer, String authorizationEndpoint, String tokenEndpoint, String clientId, String clientSecret, String authMethod, HttpClient httpClient)
      Create an OpenID configuration for a specific OIDC provider.
      Parameters:
      issuer - The URL of the OpenID provider.
      authorizationEndpoint - the URL of the OpenID provider's authorization endpoint if configured.
      tokenEndpoint - the URL of the OpenID provider's token endpoint if configured.
      clientId - OAuth 2.0 Client Identifier valid at the Authorization Server.
      clientSecret - The client secret known only by the Client and the Authorization Server.
      authMethod - Authentication method to use with the Token Endpoint.
      httpClient - The HttpClient instance to use.
  • Method Details

    • doStart

      protected void doStart() throws Exception
      Description copied from class: ContainerLifeCycle
      Starts the managed lifecycle beans in the order they were added.
      Overrides:
      doStart in class ContainerLifeCycle
      Throws:
      Exception
    • newHttpClient

      private static HttpClient newHttpClient()
    • fetchOpenIdConnectMetadata

      private static Map<String,Object> fetchOpenIdConnectMetadata(String provider, HttpClient httpClient)
    • getHttpClient

      public HttpClient getHttpClient()
    • getAuthEndpoint

      public String getAuthEndpoint()
    • getClientId

      public String getClientId()
    • getClientSecret

      public String getClientSecret()
    • getIssuer

      public String getIssuer()
    • getTokenEndpoint

      public String getTokenEndpoint()
    • getAuthMethod

      public String getAuthMethod()
    • addScopes

      public void addScopes(String... scopes)
    • getScopes

      public List<String> getScopes()