Class OIDCClient

java.lang.Object
io.vertigo.connectors.oidc.OIDCClient
All Implemented Interfaces:
IOIDCClient

public class OIDCClient extends Object implements IOIDCClient
Custom OpenID Connect client over the Nimbus library.
Author:
skerdudou
  • Constructor Details

  • Method Details

    • getLoginUrl

      public String getLoginUrl(URI callbackUri, IOIDCStateStorage oidcStateStorage, Optional<Locale> localeOpt, Map<String,Serializable> additionalInfos, String... requestedScopes)
      Generates the login URL for the OpenID Connect (OIDC) authentication request.
      Specified by:
      getLoginUrl in interface IOIDCClient
      Parameters:
      callbackUri - the callback URI to handle the authentication response
      oidcStateStorage - the storage to keep the state and nonce for the callback
      localeOpt - the optional locale to forward to the SSO. Sent if localeParamName is configured.
      additionalInfos - you can store additional infos that can be retrieved at callback time
      requestedScopes - the scopes requested for the authentication
      Returns:
      the URL to redirect the user to for OIDC authentication
    • parseResponse

      public com.nimbusds.openid.connect.sdk.token.OIDCTokens parseResponse(URI responseUri, URI callbackUri, IOIDCStateStorage oidcStateStorage)
      Get OIDC tokens from the SSO response.
      Specified by:
      parseResponse in interface IOIDCClient
      Parameters:
      responseUri - the current URI, with OIDC parameters (state and code)
      callbackUri - the callback URI provided when sending user to SSO login page
      oidcStateStorage - the storage to retrieve the state and nonce
      Returns:
      OIDC tokens (with ID token and Access token).
    • retrieveAdditionalInfos

      public Map<String,Serializable> retrieveAdditionalInfos(URI responseUri, IOIDCStateStorage oidcStateStorage)
      Retrieves the additional infos provided with according getLoginUrl method.
      Specified by:
      retrieveAdditionalInfos in interface IOIDCClient
      Parameters:
      responseUri - the current URI, with OIDC parameters (state and code)
      oidcStateStorage - the storage to retrieve the state
      session - the current HTTP session
      Returns:
      the additional infos corresponding to those provided at login time
    • getLogoutUrl

      public String getLogoutUrl(Optional<URI> redirectUriOpt, Optional<String> idTokenOpt, Optional<Locale> localeOpt)
      Build the logout URL for the SSO.
      Specified by:
      getLogoutUrl in interface IOIDCClient
      Parameters:
      redirectUriOpt - the URL to redirect to after logout
      idTokenOpt - the ID token of the connected user to logout. Needed by some SSO providers to skip logout confirmation. user session if any, needed for logoutIdParamName to be sent (prevent session ending confirmation by the SSO)
      localeOpt - the user locale, default to French. Sent if localeParamName is configured.
      Returns:
      the URL to logout the user from the SSO