GuardedObject


GuardedObject java.security

Java 1.2 serializable

This class uses a Guard object to guard against unauthorized access to an arbitrary encapsulated object. Create a GuardedObject by specifying an object and a Guard for it. The getObject( ) method calls the checkGuard( ) method of the Guard to determine whether access to the object should be allowed. If access is allowed, getObject( ) returns the encapsulated object. Otherwise, it throws a java.lang.SecurityException .

The Guard object used by a GuardedObject is often a Permission . In this case, access to the guarded object is granted only if the calling code is granted the specified permission by the current security policy.

Figure 14-11. java.security.GuardedObject

 public class  GuardedObject  implements Serializable {  // Public Constructors  public  GuardedObject  (Object  object  , Guard  guard  );  // Public Instance Methods  public Object  getObject  ( ) throws SecurityException;   } 



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