Class AuthenticationManagerImpl
- java.lang.Object
-
- org.craftercms.security.authentication.impl.AuthenticationManagerImpl
-
- All Implemented Interfaces:
AuthenticationManager
public class AuthenticationManagerImpl extends Object implements AuthenticationManager
Default implementation ofAuthenticationManager.- Author:
- avasquez
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthenticationCacheauthenticationCacheprotected AuthenticationServiceauthenticationServiceprotected ProfileServiceprofileService
-
Constructor Summary
Constructors Constructor Description AuthenticationManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticationauthenticateUser(String[] tenants, String username, String password)Authenticates a user.AuthenticationauthenticateUser(String tenant, String username, String password)Authenticates a user.AuthenticationauthenticateUser(Profile profile)Authenticates a user just with it's profile ID.AuthenticationauthenticateUser(Profile profile, boolean remembered)Authenticates a user just with it's profile ID.AuthenticationgetAuthentication(String ticket, boolean reloadProfile)Returns the authentication associated to the given ticket IDvoidinvalidateAuthentication(Authentication authentication)Invalidates the given authentication.protected ProfileloadProfile(String ticketId)voidsetAuthenticationCache(AuthenticationCache authenticationCache)voidsetAuthenticationService(AuthenticationService authenticationService)voidsetProfileService(ProfileService profileService)
-
-
-
Field Detail
-
authenticationService
protected AuthenticationService authenticationService
-
profileService
protected ProfileService profileService
-
authenticationCache
protected AuthenticationCache authenticationCache
-
-
Method Detail
-
setAuthenticationService
public void setAuthenticationService(AuthenticationService authenticationService)
-
setProfileService
public void setProfileService(ProfileService profileService)
-
setAuthenticationCache
public void setAuthenticationCache(AuthenticationCache authenticationCache)
-
authenticateUser
public Authentication authenticateUser(String tenant, String username, String password)
Description copied from interface:AuthenticationManagerAuthenticates a user.- Specified by:
authenticateUserin 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:AuthenticationManagerAuthenticates a user.- Specified by:
authenticateUserin 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
public Authentication authenticateUser(Profile profile) throws AuthenticationException
Description copied from interface:AuthenticationManagerAuthenticates a user just with it's profile ID. Use only when the user has already being identified.- Specified by:
authenticateUserin 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:AuthenticationManagerAuthenticates a user just with it's profile ID. Use only when the user has already being identified.- Specified by:
authenticateUserin 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:AuthenticationManagerReturns the authentication associated to the given ticket ID- Specified by:
getAuthenticationin 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
public void invalidateAuthentication(Authentication authentication)
Description copied from interface:AuthenticationManagerInvalidates the given authentication.- Specified by:
invalidateAuthenticationin interfaceAuthenticationManager- Parameters:
authentication- the authentication to invalidate
-
loadProfile
protected Profile loadProfile(String ticketId) throws AuthenticationException
- Throws:
AuthenticationException
-
-