Implemented bureau login tokens

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5191 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Jamie Doornbos
2008-06-23 18:46:13 +00:00
parent 8d192dcf70
commit 9e06f34557
@@ -201,7 +201,7 @@ public class BureauRegistry
bureau = new Bureau(); bureau = new Bureau();
bureau.bureauId = agent.bureauId; bureau.bureauId = agent.bureauId;
bureau.token = generateToken(); bureau.token = generateToken(bureau.bureauId);
// schedule the bureau to be kicked off // schedule the bureau to be kicked off
bureau.builder = new ProcessBuilder( bureau.builder = new ProcessBuilder(
@@ -467,10 +467,11 @@ public class BureauRegistry
* Create a hard-to-guess token that the bureau can use to authenticate itself when it tries * Create a hard-to-guess token that the bureau can use to authenticate itself when it tries
* to log in. * to log in.
*/ */
protected String generateToken () protected String generateToken (String bureauId)
{ {
// TODO: implement String tokenSource = bureauId + "@" +
return "hard-to-guess-token"; System.currentTimeMillis() + "r" + Math.random();
return StringUtil.md5hex(tokenSource);
} }
/** /**