Pass the authdata returned by the Authenticator into the ClientResolver.
This is actually kind of sketchy, because the resolver can't depend on it because there are methods to resolve a client object without having an authenticated connection. For now, I'll leave this in. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4350 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -225,7 +225,7 @@ public class ClientManager
|
|||||||
*/
|
*/
|
||||||
public void applyToClient (Name username, ClientOp clop)
|
public void applyToClient (Name username, ClientOp clop)
|
||||||
{
|
{
|
||||||
resolveClientObject(username, new ClientOpResolver(clop));
|
resolveClientObject(username, null, new ClientOpResolver(clop));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -238,7 +238,7 @@ public class ClientManager
|
|||||||
* when the caller is finished with the client object.
|
* when the caller is finished with the client object.
|
||||||
*/
|
*/
|
||||||
public synchronized void resolveClientObject (
|
public synchronized void resolveClientObject (
|
||||||
Name username, final ClientResolutionListener listener)
|
Name username, Object authdata, final ClientResolutionListener listener)
|
||||||
{
|
{
|
||||||
// look to see if the client object is already resolved
|
// look to see if the client object is already resolved
|
||||||
ClientObject clobj = _objmap.get(username);
|
ClientObject clobj = _objmap.get(username);
|
||||||
@@ -260,7 +260,7 @@ public class ClientManager
|
|||||||
// create a client resolver instance which will create our
|
// create a client resolver instance which will create our
|
||||||
// client object, populate it and notify the listeners
|
// client object, populate it and notify the listeners
|
||||||
clr = _factory.createClientResolver(username);
|
clr = _factory.createClientResolver(username);
|
||||||
clr.init(username);
|
clr.init(username, authdata);
|
||||||
clr.addResolutionListener(this);
|
clr.addResolutionListener(this);
|
||||||
clr.addResolutionListener(listener);
|
clr.addResolutionListener(listener);
|
||||||
_penders.put(username, clr);
|
_penders.put(username, clr);
|
||||||
|
|||||||
@@ -44,10 +44,13 @@ public class ClientResolver extends Invoker.Unit
|
|||||||
* Initiailizes this instance.
|
* Initiailizes this instance.
|
||||||
*
|
*
|
||||||
* @param username the username of the user to be resolved.
|
* @param username the username of the user to be resolved.
|
||||||
|
* @param authdata an object optionally placed into the
|
||||||
|
* AuthResponse.authdata field by the Authenticator.
|
||||||
*/
|
*/
|
||||||
public void init (Name username)
|
public void init (Name username, Object authdata)
|
||||||
{
|
{
|
||||||
_username = username;
|
_username = username;
|
||||||
|
_authdata = authdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -181,6 +184,10 @@ public class ClientResolver extends Invoker.Unit
|
|||||||
/** The name of the user whose client object is being resolved. */
|
/** The name of the user whose client object is being resolved. */
|
||||||
protected Name _username;
|
protected Name _username;
|
||||||
|
|
||||||
|
/** An object placed into AuthResponse.authdata by the Authenticator,
|
||||||
|
* or null. */
|
||||||
|
protected Object _authdata;
|
||||||
|
|
||||||
/** The entities to notify of success or failure. */
|
/** The entities to notify of success or failure. */
|
||||||
protected ArrayList<ClientResolutionListener> _listeners =
|
protected ArrayList<ClientResolutionListener> _listeners =
|
||||||
new ArrayList<ClientResolutionListener>();
|
new ArrayList<ClientResolutionListener>();
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ public class PresentsClient
|
|||||||
};
|
};
|
||||||
|
|
||||||
// resolve the new client object
|
// resolve the new client object
|
||||||
_cmgr.resolveClientObject(username, clr);
|
_cmgr.resolveClientObject(username, _authdata, clr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -312,7 +312,7 @@ public class PresentsClient
|
|||||||
assignStartingUsername();
|
assignStartingUsername();
|
||||||
|
|
||||||
// resolve our client object before we get fully underway
|
// resolve our client object before we get fully underway
|
||||||
cmgr.resolveClientObject(_username, this);
|
cmgr.resolveClientObject(_username, authdata, this);
|
||||||
|
|
||||||
// make a note of our session start time
|
// make a note of our session start time
|
||||||
_sessionStamp = System.currentTimeMillis();
|
_sessionStamp = System.currentTimeMillis();
|
||||||
|
|||||||
Reference in New Issue
Block a user