fixed prompt filter map mismatch (I hate type erasure)

pull/544/merge
Justin Richer 2013-12-02 11:55:09 -05:00
parent ce1f3f2f94
commit 4a8d693746
1 changed files with 19 additions and 1 deletions

View File

@ -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<String, String> createRequestMap(Map<String, String[]> parameterMap) {
Map<String, String> requestMap = new HashMap<String, String>();
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;
}
}