Implemented bureau authentication

* Token member for bureaus
* Exception type for failed authentication
* Authenticate function
* Bureau id to credentials
* Fixed bad constructor and toString


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5149 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2008-06-02 04:38:01 +00:00
parent 6c34b9e3ed
commit 69451c5682
5 changed files with 74 additions and 19 deletions
@@ -39,13 +39,10 @@ public class BureauClient extends Client
public function BureauClient (token :String, bureauId :String)
{
super(null);
_bureauId = bureauId;
var creds :BureauCredentials = new BureauCredentials(_bureauId);
creds.sessionToken = token;
_creds = creds;
_ctx = createContext();
_director = createDirector();
}
@@ -38,20 +38,26 @@ public class BureauCredentials extends Credentials
*/
public var sessionToken :String;
/**
* The id of the bureau logging in.
*/
public var bureauId :String;
/**
* Creates new credentials for a specific bureau.
*/
public function BureauCredentials (token :String)
public function BureauCredentials (bureauId :String)
{
super(new Name("@@bureau:" + token + "@@"));
sessionToken = token;
super(new Name("@@bureau:" + bureauId + "@@"));
this.bureauId = bureauId;
}
/** @inheritDoc */
override protected function toStringBuf (buf :StringBuilder) :void
{
super.toStringBuf(buf);
buf.append(" token=").append(sessionToken);
buf.append(" bureauId=").append(bureauId).
append(" token=").append(sessionToken);
}
// from interface Streamable
@@ -59,6 +65,7 @@ public class BureauCredentials extends Credentials
{
super.readObject(ins);
sessionToken = (ins.readField(String) as String);
bureauId = (ins.readField(String) as String);
}
// from interface Streamable
@@ -66,6 +73,7 @@ public class BureauCredentials extends Credentials
{
super.writeObject(out);
out.writeField(sessionToken);
out.writeField(bureauId);
}
}
}