|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.seam.security.Identity
@Name(value="org.jboss.seam.security.identity") @Scope(value=SESSION) @Install(precedence=0) @BypassInterceptors @Startup public class Identity
API for authorization and authentication via Seam security. This base implementation supports role-based authorization only. Subclasses may add more sophisticated permissioning mechanisms.
| Field Summary | |
|---|---|
static java.lang.String |
EVENT_ALREADY_LOGGED_IN
|
static java.lang.String |
EVENT_LOGGED_OUT
|
static java.lang.String |
EVENT_LOGIN_FAILED
|
static java.lang.String |
EVENT_LOGIN_SUCCESSFUL
|
static java.lang.String |
EVENT_NOT_AUTHORIZED
|
static java.lang.String |
EVENT_NOT_LOGGED_IN
|
static java.lang.String |
EVENT_POST_AUTHENTICATE
|
static java.lang.String |
EVENT_PRE_AUTHENTICATE
|
static java.lang.String |
EVENT_QUIET_LOGIN
|
static java.lang.String |
ROLES_GROUP
|
protected static boolean |
securityEnabled
|
| Constructor Summary | |
|---|---|
Identity()
|
|
| Method Summary | |
|---|---|
void |
acceptExternallyAuthenticatedPrincipal(java.security.Principal principal)
|
boolean |
addRole(java.lang.String role)
Adds a role to the authenticated user. |
void |
authenticate()
|
protected void |
authenticate(javax.security.auth.login.LoginContext loginContext)
|
void |
checkPermission(java.lang.Object target,
java.lang.String action)
|
void |
checkPermission(java.lang.String name,
java.lang.String action,
java.lang.Object... arg)
Checks that the current authenticated user has permission for the specified name and action |
void |
checkRestriction(java.lang.String expr)
Performs an authorization check, based on the specified security expression. |
void |
checkRole(java.lang.String role)
Checks that the current authenticated user is a member of the specified role. |
void |
create()
|
protected boolean |
evaluateExpression(java.lang.String expr)
Evaluates the specified security expression, which must return a boolean value. |
void |
filterByPermission(java.util.Collection collection,
java.lang.String action)
|
Expressions.MethodExpression |
getAuthenticateMethod()
|
Credentials |
getCredentials()
|
java.lang.String |
getJaasConfigName()
|
protected javax.security.auth.login.LoginContext |
getLoginContext()
|
java.lang.String |
getPassword()
Deprecated. |
java.security.Principal |
getPrincipal()
|
javax.security.auth.Subject |
getSubject()
|
java.lang.String |
getUsername()
Deprecated. |
boolean |
hasPermission(java.lang.Object target,
java.lang.String action)
|
boolean |
hasPermission(java.lang.String name,
java.lang.String action,
java.lang.Object... arg)
Performs a permission check for the specified name and action |
boolean |
hasRole(java.lang.String role)
Checks if the authenticated user is a member of the specified role. |
static Identity |
instance()
|
boolean |
isLoggedIn()
Simple check that returns true if the user is logged in, without attempting to authenticate |
boolean |
isLoggedIn(boolean attemptLogin)
Deprecated. |
boolean |
isRememberMe()
Deprecated. |
static boolean |
isSecurityEnabled()
|
java.lang.String |
login()
Attempts to authenticate the user. |
void |
logout()
|
protected void |
postAuthenticate()
Extracts the principal from the subject, and populates the roles of the authenticated user. |
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 |
removeRole(java.lang.String role)
Removes a role from the authenticated user |
void |
setAuthenticateMethod(Expressions.MethodExpression authMethod)
|
void |
setJaasConfigName(java.lang.String jaasConfigName)
|
void |
setPassword(java.lang.String password)
Deprecated. |
void |
setRememberMe(boolean remember)
Deprecated. |
static void |
setSecurityEnabled(boolean enabled)
|
void |
setUsername(java.lang.String username)
Deprecated. |
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 |
|---|
public static final java.lang.String EVENT_LOGIN_SUCCESSFUL
public static final java.lang.String EVENT_LOGIN_FAILED
public static final java.lang.String EVENT_NOT_LOGGED_IN
public static final java.lang.String EVENT_NOT_AUTHORIZED
public static final java.lang.String EVENT_PRE_AUTHENTICATE
public static final java.lang.String EVENT_POST_AUTHENTICATE
public static final java.lang.String EVENT_LOGGED_OUT
public static final java.lang.String EVENT_ALREADY_LOGGED_IN
public static final java.lang.String EVENT_QUIET_LOGIN
protected static boolean securityEnabled
public static final java.lang.String ROLES_GROUP
| Constructor Detail |
|---|
public Identity()
| Method Detail |
|---|
@Create public void create()
public static boolean isSecurityEnabled()
public static void setSecurityEnabled(boolean enabled)
public static Identity instance()
public boolean isLoggedIn()
public boolean tryLogin()
@Deprecated public boolean isLoggedIn(boolean attemptLogin)
public void acceptExternallyAuthenticatedPrincipal(java.security.Principal principal)
public java.security.Principal getPrincipal()
public javax.security.auth.Subject getSubject()
public void checkRestriction(java.lang.String expr)
expr - The security expression 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 java.lang.String login()
public void quietLogin()
public void authenticate()
throws javax.security.auth.login.LoginException
javax.security.auth.login.LoginException
protected void authenticate(javax.security.auth.login.LoginContext loginContext)
throws javax.security.auth.login.LoginException
javax.security.auth.login.LoginExceptionprotected void preAuthenticate()
protected void postAuthenticate()
public void unAuthenticate()
protected javax.security.auth.login.LoginContext getLoginContext()
throws javax.security.auth.login.LoginException
javax.security.auth.login.LoginExceptionpublic void logout()
public boolean hasRole(java.lang.String role)
role - String The name of the role to check
public boolean addRole(java.lang.String role)
role - The name of the role to addpublic void removeRole(java.lang.String role)
role - The name of the role to removepublic void checkRole(java.lang.String role)
role - String The name of the role to check
AuthorizationException - if the authenticated user is not a member of the role
public void checkPermission(java.lang.String name,
java.lang.String action,
java.lang.Object... arg)
name - String The permission nameaction - String The permission actionarg - Object Optional object parameter used to make a permission decision
AuthorizationException - if the user does not have the specified permission
public void checkPermission(java.lang.Object target,
java.lang.String action)
public boolean hasPermission(java.lang.String name,
java.lang.String action,
java.lang.Object... arg)
name - String The permission nameaction - String The permission actionarg - Object Optional object parameter used to make a permission decision
public void filterByPermission(java.util.Collection collection,
java.lang.String action)
public boolean hasPermission(java.lang.Object target,
java.lang.String action)
protected boolean evaluateExpression(java.lang.String expr)
expr - String The expression to evaluate
@Deprecated public java.lang.String getUsername()
Credentials.getUsername()@Deprecated public void setUsername(java.lang.String username)
Credentials.setUsername(String)@Deprecated public java.lang.String getPassword()
Credentials.getPassword()@Deprecated public void setPassword(java.lang.String password)
Credentials.setPassword(String)@Deprecated public boolean isRememberMe()
RememberMe.isEnabled()@Deprecated public void setRememberMe(boolean remember)
RememberMe.setEnabled(boolean)public Credentials getCredentials()
public Expressions.MethodExpression getAuthenticateMethod()
public void setAuthenticateMethod(Expressions.MethodExpression authMethod)
public java.lang.String getJaasConfigName()
public void setJaasConfigName(java.lang.String jaasConfigName)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||