From 4a8d693746c3f9c5c404258dd303069d00105d73 Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Mon, 2 Dec 2013 11:55:09 -0500 Subject: [PATCH] fixed prompt filter map mismatch (I hate type erasure) --- .../openid/connect/filter/PromptFilter.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/openid-connect-server/src/main/java/org/mitre/openid/connect/filter/PromptFilter.java b/openid-connect-server/src/main/java/org/mitre/openid/connect/filter/PromptFilter.java index 854f9bc67..401162637 100644 --- a/openid-connect-server/src/main/java/org/mitre/openid/connect/filter/PromptFilter.java +++ b/openid-connect-server/src/main/java/org/mitre/openid/connect/filter/PromptFilter.java @@ -21,6 +21,8 @@ package org.mitre.openid.connect.filter; import java.io.IOException; import java.util.Date; +import java.util.HashMap; +import java.util.Map; import javax.servlet.FilterChain; import javax.servlet.ServletException; @@ -67,7 +69,7 @@ public class PromptFilter extends GenericFilterBean { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; - AuthorizationRequest authRequest = authRequestFactory.createAuthorizationRequest(request.getParameterMap()); + AuthorizationRequest authRequest = authRequestFactory.createAuthorizationRequest(createRequestMap(request.getParameterMap())); if (authRequest.getExtensions().get("prompt") != null) { // we have a "prompt" parameter @@ -143,4 +145,20 @@ public class PromptFilter extends GenericFilterBean { } + /** + * @param parameterMap + * @return + */ + private Map createRequestMap(Map parameterMap) { + Map requestMap = new HashMap(); + for (String key : parameterMap.keySet()) { + String[] val = parameterMap.get(key); + if (val != null && val.length > 0) { + requestMap.put(key, val[0]); // add the first value only (which is what Spring seems to do) + } + } + + return requestMap; + } + }