net.cnri.dobj
Class DOServerConnection

java.lang.Object
  extended by net.cnri.dobj.DOConnection
      extended by net.cnri.dobj.DOServerConnection

public class DOServerConnection
extends DOConnection

This class provides the interface for server software to communicate using the DO protocol with a digital object client.


Field Summary
 
Fields inherited from class net.cnri.dobj.DOConnection
CONTROL_CHANNEL_ID, DEBUG, DEBUG_BLOCKING, DEBUG_BUFFERS, DEBUG_BYTES, DEBUG_CONTROL, DEFAULT_DEBUG, DEFAULT_DEBUG_BLOCKING, DEFAULT_DEBUG_BYTES, DEFAULT_DEBUG_CONTROL, DEFAULT_READ_BUFFER_SIZE, DEFAULT_WRITE_BUFFER_SIZE, ERROR_RESPONSE_CODE, MAX_BYTES_IN_BLOCKING_WINDOW, MIN_BYTES_IN_BLOCKING_WINDOW, SUCCESS_RESPONSE_CODE
 
Constructor Summary
DOServerConnection(DOAuthentication authentication, java.net.Socket connection)
           
DOServerConnection(DOAuthentication authentication, java.net.Socket connection, DOConnectionListener listener)
          Construct a server-side connection handler using the given socket.
 
Method Summary
 boolean authenticateClient(java.lang.String clientID)
          This method is called by the digital object server to verify the identity of the client using the public key assigned to the ID of the client..
 boolean authenticateCredential(java.lang.String credentialID)
          Verify that this client has been granted a credential by the identified entity.
 java.lang.Object getConnectionMapping(java.lang.Object mappingKey)
          Returns the object from the connection-level information table that had previously been used as the mappingData parameter for a call to setConnectionMapping with the given mappingKey.
 java.lang.String[] getCredentialIDs()
          Returns a list of unverified IDs that the client claims as credentials.
static javax.net.ssl.SSLServerSocketFactory getSecureServerSocketFactory(PKAuthentication authentication, java.security.PublicKey pubKey)
          This method returns an SSLServerSocketFactory that can be used to create SSLSockets that authenticate their side of the connection using handle public key authentication.
 void setConnectionMapping(java.lang.Object mappingKey, java.lang.Object mappingData)
          Inserts an object into the connection-level information table.
 
Methods inherited from class net.cnri.dobj.DOConnection
close, decodeUTF8, decodeUTF8, encodeUTF8, getAuthID, getProtocolMajorVersion, getProtocolMinorVersion, getResolver, getSocket, isEncrypted, isOpen, resolvePublicKeys, setListener, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DOServerConnection

public DOServerConnection(DOAuthentication authentication,
                          java.net.Socket connection)
                   throws java.lang.Exception
Throws:
java.lang.Exception

DOServerConnection

public DOServerConnection(DOAuthentication authentication,
                          java.net.Socket connection,
                          DOConnectionListener listener)
                   throws java.lang.Exception
Construct a server-side connection handler using the given socket. This also sets the given listeners for the connection before any authentication is done in order to avoid missing any open-channel events.

Throws:
java.lang.Exception
Method Detail

getCredentialIDs

public java.lang.String[] getCredentialIDs()
Returns a list of unverified IDs that the client claims as credentials. Note: These IDs are not yet verified and the caller should call authenticateCredential() with any credential IDs for whom they assign any meaning. Note2: This should only be called after authenticateClient returns.


authenticateCredential

public boolean authenticateCredential(java.lang.String credentialID)
Verify that this client has been granted a credential by the identified entity. The given credentialID is expected to have come from the list returned by getCredentialIDs(). Returns true iff a verified credential from credentialID was granted to this client.


getSecureServerSocketFactory

public static javax.net.ssl.SSLServerSocketFactory getSecureServerSocketFactory(PKAuthentication authentication,
                                                                                java.security.PublicKey pubKey)
                                                                         throws java.lang.Exception
This method returns an SSLServerSocketFactory that can be used to create SSLSockets that authenticate their side of the connection using handle public key authentication.

Throws:
java.lang.Exception

authenticateClient

public boolean authenticateClient(java.lang.String clientID)
                           throws DOException
This method is called by the digital object server to verify the identity of the client using the public key assigned to the ID of the client..

Throws:
DOException

setConnectionMapping

public void setConnectionMapping(java.lang.Object mappingKey,
                                 java.lang.Object mappingData)
Inserts an object into the connection-level information table. This causes subsequent calls to getConnectionMapping() on the same connection (but not necessarily the same operation) with the same key to return the given data value.


getConnectionMapping

public java.lang.Object getConnectionMapping(java.lang.Object mappingKey)
Returns the object from the connection-level information table that had previously been used as the mappingData parameter for a call to setConnectionMapping with the given mappingKey. If no such object had been inserted into the table then this will return null.