net.sf.jguard.core.authorization.policy
Class AccessControlContextUtils

java.lang.Object
  extended by net.sf.jguard.core.authorization.policy.AccessControlContextUtils

public class AccessControlContextUtils
extends java.lang.Object

utility class for authorization work related to AccessControlContext and ProtectionDomain.

Author:
Charles Gay, Vincent Beretti
See Also:
AccessControlContext, ProtectionDomain

Constructor Summary
AccessControlContextUtils()
           
 
Method Summary
static java.security.AccessControlContext getAccessControlContext(java.util.Collection principals)
          return the convenient AccessControlContext containing the collection of Principal but no permissions and a fake [@link CodeSource}.
static java.security.AccessControlContext getRestrictedAccessControlContext(java.security.Principal principal)
          return the convenient AccessControlContext corresponding to the principal.
static java.security.AccessControlContext getStackSubjectAccessControlContext(javax.security.auth.Subject subject)
          build an AccessControlContext with one ProtectionDomain with principals from provided subject, and a null CodeSource and Classloader.
static java.security.AccessControlContext getSubjectOnlyAccessControlContext(javax.security.auth.Subject subject)
          gets an AccessControlContext containing a single ProtectionDomain with an null CodeSource, an empty array of Certificates, the current Thread ClassLoader, and the subject principals.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccessControlContextUtils

public AccessControlContextUtils()
Method Detail

getRestrictedAccessControlContext

public static java.security.AccessControlContext getRestrictedAccessControlContext(java.security.Principal principal)
return the convenient AccessControlContext corresponding to the principal. the returned AccessControlContext is bound to a RestrictDomainCombiner.

Parameters:
principal - RolePrincipal used to restrict execution code rights
Returns:
object embedding used to restrict permissions

getSubjectOnlyAccessControlContext

public static java.security.AccessControlContext getSubjectOnlyAccessControlContext(javax.security.auth.Subject subject)
gets an AccessControlContext containing a single ProtectionDomain with an null CodeSource, an empty array of Certificates, the current Thread ClassLoader, and the subject principals.

Parameters:
subject -
Returns:
the generated AccessControlContext

getStackSubjectAccessControlContext

public static java.security.AccessControlContext getStackSubjectAccessControlContext(javax.security.auth.Subject subject)
build an AccessControlContext with one ProtectionDomain with principals from provided subject, and a null CodeSource and Classloader.

Parameters:
subject -
Returns:

getAccessControlContext

public static java.security.AccessControlContext getAccessControlContext(java.util.Collection principals)
return the convenient AccessControlContext containing the collection of Principal but no permissions and a fake [@link CodeSource}. the current Policy will further bound permissions to these principals.

Parameters:
principals - RolePrincipal used to restrict execution code rights
Returns:
object used to restrict permissions


Copyright © 2004-2009. All Rights Reserved.