Class AuthenticationManagerImpl
java.lang.Object
org.craftercms.security.authentication.impl.AuthenticationManagerImpl
- All Implemented Interfaces:
AuthenticationManager
Default implementation of
AuthenticationManager
.- Author:
- avasquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthenticationCache
protected AuthenticationService
protected ProfileService
-
Constructor Summary
ConstructorsConstructorDescriptionAuthenticationManagerImpl
(AuthenticationService authenticationService, ProfileService profileService, AuthenticationCache authenticationCache) -
Method Summary
Modifier and TypeMethodDescriptionauthenticateUser
(String[] tenants, String username, String password) Authenticates a user.authenticateUser
(String tenant, String username, String password) Authenticates a user.authenticateUser
(Profile profile) Authenticates a user just with it's profile ID.authenticateUser
(Profile profile, boolean remembered) Authenticates a user just with it's profile ID.getAuthentication
(String ticket, boolean reloadProfile) Returns the authentication associated to the given ticket IDvoid
invalidateAuthentication
(Authentication authentication) Invalidates the given authentication.protected Profile
loadProfile
(String ticketId)
-
Field Details
-
authenticationService
-
profileService
-
authenticationCache
-
-
Constructor Details
-
AuthenticationManagerImpl
public AuthenticationManagerImpl(AuthenticationService authenticationService, ProfileService profileService, AuthenticationCache authenticationCache)
-
-
Method Details
-
authenticateUser
Description copied from interface:AuthenticationManager
Authenticates a user.- Specified by:
authenticateUser
in interfaceAuthenticationManager
- Parameters:
tenant
- the tenant's name the user profile belongs tousername
- the user's usernamepassword
- the user's password- Returns:
- the authentication object, which contains the ticket and the user's profile
-
authenticateUser
public Authentication authenticateUser(String[] tenants, String username, String password) throws AuthenticationException Description copied from interface:AuthenticationManager
Authenticates a user.- Specified by:
authenticateUser
in interfaceAuthenticationManager
- Parameters:
tenants
- the tenant chain to try authentication withusername
- the user's usernamepassword
- the user's password- Returns:
- the authentication object, which contains the ticket and the user's profile
- Throws:
AuthenticationException
-
authenticateUser
Description copied from interface:AuthenticationManager
Authenticates a user just with it's profile ID. Use only when the user has already being identified.- Specified by:
authenticateUser
in interfaceAuthenticationManager
- Parameters:
profile
- the user's profile- Returns:
- the authentication object, which contains the ticket and the user's profile
- Throws:
AuthenticationException
-
authenticateUser
public Authentication authenticateUser(Profile profile, boolean remembered) throws AuthenticationException Description copied from interface:AuthenticationManager
Authenticates a user just with it's profile ID. Use only when the user has already being identified.- Specified by:
authenticateUser
in interfaceAuthenticationManager
- Parameters:
profile
- the user's profileremembered
- if the authentication was done through remember me.- Returns:
- the authentication object, which contains the ticket and the user's profile
- Throws:
AuthenticationException
-
getAuthentication
public Authentication getAuthentication(String ticket, boolean reloadProfile) throws AuthenticationException Description copied from interface:AuthenticationManager
Returns the authentication associated to the given ticket ID- Specified by:
getAuthentication
in interfaceAuthenticationManager
- Parameters:
ticket
- the authentication ticketreloadProfile
- if the cached profile should be reloaded- Returns:
- the authentication object associated to the ticket ID, or null if no authentication was found for the ticket ID (anonymous user)
- Throws:
AuthenticationException
-
invalidateAuthentication
Description copied from interface:AuthenticationManager
Invalidates the given authentication.- Specified by:
invalidateAuthentication
in interfaceAuthenticationManager
- Parameters:
authentication
- the authentication to invalidate
-
loadProfile
- Throws:
AuthenticationException
-