net.jini.security.proxytrust
Class ProxyTrustVerifier
java.lang.Object
net.jini.security.proxytrust.ProxyTrustVerifier
- All Implemented Interfaces:
- TrustVerifier
- public class ProxyTrustVerifier
- extends Object
- implements TrustVerifier
Trust verifier for service proxies that use dynamically downloaded code.
This class is intended to be specified in a resource to configure the
operation of Security.verifyObjectTrust.
- Since:
- 2.0
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ProxyTrustVerifier
public ProxyTrustVerifier()
- Creates an instance.
isTrustedObject
public boolean isTrustedObject(Object obj,
TrustVerifier.Context ctx)
throws RemoteException
- Returns
true if the specified object is known to be
trusted to correctly implement its contract; returns false
otherwise.
This method returns false if the caller context collection
of the specified trust verifier context does not contain a
MethodConstraints instance with non-empty constraints for the
ProxyTrust.getProxyVerifier
method, or if a TrustVerifier cannot be obtained from the
specified object using the steps described below. Otherwise a
TrustVerifier is obtained, its
isTrustedObject method is called
with the same arguments passed to this method, and the result of that
call is returned by this method.
A verifier is obtained from a candidate object as follows. The
candidate object's class must have a non-static member
method with signature:
ProxyTrustIterator getProxyTrustIterator();
or the candidate object must be an instance of a dynamically generated
Proxy class and the contained invocation handler's class must
have such a member method. If neither condition holds, no verifier is
obtained from the candidate object. Otherwise, the
getProxyTrustIterator method is called (on the candidate
object or its invocation handler). For each object produced by the
next method of the returned iterator,
the following checks are made, until either a verifier is obtained or
the iteration terminates.
- If object is a
ProxyTrust instance, and it is a
RemoteMethodControl instance, it is verified for trust by
calling the specified context's
isTrustedObject
method with the ProxyTrust instance. If it is not a
RemoteMethodControl instance or if
isTrustedObject returns false, iteration
continues. If isTrustedObject returns true,
then the ProxyTrust instance's
getProxyVerifier method is called,
using as the client constraints for the remote call the first
MethodConstraints instance obtained from the caller
context collection (of the specified trust verifier context) that has
non-empty constraints for that getProxyVerifier method.
The verifier returned by that remote call is the verifier for the
candidate object. If the call to isTrustedObject or
getProxyVerifier throws a RemoteException,
that exception is passed to the setException method of the iterator, and the iteration continues.
- If the object is not a
ProxyTrust instance, it is
in turn considered a new candidate object, and if a verifier can be
obtained for it (recursively using the same steps as for the original
candidate object), that verifier is the verifier for the original
candidate object. If a verifier cannot be obtained for it, the
iteration continues.
If no verifier can be obtained, but one or more of the intermediate
operations throws a RemoteException, the last such
RemoteException is thrown by this method (rather than
this method returning false). If any intermediate
operation throws a SecurityException exception, that
exception is immediately thrown to the caller.
- Specified by:
isTrustedObject in interface TrustVerifier
- Parameters:
obj - the object in which to verify trustctx - the trust verifier context, to aid in verification of
the specified object and its components
- Returns:
true if the specified object is known to be
trusted to correctly implement its contract; false
otherwise
- Throws:
NullPointerException - if any argument is null
SecurityException - if a security exception occurs
RemoteException - if a communication-related exception occurs
Copyright © 2004 Sun Microsystems, Inc. All rights reserved