cometd - Storing User Credientials in the Bayeux Server -
i'd store clients username , sessionid when client subscribes particular channel. when override canhandshake() can user credentials using following:
username = (string) authentication.get("username"); sessionid = (string) authentication.get("sessionid"); just wondering how can store these credentials , later retrieve them? i've had @ authentication documentation here , mentions linking authentication data session. bayeux server side session??
thanks
the "linking" can done in several ways.
you can link information in external map via:
@override public boolean canhandshake(bayeuxserver server, serversession session, servermessage message) { ... map<string, object> authentication = ...; map.put((string)authentication.get("username"), session); ... } where map can java.util.concurrenthashmap<string, serversession> field in security policy itself, or in object such user service.
for simpler use cases, username can linked directly session in way:
session.setattribute("username", authentication.get("username")); or can use both techniques.
this updated link authentication how-to, , can find latest comprehensive cometd documentation @ http://docs.cometd.org.
Comments
Post a Comment