Interface Client
-
- All Known Implementing Classes:
AnonymousClient
,BaseClient
,DirectClient
,IndirectClient
public interface Client
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, thegetCredentials(WebContext, SessionStore)
method is used to retrieve the credentials provided by the remote identity provider and thegetUserProfile(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, thegetCredentials(WebContext, SessionStore)
method is used to retrieve and validate the credentials provided and thegetUserProfile(Credentials, WebContext, SessionStore)
method is called to get the user profile from the appropriate system.- Since:
- 1.4.0
- Author:
- Jerome Leleu
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Optional<Credentials>
getCredentials(WebContext context, SessionStore sessionStore)
Get the credentials from the web context.java.util.Optional<RedirectionAction>
getLogoutAction(WebContext context, SessionStore sessionStore, UserProfile currentProfile, java.lang.String targetUrl)
Return the logout action (indirect clients).java.lang.String
getName()
Get the name of the client.java.util.Optional<RedirectionAction>
getRedirectionAction(WebContext context, SessionStore sessionStore)
Return the redirection action to the authentication provider (indirect clients).java.util.Optional<UserProfile>
getUserProfile(Credentials credentials, WebContext context, SessionStore sessionStore)
Get the user profile based on the provided credentials.java.util.Optional<UserProfile>
renewUserProfile(UserProfile profile, WebContext context, SessionStore sessionStore)
Renew the user profile.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Get the name of the client.- Returns:
- the name of the client
-
getRedirectionAction
java.util.Optional<RedirectionAction> getRedirectionAction(WebContext context, SessionStore sessionStore)
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
java.util.Optional<Credentials> getCredentials(WebContext context, SessionStore sessionStore)
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
java.util.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
java.util.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
java.util.Optional<RedirectionAction> getLogoutAction(WebContext context, SessionStore sessionStore, UserProfile currentProfile, java.lang.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)
-
-