com.threerings.presents.server
Class ServiceAuthenticator<T extends ServiceCreds>

java.lang.Object
  extended by com.threerings.presents.server.Authenticator
      extended by com.threerings.presents.server.ChainedAuthenticator
          extended by com.threerings.presents.server.ServiceAuthenticator<T>

public abstract class ServiceAuthenticator<T extends ServiceCreds>
extends ChainedAuthenticator

Works in conjunction with ServiceCreds to handle the authentication of service clients (bureaus, peers, etc.).


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.presents.server.Authenticator
Authenticator.AuthException
 
Field Summary
protected  Constructor<? extends Name> _authNamer
           
protected  Class<T> _credsClass
           
 
Constructor Summary
ServiceAuthenticator(Class<T> credsClass, Class<? extends Name> authNameClass)
          Creates an authenticator that will handle requests using the supplied credentials class and which will create instances of the supplied auth name class to identify those clients.
 
Method Summary
protected abstract  boolean areValid(T creds)
          Returns true if the creds in question are valid.
protected  void processAuthentication(AuthingConnection conn, AuthResponse rsp)
          Process the authentication for the specified connection.
 boolean shouldHandleConnection(AuthingConnection conn)
          Derived classes should implement this method and return true if the supplied connection is one that they should authenticate.
 
Methods inherited from class com.threerings.presents.server.Authenticator
authenticateConnection, createResponseData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_credsClass

protected Class<T extends ServiceCreds> _credsClass

_authNamer

protected Constructor<? extends Name> _authNamer
Constructor Detail

ServiceAuthenticator

public ServiceAuthenticator(Class<T> credsClass,
                            Class<? extends Name> authNameClass)
Creates an authenticator that will handle requests using the supplied credentials class and which will create instances of the supplied auth name class to identify those clients. Note that the auth name class must have a public constructor that takes a single string.

Method Detail

shouldHandleConnection

public boolean shouldHandleConnection(AuthingConnection conn)
Description copied from class: ChainedAuthenticator
Derived classes should implement this method and return true if the supplied connection is one that they should authenticate.

Specified by:
shouldHandleConnection in class ChainedAuthenticator

processAuthentication

protected void processAuthentication(AuthingConnection conn,
                                     AuthResponse rsp)
                              throws Exception
Description copied from class: Authenticator
Process the authentication for the specified connection. The method may return after it has stuffed a valid response code in rsp.getData().code.

Specified by:
processAuthentication in class Authenticator
Parameters:
conn - The client connection.
rsp - The response to the client, which will already contain an AuthResponseData created by Authenticator.createResponseData().
Throws:
Exception

areValid

protected abstract boolean areValid(T creds)
Returns true if the creds in question are valid.