[Lada-commits] [PATCH 08 of 15] Add authentication info to http request

Wald Commits scm-commit at wald.intevation.org
Mon Mar 23 18:00:00 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1427129328 -3600
# Node ID fb1f7418e1fcce9d408ad378b3ad0c3602eaa991
# Parent  f36a415c7052edc903f39087c7103695bc3ac36e
Add authentication info to http request.

diff -r f36a415c7052 -r fb1f7418e1fc src/main/java/de/intevation/lada/util/auth/OpenIDFilter.java
--- a/src/main/java/de/intevation/lada/util/auth/OpenIDFilter.java	Mon Mar 23 17:46:00 2015 +0100
+++ b/src/main/java/de/intevation/lada/util/auth/OpenIDFilter.java	Mon Mar 23 17:48:48 2015 +0100
@@ -169,7 +169,6 @@
     private boolean checkOpenIDHeader(ServletRequest req) {
 
         HttpServletRequest hReq = (HttpServletRequest) req;
-
         /* Debug code to dump headers
         Enumeration<String> headerNames = hReq.getHeaderNames();
         while (headerNames.hasMoreElements()) {
@@ -224,7 +223,7 @@
 
         AuthSuccess authSuccess =
                         (AuthSuccess) verification.getAuthResponse();
-        String rolesValue;
+        String rolesValue = "";
         if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
             FetchResponse fetchResp = null;
             try {
@@ -235,14 +234,15 @@
                         e.getMessage());
                 return false;
             }
-            String roles = fetchResp.getAttributeValue("attr1");
-            logger.debug("Roles are: " + roles);
+            rolesValue = fetchResp.getAttributeValue("attr1");
         } else {
             logger.debug("No such extension.");
         }
 
-        logger.debug("Verified user: " + verified);
-
+        String[] identifier = verified.getIdentifier().split("/");
+        String userName = identifier[identifier.length -1];
+        hReq.setAttribute("lada.user.roles", rolesValue);
+        hReq.setAttribute("lada.user.name", userName);
         return true;
     }
 


More information about the Lada-commits mailing list