Use AuthException.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5833 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -24,9 +24,7 @@ package com.threerings.presents.server;
|
|||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.util.MessageBundle;
|
import com.threerings.util.MessageBundle;
|
||||||
|
|
||||||
import com.threerings.presents.net.AuthResponse;
|
import com.threerings.presents.net.AuthResponse;
|
||||||
@@ -87,10 +85,10 @@ public class Rejector extends PresentsServer
|
|||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected void processAuthentication (AuthingConnection conn, AuthResponse rsp)
|
protected void processAuthentication (AuthingConnection conn, AuthResponse rsp)
|
||||||
throws PersistenceException
|
throws Exception
|
||||||
{
|
{
|
||||||
log.info("Rejecting request: " + conn.getAuthRequest());
|
log.info("Rejecting request: " + conn.getAuthRequest());
|
||||||
rsp.getData().code = _errmsg;
|
throw new AuthException(_errmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ package com.threerings.presents.server;
|
|||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
import com.samskivert.io.PersistenceException;
|
|
||||||
|
|
||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
import com.threerings.presents.data.AuthCodes;
|
import com.threerings.presents.data.AuthCodes;
|
||||||
@@ -64,13 +62,12 @@ public abstract class ServiceAuthenticator<T extends ServiceCreds> extends Chain
|
|||||||
|
|
||||||
@Override // from abstract Authenticator
|
@Override // from abstract Authenticator
|
||||||
protected void processAuthentication (AuthingConnection conn, AuthResponse rsp)
|
protected void processAuthentication (AuthingConnection conn, AuthResponse rsp)
|
||||||
throws PersistenceException
|
throws Exception
|
||||||
{
|
{
|
||||||
T creds = _credsClass.cast(conn.getAuthRequest().getCredentials());
|
T creds = _credsClass.cast(conn.getAuthRequest().getCredentials());
|
||||||
if (!areValid(creds)) {
|
if (!areValid(creds)) {
|
||||||
log.warning("Received invalid service auth request?", "creds", creds);
|
log.warning("Received invalid service auth request?", "creds", creds);
|
||||||
rsp.getData().code = AuthCodes.SERVER_ERROR;
|
throw new AuthException(AuthCodes.SERVER_ERROR);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -78,7 +75,7 @@ public abstract class ServiceAuthenticator<T extends ServiceCreds> extends Chain
|
|||||||
rsp.getData().code = AuthResponseData.SUCCESS;
|
rsp.getData().code = AuthResponseData.SUCCESS;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warning("Failed to construct auth name", "namer", _authNamer, e);
|
log.warning("Failed to construct auth name", "namer", _authNamer, e);
|
||||||
rsp.getData().code = AuthCodes.SERVER_ERROR;
|
throw new AuthException(AuthCodes.SERVER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user