| com.uwyn.rife.authentication.elements.Identified com.uwyn.rife.authentication.elements.Authenticated
All known Subclasses: com.uwyn.rife.authentication.elements.RoleUserAuthenticated,
Authenticated | abstract public class Authenticated extends Identified implements SessionAttributes(Code) | | Requires that the user have a valid authentication session before access
to a child element is allowed. This class contains the logic for restoring
remembered sessions and displaying a template (typically a login form)
if the user is not authenticated.
The following properties may be set:
- enforce_authenticated (default = true)
- Controls whether access to child elements is allowed for users who
don't have valid authentication sessions. If this property is false,
a user with no authentication session is allowed to access the
child element, but there is no user identity information available.
The child element implementation may distinguish an anonymous user
from an authenticated one by calling
Authenticated.getRequestAttribute(String) getRequestAttribute(Identified.IDENTITY_ATTRIBUTE_NAME) }.
This is similar to using an
Identified } element,
but expired sessions will automatically be recreated if the user has
the appropriate "remember me" cookie set and "remember me" is enabled.
To customize the behavior of the authentication, it's the easiest to override
one of the hook methods.
author: Steven Grimm (koreth[remove] at midwinter dot com) author: Geert Bevin (gbevin[remove] at uwyn dot com) version: $Revision: 3654 $ since: 1.6 |
Method Summary | |
protected void | acceptedCredentials(Credentials credentials) Hook method that is called when valid credentials have been accepted by the
CredentialsManager that backs this authentication element. | protected void | authenticated(long userId) Hook method that is called after a new authentication session has been
successfully created. | public boolean | childTriggered(String name, String[] values) | public static String | createAuthenticationRequestAttributeName(ElementInfo elementInfo, String name, String value) Creates a name for the current authentication context that can be used to
cache the authentication process' result as a request attribute. | protected void | entrance(Template template) Hook method that is called after the template instance has been instantiated. | public ElementInfo | getAuthElement() Returns the ElementInfo of this authentication element. | public String | getAuthenticatedElementId() Returns the ID of this authentication element. | public Class<? extends Credentials> | getCredentialsClass() Returns the class that is used for handling the credentials. | public SessionValidator | getSessionValidator() Returns the class that is used for handling the credentials. | protected void | initializeAuthentication() Hook method that is called at the start of the element's execution. | public void | processElement() | protected void | refusedCredentials(Template template, Credentials credentials) Hook method that is called when valid credentials have been rejected by the
CredentialsManager that backs this authentication element.
This can for example happen when the password is not correct.
Note that there is already a default implementation of this hook method that
simply adds a validation error to the credentials object. | protected void | sessionCreationError(Template template, Credentials credentials) Hook method that is called when the SessionManager couldn't
create a new authentication session of valid and accepted credentials.
Note that there is already a default implementation of this hook method that
simply adds a validation error to the credentials object. | protected void | sessionNotValid(String childTriggerName, String[] childTriggerValues, int validityId) Hook method that is called when the SessionValidator doesn't
accept the authentication ID that a user provides after having been logged
in. | protected void | setTemplateName(String name) Allows a custom template name to be set. | protected void | unvalidatedCredentials(Template template, Credentials credentials) Hook method that is called on login form submission when validation of the
credentials produces validation errors. | protected void | validatedCredentials(Credentials credentials) |
Authenticated | protected Authenticated()(Code) | | |
acceptedCredentials | protected void acceptedCredentials(Credentials credentials)(Code) | | Hook method that is called when valid credentials have been accepted by the
CredentialsManager that backs this authentication element.
Parameters: credentials - the credentials object that was accepted since: 1.0 |
authenticated | protected void authenticated(long userId)(Code) | | Hook method that is called after a new authentication session has been
successfully created.
Parameters: userId - the user ID of the user that was successfully authenticated since: 1.0 |
createAuthenticationRequestAttributeName | public static String createAuthenticationRequestAttributeName(ElementInfo elementInfo, String name, String value) throws EngineException(Code) | | Creates a name for the current authentication context that can be used to
cache the authentication process' result as a request attribute. This name
is built from the authentication element's ID, the name of the
authentication var and its value.
Parameters: elementInfo - the authentication element information Parameters: name - the name of the authentication variable Parameters: value - the value of the authentication variable the created name since: 1.5 |
entrance | protected void entrance(Template template)(Code) | | Hook method that is called after the template instance has been instantiated.
Parameters: template - the template instance that has been instantiated since: 1.0 |
getAuthElement | public ElementInfo getAuthElement()(Code) | | Returns the ElementInfo of this authentication element.
this authentication element's ElementInfo since: 1.0 |
getAuthenticatedElementId | public String getAuthenticatedElementId()(Code) | | Returns the ID of this authentication element.
this authentication element's ID since: 1.0 |
getCredentialsClass | public Class<? extends Credentials> getCredentialsClass()(Code) | | Returns the class that is used for handling the credentials.
this credentials' class since: 1.0 |
getSessionValidator | public SessionValidator getSessionValidator()(Code) | | Returns the class that is used for handling the credentials.
the credentials' class since: 1.0 |
initializeAuthentication | protected void initializeAuthentication()(Code) | | Hook method that is called at the start of the element's execution.
since: 1.0 |
processElement | public void processElement()(Code) | | |
refusedCredentials | protected void refusedCredentials(Template template, Credentials credentials)(Code) | | Hook method that is called when valid credentials have been rejected by the
CredentialsManager that backs this authentication element.
This can for example happen when the password is not correct.
Note that there is already a default implementation of this hook method that
simply adds a validation error to the credentials object. If you want to
preserve this when you implement your own hook method, you need to call the
super class's method in your implementation.
Parameters: template - this authentication element's template Parameters: credentials - the credentials object that was rejected since: 1.0 |
sessionCreationError | protected void sessionCreationError(Template template, Credentials credentials)(Code) | | Hook method that is called when the SessionManager couldn't
create a new authentication session of valid and accepted credentials.
Note that there is already a default implementation of this hook method that
simply adds a validation error to the credentials object. If you want to
preserve this when you implement your own hook method, you need to call the
super class's method in your implementation.
Parameters: template - this authentication element's template Parameters: credentials - the credentials object that was used when creating theauthentication session since: 1.0 |
sessionNotValid | protected void sessionNotValid(String childTriggerName, String[] childTriggerValues, int validityId)(Code) | | Hook method that is called when the SessionValidator doesn't
accept the authentication ID that a user provides after having been logged
in.
This can happen for example happen when the maximum duration has expired,
when the authentication ID has been tampered with, or when the
authentication ID isn't known anymore by the backing store.
Parameters: childTriggerName - the name of the child trigger that containsthe authentication ID Parameters: childTriggerValues - the values of the child trigger with theauthentication ID Parameters: validityId - a number that indicates the validation state of thesession, as used by the SessionValidator , more information canbe found here: SessionValidator.validateSession since: 1.0 |
setTemplateName | protected void setTemplateName(String name)(Code) | | Allows a custom template name to be set.
This method is typically called during the implementation of method hooks
to change the template that will be used by this authentication element.
Parameters: name - the name of the template since: 1.0 |
unvalidatedCredentials | protected void unvalidatedCredentials(Template template, Credentials credentials)(Code) | | Hook method that is called on login form submission when validation of the
credentials produces validation errors.
Parameters: template - this authentication element's template Parameters: credentials - the credentials object that was invalid since: 1.0 |
validatedCredentials | protected void validatedCredentials(Credentials credentials)(Code) | | Hook method that is called on login form submission when the credentials
are validated without errors
Parameters: credentials - the credentials object that was valid since: 1.0 |
Fields inherited from com.uwyn.rife.authentication.elements.Identified | final public static String IDENTITY_ATTRIBUTE_NAME(Code)(Java Doc)
|
|
|