[Yanel-commits] rev 55546 -
public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet
michi at wyona.com
michi at wyona.com
Thu Dec 16 23:19:29 CET 2010
Author: michi
Date: 2010-12-16 23:19:28 +0100 (Thu, 16 Dec 2010)
New Revision: 55546
Modified:
public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
Log:
set identity method added
Modified: public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
===================================================================
--- public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java 2010-12-16 15:43:38 UTC (rev 55545)
+++ public/yanel/trunk/src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java 2010-12-16 22:19:28 UTC (rev 55546)
@@ -1631,6 +1631,24 @@
}
/**
+ * Attach the identity to the HTTP session for a specific realm (associated with the given request)
+ * @param session HTTP session of client
+ * @param realm Realm
+ */
+ public static void setIdentity(Identity identity, HttpSession session, Realm realm) throws Exception {
+ if (session != null) {
+ IdentityMap identityMap = (IdentityMap)session.getAttribute(IDENTITY_MAP_KEY);
+ if (identityMap == null) {
+ identityMap = new IdentityMap();
+ session.setAttribute(YanelServlet.IDENTITY_MAP_KEY, identityMap);
+ }
+ identityMap.put(realm.getID(), identity); // INFO: Please note that the constructor Identity(User, String) is resolving group IDs (including parent group IDs) and hence these are "attached" to the session in order to improve performance during authorizatio n checks
+ } else {
+ log.warn("Session is null!");
+ }
+ }
+
+ /**
* Get the identity from the given request/session (for a specific realm) or via the 'Authorization' HTTP header in the case of BASIC or DIGEST
* @param request Client/Servlet request
* @param realm Realm
More information about the Yanel-commits
mailing list