Interface Client
- All Known Implementing Classes:
AnonymousClient
,BaseClient
,DirectClient
,IndirectClient
This interface is the core class of the library. It represents an authentication mechanism to validate user's credentials and retrieve his user profile.
Clients can be "indirect": in that case, credentials are not provided with the HTTP request, but the user must be redirected to an identity provider to perform login, the original requested url being saved and restored after the authentication process is done.
The getRedirectionAction(WebContext, SessionStore)
method is called to get the redirection to the identity provider,
the getCredentials(WebContext, SessionStore)
method is used to retrieve the credentials provided
by the remote identity provider and the getUserProfile(Credentials, WebContext, SessionStore)
method is called
to get the user profile from the identity provider and based on the provided credentials.
Clients can be "direct": in that case, credentials are provided along with the HTTP request and validated by the application.
The getRedirectionAction(WebContext, SessionStore)
method is not used,
the getCredentials(WebContext, SessionStore)
method is used to retrieve and validate the credentials provided
and the getUserProfile(Credentials, WebContext, SessionStore)
method is called
to get the user profile from the appropriate system.
- Since:
- 1.4.0
- Author:
- Jerome Leleu
-
Method Summary
Modifier and TypeMethodDescriptiongetCredentials
(WebContext context, SessionStore sessionStore) Get the credentials from the web context.getLogoutAction
(WebContext context, SessionStore sessionStore, UserProfile currentProfile, String targetUrl) Return the logout action (indirect clients).getName()
Get the name of the client.getRedirectionAction
(WebContext context, SessionStore sessionStore) Return the redirection action to the authentication provider (indirect clients).getUserProfile
(Credentials credentials, WebContext context, SessionStore sessionStore) Get the user profile based on the provided credentials.renewUserProfile
(UserProfile profile, WebContext context, SessionStore sessionStore) Renew the user profile.
-
Method Details
-
getName
String getName()Get the name of the client.- Returns:
- the name of the client
-
getRedirectionAction
Return the redirection action to the authentication provider (indirect clients).
- Parameters:
context
- the current web contextsessionStore
- the session store- Returns:
- the redirection to perform (optional)
-
getCredentials
Get the credentials from the web context. If no validation was made remotely (direct client), credentials must be validated at this step.
- Parameters:
context
- the current web contextsessionStore
- the session store- Returns:
- the credentials (optional)
-
getUserProfile
Optional<UserProfile> getUserProfile(Credentials credentials, WebContext context, SessionStore sessionStore) Get the user profile based on the provided credentials.- Parameters:
credentials
- credentialscontext
- web contextsessionStore
- the session store- Returns:
- the user profile (optional)
-
renewUserProfile
Optional<UserProfile> renewUserProfile(UserProfile profile, WebContext context, SessionStore sessionStore) Renew the user profile.- Parameters:
profile
- the user profilecontext
- the current web contextsessionStore
- the session store- Returns:
- the renewed user profile (optional).
-
getLogoutAction
Optional<RedirectionAction> getLogoutAction(WebContext context, SessionStore sessionStore, UserProfile currentProfile, String targetUrl) Return the logout action (indirect clients).
- Parameters:
context
- the current web contextsessionStore
- the session storecurrentProfile
- the currentProfiletargetUrl
- the target url after logout- Returns:
- the redirection to perform (optional)
-