|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.seam.security.IdentityImpl
@Named(value="identity") @SessionScoped public class IdentityImpl
Identity implementation for authentication and authorization
Field Summary | |
---|---|
protected static boolean |
securityEnabled
|
Fields inherited from interface org.jboss.seam.security.Identity |
---|
RESPONSE_LOGIN_EXCEPTION, RESPONSE_LOGIN_FAILED, RESPONSE_LOGIN_SUCCESS |
Constructor Summary | |
---|---|
IdentityImpl()
|
Method Summary | |
---|---|
boolean |
addGroup(String name,
String groupType)
Adds the user to the specified group. |
boolean |
addRole(String roleType,
String group,
String groupType)
Adds a role to the authenticated user. |
protected boolean |
authenticate()
|
void |
checkGroup(String group,
String groupType)
|
void |
checkPermission(Object target,
String action)
Checks if the currently authenticated user has the specified permission for the specified resource. |
void |
checkRestriction(String expr)
Performs an authorization check, based on the specified security expression string. |
void |
checkRole(String roleType,
String group,
String groupType)
Checks that the current authenticated user is a member of the specified role. |
protected void |
deferredAuthenticationObserver(DeferredAuthenticationEvent event)
|
void |
filterByPermission(Collection<?> collection,
String action)
Filters a collection of objects by a specified action, by removing the objects from the collection for which the user doesn't have the necessary privileges to perform the specified action against that object. |
Class<Authenticator> |
getAuthenticatorClass()
|
String |
getAuthenticatorName()
|
Set<org.picketlink.idm.api.Group> |
getGroups()
Returns an immutable set containing all the current user's group memberships |
Set<org.picketlink.idm.api.Role> |
getRoles()
Returns an immutable set containing all the current user's granted roles |
org.picketlink.idm.api.User |
getUser()
Returns the currently authenticated user |
boolean |
hasPermission(Object target,
String action)
Checks if the currently authenticated user has the necessary permission for a specific resource. |
boolean |
hasRole(String roleType,
String group,
String groupType)
Checks if the authenticated user is a member of the specified role. |
boolean |
inGroup(String name,
String groupType)
Checks if the authenticated user is a member of the specified group |
boolean |
isLoggedIn()
Simple check that returns true if the user is logged in, without attempting to authenticate |
static boolean |
isSecurityEnabled()
|
boolean |
isVerified()
Returns true if the currently authenticated user has provided their correct credentials within the verification window configured by the application. |
String |
login()
Performs an authorization check, based on the specified security expression string. |
void |
logout()
Logs out the currently authenticated user |
protected Authenticator |
lookupAuthenticator()
Returns an Authenticator instance to be used for authentication. |
protected void |
postAuthenticate()
|
protected void |
preAuthenticate()
Clears any roles added by calling addRole() while not authenticated. |
void |
quietLogin()
Attempts a quiet login, suppressing any login exceptions and not creating any faces messages. |
void |
removeGroup(String name,
String groupType)
Removes the currently authenticated user from the specified group |
void |
removeRole(String roleType,
String group,
String groupType)
Removes a role from the authenticated user |
void |
runAs(RunAsOperation operation)
|
void |
setAuthenticatorClass(Class<Authenticator> authenticatorClass)
|
void |
setAuthenticatorName(String authenticatorName)
|
static void |
setSecurityEnabled(boolean enabled)
|
boolean |
tryLogin()
Will attempt to authenticate quietly if the user's credentials are set and they haven't authenticated already. |
void |
unAuthenticate()
Resets all security state and credentials |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static boolean securityEnabled
Constructor Detail |
---|
public IdentityImpl()
Method Detail |
---|
public static boolean isSecurityEnabled()
public static void setSecurityEnabled(boolean enabled)
public boolean isLoggedIn()
Identity
isLoggedIn
in interface Identity
public Class<Authenticator> getAuthenticatorClass()
getAuthenticatorClass
in interface Identity
public void setAuthenticatorClass(Class<Authenticator> authenticatorClass)
setAuthenticatorClass
in interface Identity
public String getAuthenticatorName()
getAuthenticatorName
in interface Identity
public void setAuthenticatorName(String authenticatorName)
setAuthenticatorName
in interface Identity
public boolean tryLogin()
Identity
tryLogin
in interface Identity
public String login()
login
in interface Identity
expr
- The security expression string to evaluate
NotLoggedInException
- Thrown if the authorization check fails and
the user is not authenticated
AuthorizationException
- Thrown if the authorization check fails and
the user is authenticatedpublic void quietLogin()
Identity
quietLogin
in interface Identity
protected boolean authenticate() throws AuthenticationException
AuthenticationException
protected void preAuthenticate()
protected void deferredAuthenticationObserver(@Observes DeferredAuthenticationEvent event)
protected void postAuthenticate()
protected Authenticator lookupAuthenticator() throws AuthenticationException
AuthenticationException
public void unAuthenticate()
public void logout()
Identity
logout
in interface Identity
public boolean hasRole(String roleType, String group, String groupType)
Identity
hasRole
in interface Identity
roleType
- String The name of the role to check
public boolean addRole(String roleType, String group, String groupType)
Identity
addRole
in interface Identity
roleType
- The name of the role to addpublic boolean inGroup(String name, String groupType)
Identity
inGroup
in interface Identity
name
- The name of the groupgroupType
- The type of the group, e.g. "office", "department", "global role", etc
public boolean addGroup(String name, String groupType)
Identity
addGroup
in interface Identity
name
- The name of the groupgroupType
- The type of the group
public void removeGroup(String name, String groupType)
Identity
removeGroup
in interface Identity
name
- The name of the groupgroupType
- The type of the grouppublic void removeRole(String roleType, String group, String groupType)
removeRole
in interface Identity
role
- The name of the role to removepublic void checkRole(String roleType, String group, String groupType)
Identity
checkRole
in interface Identity
roleType
- String The name of the role to checkpublic void checkGroup(String group, String groupType)
checkGroup
in interface Identity
public void checkPermission(Object target, String action)
Identity
checkPermission
in interface Identity
target
- The resource for which the user wishes to perform a restricted actionaction
- The name of the permission that the user requires to invoke the operationpublic void filterByPermission(Collection<?> collection, String action)
Identity
filterByPermission
in interface Identity
collection
- The Collection to filterpublic boolean hasPermission(Object target, String action)
Identity
hasPermission
in interface Identity
public void runAs(RunAsOperation operation)
public void checkRestriction(String expr)
Identity
checkRestriction
in interface Identity
expr
- The security expression string to evaluatepublic org.picketlink.idm.api.User getUser()
Identity
getUser
in interface Identity
public Set<org.picketlink.idm.api.Role> getRoles()
Identity
getRoles
in interface Identity
public Set<org.picketlink.idm.api.Group> getGroups()
Identity
getGroups
in interface Identity
public boolean isVerified()
Identity
isVerified
in interface Identity
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |