Package org.pac4j.core.client
Class BaseClient
java.lang.Object
org.pac4j.core.util.InitializableObject
org.pac4j.core.client.BaseClient
- All Implemented Interfaces:
Client
- Direct Known Subclasses:
DirectClient
,IndirectClient
This class is the default implementation of an authentication client (whatever the mechanism).
- Since:
- 1.4.0
- Author:
- Jerome Leleu
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAuthorizationGenerator
(AuthorizationGenerator authorizationGenerator) void
addAuthorizationGenerators
(List<AuthorizationGenerator> authorizationGenerators) protected void
checkCredentials
(CallContext ctx, Credentials credentials) Check the credentials.Get the credentials from the context.getName()
Get the name of the client.getSaveProfileInSession
(WebContext context, UserProfile profile) final Optional<UserProfile>
getUserProfile
(CallContext ctx, Credentials credentials) Get the user profile based on the credentials.protected Optional<Credentials>
internalValidateCredentials
(CallContext ctx, Credentials credentials) boolean
isMultiProfile
(WebContext context, UserProfile profile) void
notifySessionRenewal
(CallContext ctx, String oldSessionId) Notify of the web session renewal.renewUserProfile
(CallContext ctx, UserProfile profile) Renew the user profile.protected void
setAuthenticatorIfUndefined
(Authenticator authenticator) void
setAuthorizationGenerator
(AuthorizationGenerator authorizationGenerator) Add an authorization generator.void
setAuthorizationGenerators
(List<AuthorizationGenerator> authorizationGenerators) void
setAuthorizationGenerators
(AuthorizationGenerator... authorizationGenerators) protected void
setCredentialsExtractorIfUndefined
(CredentialsExtractor credentialsExtractor) void
setCustomProperties
(Map<String, Object> customProperties) protected void
setProfileCreatorIfUndefined
(ProfileCreator profileCreator) void
setProfileFactoryWhenNotAuthenticated
(ProfileFactory profileFactoryWhenNotAuthenticated) final Optional<Credentials>
validateCredentials
(CallContext ctx, Credentials credentials) Validate the credentials.Methods inherited from class org.pac4j.core.util.InitializableObject
afterInternalInit, beforeInternalInit, getNbAttempts, init, init, internalInit, isInitialized, reinit, shouldInitialize
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.pac4j.core.client.Client
getLogoutAction, getRedirectionAction, processLogout
-
Field Details
-
logger
protected final org.slf4j.Logger logger -
saveProfileInSession
-
-
Constructor Details
-
BaseClient
public BaseClient()
-
-
Method Details
-
getName
Description copied from interface:Client
Get the name of the client. -
getCredentials
Description copied from interface:Client
Get the credentials from the context.- Specified by:
getCredentials
in interfaceClient
- Parameters:
ctx
- the current context- Returns:
- the credentials (optional)
-
validateCredentials
Description copied from interface:Client
Validate the credentials.- Specified by:
validateCredentials
in interfaceClient
- Parameters:
ctx
- the current contextcredentials
- the authentication credentials- Returns:
- the credentials (optional)
-
internalValidateCredentials
protected Optional<Credentials> internalValidateCredentials(CallContext ctx, Credentials credentials) -
checkCredentials
Check the credentials.- Parameters:
ctx
- the contextcredentials
- the credentials
-
getUserProfile
Description copied from interface:Client
Get the user profile based on the credentials.- Specified by:
getUserProfile
in interfaceClient
- Parameters:
ctx
- the contextcredentials
- the authentication credentials- Returns:
- the user profile (optional)
-
renewUserProfile
Description copied from interface:Client
Renew the user profile.- Specified by:
renewUserProfile
in interfaceClient
- Parameters:
ctx
- the current contextprofile
- the user profile- Returns:
- the renewed user profile (optional).
-
notifySessionRenewal
Notify of the web session renewal.- Parameters:
ctx
- the contextoldSessionId
- the old session identifier
-
setAuthorizationGenerators
-
setAuthorizationGenerators
-
setAuthorizationGenerator
Add an authorization generator.- Parameters:
authorizationGenerator
- an authorizations generator
-
addAuthorizationGenerator
-
addAuthorizationGenerators
-
setCredentialsExtractorIfUndefined
-
setAuthenticatorIfUndefined
-
setProfileCreatorIfUndefined
-
setCustomProperties
-
setProfileFactoryWhenNotAuthenticated
public void setProfileFactoryWhenNotAuthenticated(ProfileFactory profileFactoryWhenNotAuthenticated) -
isMultiProfile
-
getSaveProfileInSession
-