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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAuthorizationGenerator
(AuthorizationGenerator authorizationGenerator) addAuthorizationGenerator.void
addAuthorizationGenerators
(Collection<AuthorizationGenerator> authorizationGenerators) addAuthorizationGenerators.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) Getter for the fieldsaveProfileInSession
.final Optional<UserProfile>
getUserProfile
(CallContext ctx, Credentials credentials) Get the user profile based on the credentials.protected Optional<Credentials>
internalValidateCredentials
(CallContext ctx, Credentials credentials) internalValidateCredentials.boolean
isMultiProfile
(WebContext context, UserProfile profile) isMultiProfile.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) setAuthenticatorIfUndefined.void
setAuthorizationGenerator
(AuthorizationGenerator authorizationGenerator) Add an authorization generator.void
setAuthorizationGenerators
(List<AuthorizationGenerator> authorizationGenerators) Setter for the fieldauthorizationGenerators
.void
setAuthorizationGenerators
(AuthorizationGenerator... authorizationGenerators) Setter for the fieldauthorizationGenerators
.protected void
setCredentialsExtractorIfUndefined
(CredentialsExtractor credentialsExtractor) setCredentialsExtractorIfUndefined.void
setCustomProperties
(Map<String, Object> customProperties) Setter for the fieldcustomProperties
.protected void
setProfileCreatorIfUndefined
(ProfileCreator profileCreator) setProfileCreatorIfUndefined.void
setProfileFactoryWhenNotAuthenticated
(ProfileFactory profileFactoryWhenNotAuthenticated) Setter for the fieldprofileFactoryWhenNotAuthenticated
.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
Get the name of the client. -
getCredentials
Get the credentials from the context.- Specified by:
getCredentials
in interfaceClient
- Parameters:
ctx
- the current context- Returns:
- the credentials (optional)
-
validateCredentials
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) internalValidateCredentials.
- Parameters:
ctx
- aCallContext
objectcredentials
- aCredentials
object- Returns:
- a
Optional
object
-
checkCredentials
Check the credentials.- Parameters:
ctx
- the contextcredentials
- the credentials
-
getUserProfile
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
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
Setter for the field
authorizationGenerators
.- Parameters:
authorizationGenerators
- aList
object
-
setAuthorizationGenerators
Setter for the field
authorizationGenerators
.- Parameters:
authorizationGenerators
- aAuthorizationGenerator
object
-
setAuthorizationGenerator
Add an authorization generator.- Parameters:
authorizationGenerator
- an authorizations generator
-
addAuthorizationGenerator
addAuthorizationGenerator.
- Parameters:
authorizationGenerator
- aAuthorizationGenerator
object
-
addAuthorizationGenerators
addAuthorizationGenerators.
- Parameters:
authorizationGenerators
- aList
object
-
setCredentialsExtractorIfUndefined
setCredentialsExtractorIfUndefined.
- Parameters:
credentialsExtractor
- aCredentialsExtractor
object
-
setAuthenticatorIfUndefined
setAuthenticatorIfUndefined.
- Parameters:
authenticator
- aAuthenticator
object
-
setProfileCreatorIfUndefined
setProfileCreatorIfUndefined.
- Parameters:
profileCreator
- aProfileCreator
object
-
setCustomProperties
Setter for the field
customProperties
.- Parameters:
customProperties
- aMap
object
-
setProfileFactoryWhenNotAuthenticated
public void setProfileFactoryWhenNotAuthenticated(ProfileFactory profileFactoryWhenNotAuthenticated) Setter for the field
profileFactoryWhenNotAuthenticated
.- Parameters:
profileFactoryWhenNotAuthenticated
- aProfileFactory
object
-
isMultiProfile
isMultiProfile.
- Parameters:
context
- aWebContext
objectprofile
- aUserProfile
object- Returns:
- a boolean
-
getSaveProfileInSession
Getter for the field
saveProfileInSession
.- Parameters:
context
- aWebContext
objectprofile
- aUserProfile
object- Returns:
- a
Boolean
object
-