From 713e76373be65e89af59cd4907856a0fe1950cdb Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 2 Mar 2005 03:08:23 +0000 Subject: [PATCH] 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 --- src/java/com/threerings/presents/net/AuthResponse.java | 9 ++++++++- .../com/threerings/presents/server/ClientManager.java | 2 +- .../com/threerings/presents/server/PresentsClient.java | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/presents/net/AuthResponse.java b/src/java/com/threerings/presents/net/AuthResponse.java index 0a7250a08..46d0a29da 100644 --- a/src/java/com/threerings/presents/net/AuthResponse.java +++ b/src/java/com/threerings/presents/net/AuthResponse.java @@ -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 Authenticator 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. */ diff --git a/src/java/com/threerings/presents/server/ClientManager.java b/src/java/com/threerings/presents/server/ClientManager.java index 16bed512f..ba0f08b66 100644 --- a/src/java/com/threerings/presents/server/ClientManager.java +++ b/src/java/com/threerings/presents/server/ClientManager.java @@ -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); diff --git a/src/java/com/threerings/presents/server/PresentsClient.java b/src/java/com/threerings/presents/server/PresentsClient.java index 6057d3a39..30e4066d2 100644 --- a/src/java/com/threerings/presents/server/PresentsClient.java +++ b/src/java/com/threerings/presents/server/PresentsClient.java @@ -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;