ProtectionDomain


ProtectionDomain java.security

Java 1.2

This class represents a "protection domain": the set of permissions associated with code based on its source, and optionally , the identities of the users on whose behalf the code is running. Use the getProtectionDomain( ) of a Class object to obtain the ProtectionDomain that the class is part of.

Prior to Java 1.4, a ProtectionDomain simply associates a CodeSource with the PermissionCollection granted to code from that source by a Policy . The set of permissions is static, and the implies( ) method checks to see whether the specified Permission is implied by any of the permissions granted to this ProtectionDomain .

In Java 1.4 and later, a ProtectionDomain can also be created with the four-argument constructor which associates a PermissionCollection with a ClassLoader and an array of Principal objects in addition to a CodeSource . A ProtectionDomain of this sort represents permisssions granted to code loaded from a specified source, through a specified class loader, and running under the auspices of one or more specified principals. When a ProtectionDomain is instantiated with this four-argument constructor, the PermissionCollection is not static, and the implies( ) method calls the implies( ) method of the current Policy object before checking the specified collection of permissions. This allows security policies to be updated (for example to add new permissions for specific users) without having to restart long-running programs such as servers.

 public class  ProtectionDomain  {  // Public Constructors  public  ProtectionDomain  (CodeSource  codesource  ,          PermissionCollection  permissions  );  1.4  public  ProtectionDomain  (CodeSource  codesource  ,          PermissionCollection  permissions  , ClassLoader  classloader  ,  Principal[ ]  principals  );  // Public Instance Methods   1.4  public final ClassLoader  getClassLoader  ( );        public final CodeSource  getCodeSource  ( );        public final PermissionCollection  getPermissions  ( );  1.4  public final Principal[ ]  getPrincipals  ( );        public boolean  implies  (Permission  permission  );  // Public Methods Overriding Object  public String  toString  ( );   } 

Passed To

ClassLoader.defineClass( ) , java.lang.instrument.ClassFileTransformer.transform( ) , AccessControlContext.AccessControlContext( ) , DomainCombiner.combine( ) , java.security.Policy.{getPermissions( ) , implies( )} , javax.security.auth.SubjectDomainCombiner.combine( )

Returned By

Class.getProtectionDomain( ) , DomainCombiner.combine( ) , javax.security.auth.SubjectDomainCombiner.combine( )



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net