Moved some of the standard work done by Authenticators into the base class.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4291 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-07-25 19:02:48 +00:00
parent 878129f75d
commit 426edf6ad7
4 changed files with 153 additions and 51 deletions
@@ -21,25 +21,34 @@
package com.threerings.presents.server;
import com.threerings.presents.Log;
import com.samskivert.io.PersistenceException;
import com.samskivert.util.Invoker;
import com.threerings.presents.net.AuthResponse;
import com.threerings.presents.net.AuthResponseData;
import com.threerings.presents.server.net.AuthingConnection;
import static com.threerings.presents.Log.log;
/**
* A simple authenticator implementation that simply accepts all
* authentication requests.
*/
public class DummyAuthenticator extends Authenticator
{
/**
* Accept all authentication requests.
*/
public void authenticateConnection (AuthingConnection conn)
@Override
protected Invoker getInvoker ()
{
Log.info("Accepting request: " + conn.getAuthRequest());
AuthResponseData rdata = new AuthResponseData();
rdata.code = AuthResponseData.SUCCESS;
connectionWasAuthenticated(conn, new AuthResponse(rdata));
return null; // not needed
}
// from abstract Authenticator
protected void processAuthentication (
AuthingConnection conn, AuthResponse rsp)
throws PersistenceException
{
log.info("Accepting request: " + conn.getAuthRequest());
rsp.getData().code = AuthResponseData.SUCCESS;
}
}