Class AuthSessionCookie
- java.lang.Object
-
- auth.gui.AuthSessionCookie
-
- All Implemented Interfaces:
AuthAction.AuthMethod
public class AuthSessionCookie extends java.lang.Object implements AuthAction.AuthMethod
This class defines authentication via session cookies (which is the default authentication in the Play Framework).It checks Play's session cookie and does authorization. It has several layers of security:
1) First, it checks if a username is in Play's session cookie and if this username belongs to a user in the database.
2) Check if the session timed out. The time span is defined in the application.conf.
3) Check if the session timed out due to inactivity of the user. With each request by the user, the time of last activity gets refreshed in the session.
4) Check if the signed-in user has the proper Role needed to access this page. This Role is an optional parameter in the
AuthAction.Authannotation.5) It checks if the user was deactivated by an admin.
The
AuthAction.Authannotation does not check the user's password. This is done once during signing in (classSignin).The
Userobject is put in theRequestScopefor later use during request processing.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface auth.gui.AuthAction.AuthMethod
AuthAction.AuthMethod.AuthResult, AuthAction.AuthMethod.Type
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthAction.AuthMethod.AuthResultauthenticate(play.mvc.Http.Request request, java.util.EnumSet<User.Role> allowedRoles)AuthAction.AuthMethod.Typetype()
-
-
-
Method Detail
-
type
public AuthAction.AuthMethod.Type type()
- Specified by:
typein interfaceAuthAction.AuthMethod
-
authenticate
public AuthAction.AuthMethod.AuthResult authenticate(play.mvc.Http.Request request, java.util.EnumSet<User.Role> allowedRoles)
- Specified by:
authenticatein interfaceAuthAction.AuthMethod- Parameters:
request- This action'sHttp.RequestobjectallowedRoles- Roles that are allowed to access the resource- Returns:
- Returns an
AuthAction.AuthMethod.AuthResult.
-
-