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>
_acceptedSiteUrlPatterns
url 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 CredentialProvider
getCredentialProviderFromSession(Request request)
Get the credential provider used for the current connectionstatic CredentialProvider
getCredentialProviderFromSession(Request request, String siteName)
Get the credential provider used for the current connectionstatic Boolean
getCredentialProviderModeFromSession(Request request)
Get the credential provider mode used for the current connectionstatic Boolean
getCredentialProviderModeFromSession(Request request, String siteName)
Get the credential provider mode used for the current connectionprotected String
getLoginURL(Request request)
Get the url for the redirector to display the login screenprotected String
getLogoutURL(Request request)
Get the url for the redirector to display the logout screenstatic UserIdentity
getUserIdentityFromSession(Request request)
Get the user identity of the connected user from the sessionstatic UserIdentity
getUserIdentityFromSession(Request request, String siteName)
Get the user identity of the connected user from the sessionstatic void
setUserIdentityInSession(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:AuthenticateAction
Determine if the request is one of the authentication process (except the credential providers)- Overrides:
_acceptedUrl
in 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:AuthenticateAction
Save user identity in request- Overrides:
_setUserIdentityInSession
in 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:AuthenticateAction
Get the user identity of the connected user from the session- Overrides:
_getUserIdentityFromSession
in 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:AuthenticateAction
Get the credential provider used for the current connection- Overrides:
_getCredentialProviderFromSession
in 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:AuthenticateAction
Get the credential provider mode used for the current connection- Overrides:
_getCredentialProviderModeFromSession
in 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:AuthenticateAction
Get the authentication context- Overrides:
_getContexts
in classAuthenticateAction
- Parameters:
request
- The requestparameters
- The action parameters- Returns:
- The context
-
getLoginURL
protected String getLoginURL(Request request)
Description copied from class:AuthenticateAction
Get the url for the redirector to display the login screen- Overrides:
getLoginURL
in classAuthenticateAction
- Parameters:
request
- The request- Returns:
- The url. Cannot be null or empty
-
getLogoutURL
protected String getLogoutURL(Request request)
Description copied from class:AuthenticateAction
Get the url for the redirector to display the logout screen- Overrides:
getLogoutURL
in 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:AuthenticateAction
Test if user wants to logout and handle it- Overrides:
_handleLogout
in 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:AuthenticateAction
Validate the given token- Overrides:
_validateToken
in 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
-
-