站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss Seam 1.1.1 API 英文版文档

SeamSecurityManager (JBoss Seam API Documentation) - JBoss Seam 1.1.1 API 英文版文档


org.jboss.seam.security
Class SeamSecurityManager

java.lang.Object
  extended by org.jboss.seam.security.SeamSecurityManager

@Startup(depends="org.jboss.seam.security.securityConfiguration")
@Scope(value=APPLICATION)
@Name(value="org.jboss.seam.securityManager")
@Install(value=false,
         precedence=0)
@Intercept(value=NEVER)
public class SeamSecurityManager
extends Object

Holds configuration settings and provides functionality for the security API

Author:
Shane Bryzak

Constructor Summary
SeamSecurityManager()
           
 
Method Summary
 CallbackHandler createCallbackHandler(String username, String password)
          Creates a callback handler that can handle a standard username/password callback, using the specified username and password parameters.
 LoginContext createLoginContext()
          Creates a LoginContext without a callback handler
 LoginContext createLoginContext(String policyName)
          Creates a LoginContext using a configuration specified by name.
 LoginContext createLoginContext(String policyName, CallbackHandler cbHandler)
          A factory method for creating a LoginContext instance.
 boolean evaluateExpression(String expr)
          Evaluates the specified security expression, which must return a boolean value.
static boolean hasPermission(String name, String action, Object... args)
          Performs a permission check for the specified name and action
static boolean hasRole(String name)
          Checks if the authenticated Identity is a member of the specified role.
 void initSecurityManager()
          Initialise the security manager
static SeamSecurityManager instance()
          Returns the application-scoped instance of the security manager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeamSecurityManager

public SeamSecurityManager()
Method Detail

initSecurityManager

@Create
public void initSecurityManager()
                         throws Exception
Initialise the security manager

Throws:
Exception

instance

public static SeamSecurityManager instance()
Returns the application-scoped instance of the security manager

Returns:
SeamSecurityManager The application-scoped instance of the SecurityManager

evaluateExpression

public boolean evaluateExpression(String expr)
                           throws AuthorizationException
Evaluates the specified security expression, which must return a boolean value.

Parameters:
expr - String The expression to evaluate
Returns:
boolean The result of the expression evaluation
Throws:
AuthorizationException

hasRole

public static boolean hasRole(String name)
Checks if the authenticated Identity is a member of the specified role.

Parameters:
name - String The name of the role to check
Returns:
boolean True if the user is a member of the specified role

hasPermission

public static boolean hasPermission(String name,
                                    String action,
                                    Object... args)
Performs a permission check for the specified name and action

Parameters:
name - String The permission name
action - String The permission action
args - Object[] Optional number of objects used to make a permission decision
Returns:
boolean True if the user has the specified permission

createLoginContext

public LoginContext createLoginContext()
                                throws LoginException
Creates a LoginContext without a callback handler

Throws:
LoginException

createLoginContext

public LoginContext createLoginContext(String policyName)
                                throws LoginException
Creates a LoginContext using a configuration specified by name.

Parameters:
policyName - The name of the security configuration policy to use
Throws:
LoginException

createLoginContext

public LoginContext createLoginContext(String policyName,
                                       CallbackHandler cbHandler)
                                throws LoginException
A factory method for creating a LoginContext instance. Users must use this method instead of creating their own LoginContext as this factory method creates a LoginContext with a custom configuration and overridden login() method.

Parameters:
cbHandler - The callback handler provided to the LoginContext
Throws:
LoginException

createCallbackHandler

public CallbackHandler createCallbackHandler(String username,
                                             String password)
Creates a callback handler that can handle a standard username/password callback, using the specified username and password parameters.

Parameters:
username - The username to provide for a NameCallback
password - The password to provide for a PasswordCallback