All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ninja.rmi.NinjaSecureRemoteObject

java.lang.Object
   |
   +----ninja.rmi.NinjaRemoteObject
           |
           +----ninja.rmi.NinjaSecureRemoteObject

public class NinjaSecureRemoteObject
extends NinjaRemoteObject
NinjaSecureRemoteObject is the subclass of NinjaRemoteOperator used for constructing objects that can be remotely accessed by a secure NinjaRMI connection (e.g. COMMTYPE_AUTH_ENCRYPT_RELIABLE). By subclassing NinjaSecureRemoteObject, this automatically creates an object for secure remote access. It will not be exported until the goSecure() method is called.

Example code:

 public class TheServiceImpl extends NinjaSecureRemoteObject
 implements TheService {
   public TheServiceImpl() throws RemoteException {
     super(null); // Don't use the defaults
     DSAKeyReader rdr = new DSAKeyReader(new File("/home/daw/.servicekey.priv"));
     goSecure(rdr.getAuthenticator());
   }
   public void invocation() throws RemoteException {
     NinjaCert clientCert = getClientCertificate();
     System.out.println("Called by " + clientCert.uniqid);
   }
 }
 

See the tutorial on the Ninja private web pages for more information.

See Also:
NinjaRemoteObject, html

Constructor Index

 o NinjaSecureRemoteObject()
The constructor for a NinjaSecureRemoteObject, when called with no arguments, exports the object for remote access using the default settings.
 o NinjaSecureRemoteObject(NinjaExportData)
When a NinjaExportData is passed into the NinjaSecureRemoteObject constructor, the behavior of the remote object can be modified (for example, the server's Authenticator can be specified).

Method Index

 o exportObject(NinjaExportData)
exportObject exports the NinjaSecureRemoteObject for remote access.
 o getClientCertificate()
A helper function to get the certificate for the client who is currently connected to this instance of the exported object.
 o getStub()
 o goSecure(Authenticator)
Allows you to set a server Authenticator.
 o goSecure(Authenticator, CertPredicate)
Allows you to set a server Authenticator and certificate predicate.
 o unexportObject()
Calling 'unexportObject' on a NinjaSecureRemoteObject will cause the object to be unexported for future incoming calls.

Constructors

 o NinjaSecureRemoteObject
 protected NinjaSecureRemoteObject() throws RemoteException
The constructor for a NinjaSecureRemoteObject, when called with no arguments, exports the object for remote access using the default settings.

 o NinjaSecureRemoteObject
 protected NinjaSecureRemoteObject(NinjaExportData exportData) throws RemoteException
When a NinjaExportData is passed into the NinjaSecureRemoteObject constructor, the behavior of the remote object can be modified (for example, the server's Authenticator can be specified). If null is passed in, then the NinjaSecureRemoteObject will not be exported; the user must call exportObject() directly.

See Also:
NinjaExportData

Methods

 o goSecure
 protected void goSecure(Authenticator auth,
                         CertPredicate pred) throws RemoteException
Allows you to set a server Authenticator and certificate predicate. You should call super(null) first, then goSecure.

See Also:
CertPredicate
 o goSecure
 protected void goSecure(Authenticator auth) throws RemoteException
Allows you to set a server Authenticator. You should call super(null) first, then goSecure.

This uses a default certificate predicate, which accepts any certificate with a valid signature, or the null certificate. WARNING: this is not a secure way to authenticate the client! If you want to authenticate the client, you should either specify a CertPredicate using the other form of goSecure, or else you must take care to check the certificate (to make sure it is signed by Ian, etc) in every method you export. See Ian or Dave if you have any questions.

See Also:
CertPredicate
 o getClientCertificate
 protected NinjaCert getClientCertificate() throws ServerNotActiveException, RemoteException
A helper function to get the certificate for the client who is currently connected to this instance of the exported object. Just calls AuthRel_ServerThread.getClientCertificate() under the covers.

See Also:
AuthRel_ServerThread
 o exportObject
 public void exportObject(NinjaExportData exportData) throws RemoteException
exportObject exports the NinjaSecureRemoteObject for remote access. Only call this function if you call the NinjaSecureRemoteObject constructor with an argument of null. The intent here is that the user can construct a NinjaExportData structure before calling exportObject - because superclass constructors must be the first thing called in a constructor.

Parameters:
exportData - The NinjaExportData structure specifying how the object should be exported.
Overrides:
exportObject in class NinjaRemoteObject
 o unexportObject
 public void unexportObject() throws RemoteException
Calling 'unexportObject' on a NinjaSecureRemoteObject will cause the object to be unexported for future incoming calls. Currently, any calls in progress (i.e., any existing client sockets connecting to the remote object) are not destroyed; only future calls are made impossible.

Overrides:
unexportObject in class NinjaRemoteObject
 o getStub
 protected NinjaRemoteStub getStub()
Overrides:
getStub in class NinjaRemoteObject

All Packages  Class Hierarchy  This Package  Previous  Next  Index