net.bryansaunders.jee6divelog.security
Class Identity

java.lang.Object
  extended by net.bryansaunders.jee6divelog.security.Identity
All Implemented Interfaces:
java.io.Serializable

@SessionScoped
@Named(value="identity")
public class Identity
extends java.lang.Object
implements java.io.Serializable

User Identity implements Serializable.

Author:
Bryan Saunders
See Also:
Serialized Form

Field Summary
static java.lang.Integer LOGGED_IN
          Identity Logged In.
static java.lang.Integer LOGGED_OUT
          Identity Logged Out.
static boolean LOGIN_FAILURE
          Login Failure.
static boolean LOGIN_SUCCESS
          Login Success.
static java.lang.String LOGOUT_FAILURE
          Logout Failure.
static java.lang.String LOGOUT_SUCCESS
          Logout Success.
 
Constructor Summary
Identity()
          Default Constructor.
 
Method Summary
 java.util.Date getApiKeyExpiration()
          Get the apiKeyExpiration.
 java.lang.String getPassword()
          Get Password.
 java.util.Set<Permission> getPermissions()
          Get the permissions.
 java.lang.String getPrivateApiKey()
          Get the Private apiKey.
 java.lang.String getPublicApiKey()
          Get the Public apiKey.
 java.util.Set<Role> getRoles()
          Get the roles.
 java.lang.Integer getStatus()
          Get the status.
 java.lang.String getUsername()
          Get Username.
 boolean hasPermission(Permission permission)
          Has the specified Permission.
 boolean hasRole(Role role)
          Has the specified Role.
 boolean isLoggedIn()
          Is the Identity Logged in?
 boolean isRememberMe()
          Get the rememberMe.
 boolean login()
          Login Identity.
 boolean login(boolean restLogin)
          Login Identity.
 java.lang.String logout()
          Logout the current User.
 boolean restLogin()
          Login Identity for REST Service.
 void setApiKeyExpiration(java.util.Date newApiKeyExpiration)
          Set the apiKeyExpiration.
 void setCredentials(Credentials newCredentials)
          Set the credentials.
 void setPermissions(java.util.Set<Permission> newPermissions)
          Set the permissions.
 void setPrivateApiKey(java.lang.String newApiKey)
          Set the Private apiKey.
 void setPublicApiKey(java.lang.String newApiKey)
          Set the Public apiKey.
 void setRememberMe(boolean newRememberMe)
          Set the rememberMe.
 void setRoles(java.util.Set<Role> newRoles)
          Set the roles.
 void setStatus(java.lang.Integer newStatus)
          Set the status.
 void setUserAccountService(UserAccountService newUserAccountService)
          Set the userAccountService.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGIN_FAILURE

public static final boolean LOGIN_FAILURE
Login Failure.

See Also:
Constant Field Values

LOGIN_SUCCESS

public static final boolean LOGIN_SUCCESS
Login Success.

See Also:
Constant Field Values

LOGOUT_FAILURE

public static final java.lang.String LOGOUT_FAILURE
Logout Failure.

See Also:
Constant Field Values

LOGOUT_SUCCESS

public static final java.lang.String LOGOUT_SUCCESS
Logout Success.

See Also:
Constant Field Values

LOGGED_OUT

public static final java.lang.Integer LOGGED_OUT
Identity Logged Out.


LOGGED_IN

public static final java.lang.Integer LOGGED_IN
Identity Logged In.

Constructor Detail

Identity

public Identity()
Default Constructor.

Method Detail

login

public boolean login()
Login Identity.

Returns:
Login Result

restLogin

public boolean restLogin()
Login Identity for REST Service.

Returns:
Login Result

login

public boolean login(boolean restLogin)
Login Identity.

Parameters:
restLogin - Is it a REST Login
Returns:
Login Result

logout

public java.lang.String logout()
Logout the current User.

Returns:
Logout Result

isLoggedIn

public boolean isLoggedIn()
Is the Identity Logged in?

Returns:
true if logged in

getStatus

public java.lang.Integer getStatus()
Get the status.

Returns:
the status

setStatus

public void setStatus(java.lang.Integer newStatus)
Set the status.

Parameters:
newStatus - the status to set

getUsername

public java.lang.String getUsername()
Get Username.

Returns:
username

getPassword

public java.lang.String getPassword()
Get Password.

Returns:
password

setCredentials

public void setCredentials(Credentials newCredentials)
Set the credentials.

Parameters:
newCredentials - the credentials to set

setUserAccountService

public void setUserAccountService(UserAccountService newUserAccountService)
Set the userAccountService.

Parameters:
newUserAccountService - the userAccountService to set

getRoles

public java.util.Set<Role> getRoles()
Get the roles.

Returns:
the roles

setRoles

public void setRoles(java.util.Set<Role> newRoles)
Set the roles.

Parameters:
newRoles - the roles to set

getPermissions

public java.util.Set<Permission> getPermissions()
Get the permissions.

Returns:
the permissions

setPermissions

public void setPermissions(java.util.Set<Permission> newPermissions)
Set the permissions.

Parameters:
newPermissions - the permissions to set

isRememberMe

public boolean isRememberMe()
Get the rememberMe.

Returns:
the rememberMe

setRememberMe

public void setRememberMe(boolean newRememberMe)
Set the rememberMe.

Parameters:
newRememberMe - the rememberMe to set

hasRole

public boolean hasRole(Role role)
Has the specified Role.

Parameters:
role - Role to check for
Returns:
true if role is found

hasPermission

public boolean hasPermission(Permission permission)
Has the specified Permission.

Parameters:
permission - Permission to check for
Returns:
true if permission is found

getPublicApiKey

public java.lang.String getPublicApiKey()
Get the Public apiKey.

Returns:
the apiKey

setPublicApiKey

public void setPublicApiKey(java.lang.String newApiKey)
Set the Public apiKey.

Parameters:
newApiKey - the apiKey to set

getPrivateApiKey

public java.lang.String getPrivateApiKey()
Get the Private apiKey.

Returns:
the apiKey

setPrivateApiKey

public void setPrivateApiKey(java.lang.String newApiKey)
Set the Private apiKey.

Parameters:
newApiKey - the apiKey to set

getApiKeyExpiration

public java.util.Date getApiKeyExpiration()
Get the apiKeyExpiration.

Returns:
the apiKeyExpiration

setApiKeyExpiration

public void setApiKeyExpiration(java.util.Date newApiKeyExpiration)
Set the apiKeyExpiration.

Parameters:
newApiKeyExpiration - the apiKeyExpiration to set


Copyright © 2012 Bryan Saunders. All Rights Reserved.