Mercurial > lada > lada-server
changeset 579:fb1f7418e1fc
Add authentication info to http request.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 23 Mar 2015 17:48:48 +0100 |
parents | f36a415c7052 |
children | b2db32812260 |
files | src/main/java/de/intevation/lada/util/auth/OpenIDFilter.java |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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; }