Allow the authenticator to slip some authentication data down the line to

the PresentsClient which can then use it to fill in things like access
control information for the user. We could use this to replace the
UserStash mechanism we use on Yohoho, but that works so I doubt I'll do
that. However, this is needed to do things the more elegant way on future
projects, like Game Gardens.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3374 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-03-02 03:08:23 +00:00
parent 40eb978a96
commit 713e76373b
3 changed files with 12 additions and 3 deletions
@@ -1,5 +1,5 @@
//
// $Id: AuthResponse.java,v 1.15 2004/08/27 02:20:21 mdb Exp $
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -30,6 +30,13 @@ package com.threerings.presents.net;
*/
public class AuthResponse extends DownstreamMessage
{
/** Auxilliary authentication data to be communicated to the {@link
* PresentsClient} once a session is started. This is a means by which
* the <code>Authenticator</code> can pass information loaded from,
* say, an authentication database into the runtime system to be used,
* for example for permissions. */
public transient Object authdata;
/**
* Zero argument constructor used when unserializing an instance.
*/
@@ -297,7 +297,7 @@ public class ClientManager
try {
// create a client and start up its session
client = (PresentsClient)_clientClass.newInstance();
client.startSession(this, creds, conn);
client.startSession(this, creds, conn, rsp.authdata);
// map their client instance
_usermap.put(username, client);
@@ -276,10 +276,11 @@ public class PresentsClient
* connection instance and client object and begins a client session.
*/
protected void startSession (
ClientManager cmgr, Credentials creds, Connection conn)
ClientManager cmgr, Credentials creds, Connection conn, Object authdata)
{
_cmgr = cmgr;
_creds = creds;
_authdata = authdata;
setConnection(conn);
// obtain our starting username
@@ -907,6 +908,7 @@ public class PresentsClient
protected ClientManager _cmgr;
protected Credentials _creds;
protected Object _authdata;
protected Name _username;
protected Connection _conn;
protected ClientObject _clobj;