Package io.vertigo.connectors.oidc
Class OIDCClient
java.lang.Object
io.vertigo.connectors.oidc.OIDCClient
- All Implemented Interfaces:
IOIDCClient
Custom OpenID Connect client over the Nimbus library.
- Author:
- skerdudou
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetLoginUrl(URI callbackUri, IOIDCStateStorage oidcStateStorage, Optional<Locale> localeOpt, Map<String, Serializable> additionalInfos, String... requestedScopes) Generates the login URL for the OpenID Connect (OIDC) authentication request.Build the logout URL for the SSO.com.nimbusds.openid.connect.sdk.token.OIDCTokensparseResponse(URI responseUri, URI callbackUri, IOIDCStateStorage oidcStateStorage) Get OIDC tokens from the SSO response.retrieveAdditionalInfos(URI responseUri, IOIDCStateStorage oidcStateStorage) Retrieves the additional infos provided with according getLoginUrl method.
-
Constructor Details
-
OIDCClient
-
-
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:
getLoginUrlin interfaceIOIDCClient- Parameters:
callbackUri- the callback URI to handle the authentication responseoidcStateStorage- the storage to keep the state and nonce for the callbacklocaleOpt- 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 timerequestedScopes- 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:
parseResponsein interfaceIOIDCClient- Parameters:
responseUri- the current URI, with OIDC parameters (state and code)callbackUri- the callback URI provided when sending user to SSO login pageoidcStateStorage- 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:
retrieveAdditionalInfosin interfaceIOIDCClient- Parameters:
responseUri- the current URI, with OIDC parameters (state and code)oidcStateStorage- the storage to retrieve the statesession- 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:
getLogoutUrlin interfaceIOIDCClient- Parameters:
redirectUriOpt- the URL to redirect to after logoutidTokenOpt- 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
-