Package org.ametys.site
Class FrontAuthenticateAction
-
- All Implemented Interfaces:
Initializable,Component,LogEnabled,Serviceable,ThreadSafe,Action
- Direct Known Subclasses:
FrontBlockingCredentialProviderAction
public class FrontAuthenticateAction extends AuthenticateAction
The authenticate action for front side
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.ametys.core.authentication.AuthenticateAction
AuthenticateAction.TOKEN_MODE
-
-
Field Summary
Fields Modifier and Type Field Description protected Collection<Pattern>_acceptedSiteUrlPatternsurl requires for authentication-
Fields inherited from class org.ametys.core.authentication.AuthenticateAction
_acceptedUrlPatterns, _authenticateTokenManager, _currentUserProvider, _observationManager, _populationContextHelper, _userManager, _userPopulationDAO, HEADER_TOKEN, PARAMETERS_PARAMETER_TOKEN, PARAMETERS_PARAMETER_TOKEN_CONTEXT, REQUEST_ATTRIBUTE_AUTHENTICATED, REQUEST_ATTRIBUTE_AVAILABLE_USER_POPULATIONS_LIST, REQUEST_ATTRIBUTE_CONTEXTS, REQUEST_ATTRIBUTE_CREDENTIAL_PROVIDER_INDEX, REQUEST_ATTRIBUTE_CREDENTIAL_PROVIDER_LIST, REQUEST_ATTRIBUTE_GRANTED, REQUEST_ATTRIBUTE_INTERNAL_ALLOWED, REQUEST_ATTRIBUTE_INVALID_POPULATION, REQUEST_ATTRIBUTE_LOGIN_URL, REQUEST_ATTRIBUTE_SHOULD_DISPLAY_USER_POPULATIONS_LIST, REQUEST_ATTRIBUTE_USER_POPULATION_ID, REQUEST_PARAMETER_CREDENTIALPROVIDER_INDEX, REQUEST_PARAMETER_POPULATION_NAME, REQUEST_PARAMETER_TOKEN, REQUEST_PARAMETER_TOKEN_CONTEXT, SESSION_CONNECTING_CREDENTIALPROVIDER_INDEX, SESSION_CONNECTING_CREDENTIALPROVIDER_INDEX_LASTBLOCKINGKNOWN, SESSION_CONNECTING_CREDENTIALPROVIDER_MODE, SESSION_CONNECTING_USERPOPULATION_ID, SESSION_CREDENTIALPROVIDER, SESSION_CREDENTIALPROVIDER_MODE, SESSION_USERIDENTITY, SITEMAP_PARAMETER_TOKEN_MODE
-
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
-
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
-
Constructor Summary
Constructors Constructor Description FrontAuthenticateAction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean_acceptedUrl(Request request)Determine if the request is one of the authentication process (except the credential providers)protected List<String>_getContexts(Request request, Parameters parameters)Get the authentication contextprotected CredentialProvider_getCredentialProviderFromSession(Request request)Get the credential provider used for the current connectionprotected Boolean_getCredentialProviderModeFromSession(Request request)Get the credential provider mode used for the current connectionprotected UserIdentity_getUserIdentityFromSession(Request request)Get the user identity of the connected user from the sessionprotected boolean_handleLogout(Redirector redirector, Map objectModel, String source, Parameters parameters)Test if user wants to logout and handle itprotected void_setUserIdentityInSession(Request request, UserIdentity userIdentity, CredentialProvider credentialProvider, boolean blockingMode)Save user identity in requestprotected UserIdentity_validateToken(String token, String context)Validate the given tokenstatic CredentialProvidergetCredentialProviderFromSession(Request request)Get the credential provider used for the current connectionstatic CredentialProvidergetCredentialProviderFromSession(Request request, String siteName)Get the credential provider used for the current connectionstatic BooleangetCredentialProviderModeFromSession(Request request)Get the credential provider mode used for the current connectionstatic BooleangetCredentialProviderModeFromSession(Request request, String siteName)Get the credential provider mode used for the current connectionprotected StringgetLoginURL(Request request)Get the url for the redirector to display the login screenprotected StringgetLogoutURL(Request request)Get the url for the redirector to display the logout screenstatic UserIdentitygetUserIdentityFromSession(Request request)Get the user identity of the connected user from the sessionstatic UserIdentitygetUserIdentityFromSession(Request request, String siteName)Get the user identity of the connected user from the sessionstatic voidsetUserIdentityInSession(Request request, UserIdentity userIdentity, CredentialProvider credentialProvider, boolean blockingMode)Save user identity in request-
Methods inherited from class org.ametys.core.authentication.AuthenticateAction
_doProcess, _getAvailableUserPopulationsIds, _getChosenUserPopulationId, _getCurrentCredentialProviderIndex, _getCurrentCredentialProviderIndexFromParameter, _getTokenFromRequest, _getUserIdentity, _handleAuthenticationToken, _hasCredentialProviders, _internalRequest, _isCurrentCredentialProviderInBlockingMode, _preFlightCheck, _prepareUserPopulationsAndCredentialProviders, _process, _renewSession, _resetConnectingStateToSession, _saveConnectingStateToSession, _validateCurrentlyConnectedUser, _validateCurrentlyConnectedUserIsInAuthorizedPopulation, act, getLoginURLParameters, initialize, skipCurrentCredentialProvider
-
Methods inherited from class org.apache.cocoon.acting.ServiceableAction
service
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_acceptedSiteUrlPatterns
protected Collection<Pattern> _acceptedSiteUrlPatterns
url requires for authentication
-
-
Constructor Detail
-
FrontAuthenticateAction
public FrontAuthenticateAction()
-
-
Method Detail
-
_acceptedUrl
protected boolean _acceptedUrl(Request request)
Description copied from class:AuthenticateActionDetermine if the request is one of the authentication process (except the credential providers)- Overrides:
_acceptedUrlin classAuthenticateAction- Parameters:
request- The request- Returns:
- true to bypass this authentication
-
_setUserIdentityInSession
protected void _setUserIdentityInSession(Request request, UserIdentity userIdentity, CredentialProvider credentialProvider, boolean blockingMode)
Description copied from class:AuthenticateActionSave user identity in request- Overrides:
_setUserIdentityInSessionin classAuthenticateAction- Parameters:
request- The requestuserIdentity- The useridentity to savecredentialProvider- The credential provider used to connectblockingMode- The mode used for the credential provider
-
setUserIdentityInSession
public static void setUserIdentityInSession(Request request, UserIdentity userIdentity, CredentialProvider credentialProvider, boolean blockingMode)
Save user identity in request- Parameters:
request- The requestuserIdentity- The useridentity to savecredentialProvider- The credential provider used to connectblockingMode- The mode used for the credential provider
-
_getUserIdentityFromSession
protected UserIdentity _getUserIdentityFromSession(Request request)
Description copied from class:AuthenticateActionGet the user identity of the connected user from the session- Overrides:
_getUserIdentityFromSessionin classAuthenticateAction- Parameters:
request- The request- Returns:
- The connected useridentity or null
-
getUserIdentityFromSession
public static UserIdentity getUserIdentityFromSession(Request request)
Get the user identity of the connected user from the session- Parameters:
request- The request- Returns:
- The connected useridentity or null
-
getUserIdentityFromSession
public static UserIdentity getUserIdentityFromSession(Request request, String siteName)
Get the user identity of the connected user from the session- Parameters:
request- The requestsiteName- The current site name- Returns:
- The connected useridentity or null
-
_getCredentialProviderFromSession
protected CredentialProvider _getCredentialProviderFromSession(Request request)
Description copied from class:AuthenticateActionGet the credential provider used for the current connection- Overrides:
_getCredentialProviderFromSessionin classAuthenticateAction- Parameters:
request- The request- Returns:
- The credential provider used or null
-
getCredentialProviderFromSession
public static CredentialProvider getCredentialProviderFromSession(Request request)
Get the credential provider used for the current connection- Parameters:
request- The request- Returns:
- The credential provider used or null
-
getCredentialProviderFromSession
public static CredentialProvider getCredentialProviderFromSession(Request request, String siteName)
Get the credential provider used for the current connection- Parameters:
request- The requestsiteName- The current site name- Returns:
- The credential provider used or null
-
_getCredentialProviderModeFromSession
protected Boolean _getCredentialProviderModeFromSession(Request request)
Description copied from class:AuthenticateActionGet the credential provider mode used for the current connection- Overrides:
_getCredentialProviderModeFromSessionin classAuthenticateAction- Parameters:
request- The request- Returns:
- The credential provider mode used or null
-
getCredentialProviderModeFromSession
public static Boolean getCredentialProviderModeFromSession(Request request)
Get the credential provider mode used for the current connection- Parameters:
request- The request- Returns:
- The credential provider mode used or null
-
getCredentialProviderModeFromSession
public static Boolean getCredentialProviderModeFromSession(Request request, String siteName)
Get the credential provider mode used for the current connection- Parameters:
request- The requestsiteName- The current site name- Returns:
- The credential provider mode used or null
-
_getContexts
protected List<String> _getContexts(Request request, Parameters parameters)
Description copied from class:AuthenticateActionGet the authentication context- Overrides:
_getContextsin classAuthenticateAction- Parameters:
request- The requestparameters- The action parameters- Returns:
- The context
-
getLoginURL
protected String getLoginURL(Request request)
Description copied from class:AuthenticateActionGet the url for the redirector to display the login screen- Overrides:
getLoginURLin classAuthenticateAction- Parameters:
request- The request- Returns:
- The url. Cannot be null or empty
-
getLogoutURL
protected String getLogoutURL(Request request)
Description copied from class:AuthenticateActionGet the url for the redirector to display the logout screen- Overrides:
getLogoutURLin classAuthenticateAction- Parameters:
request- The request- Returns:
- The url. Cannot be null or empty
-
_handleLogout
protected boolean _handleLogout(Redirector redirector, Map objectModel, String source, Parameters parameters) throws Exception
Description copied from class:AuthenticateActionTest if user wants to logout and handle it- Overrides:
_handleLogoutin classAuthenticateAction- Parameters:
redirector- The cocoon redirectorobjectModel- The cocoon object modelsource- The sitemap sourceparameters- The sitemap parameters- Returns:
- true if the user was logged out
- Throws:
Exception- if an error occurred
-
_validateToken
protected UserIdentity _validateToken(String token, String context)
Description copied from class:AuthenticateActionValidate the given token- Overrides:
_validateTokenin classAuthenticateAction- Parameters:
token- The non empty token to validatecontext- the context on which the token should be validated- Returns:
- The corresponding user identity or null
-
-