Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 483
نمايش فراداده

AccessControlContextjava.security

Java 1.2

This class encapsulates the state of a call stack. The checkPermission( ) method can make access-control decisions based on the saved state of the call stack. Access-control checks are usually performed by the AccessController.checkPermission( ) method, which checks that the current call stack has the required permissions. Sometimes, however, it is necessary to make access-control decisions based on a previous state of the call stack. Call AccessController.getContext( ) to create an AccessControlContext for a particular call stack. In Java 1.3, this class has constructors that specify a custom context in the form of an array of ProtectionDomain objects and that associate a DomainCombiner object with an existing AccessControlContext. This class is used only by system-level code; typical applications rarely need to use it.

public final class

AccessControlContext { // Public Constructors public

AccessControlContext (ProtectionDomain[ ]

context );

1.3 public

AccessControlContext (AccessControlContext

acc , DomainCombiner

combiner ); // Public Instance Methods public void

checkPermission (Permission

perm ) throws AccessControlException;

1.3 public DomainCombiner

getDomainCombiner ( ); // Public Methods Overriding Object public boolean

equals (Object

obj ); public int

hashCode ( ); }

Passed To

AccessController.doPrivileged( ), javax.security.auth.Subject.{doAsPrivileged( ), getSubject( )}

Returned By

AccessController.getContext( )