/** * Builds the wrapper, wrapping incoming request and information take from cache entry * * @param request Original request coming to authentication framework * @param cacheEntry Cache entry from the cache, which is added from calling servlets * @return */ public static HttpServletRequest getCommonAuthReqWithParams( HttpServletRequest request, AuthenticationRequestCacheEntry cacheEntry) { // add this functionality as a constructor Map<String, String[]> modifiableParameters = new TreeMap<String, String[]>(); if (cacheEntry != null) { AuthenticationRequest authenticationRequest = cacheEntry.getAuthenticationRequest(); if (!authenticationRequest.getRequestQueryParams().isEmpty()) { modifiableParameters.putAll(authenticationRequest.getRequestQueryParams()); } // Adding field variables to wrapper if (authenticationRequest.getType() != null) { modifiableParameters.put( FrameworkConstants.RequestParams.TYPE, new String[] {authenticationRequest.getType()}); } if (authenticationRequest.getCommonAuthCallerPath() != null) { modifiableParameters.put( FrameworkConstants.RequestParams.CALLER_PATH, new String[] {authenticationRequest.getCommonAuthCallerPath()}); } if (authenticationRequest.getRelyingParty() != null) { modifiableParameters.put( FrameworkConstants.RequestParams.ISSUER, new String[] {authenticationRequest.getRelyingParty()}); } if (authenticationRequest.getTenantDomain() != null) { modifiableParameters.put( FrameworkConstants.RequestParams.TENANT_DOMAIN, new String[] {authenticationRequest.getTenantDomain()}); } modifiableParameters.put( FrameworkConstants.RequestParams.FORCE_AUTHENTICATE, new String[] {String.valueOf(authenticationRequest.getForceAuth())}); modifiableParameters.put( FrameworkConstants.RequestParams.PASSIVE_AUTHENTICATION, new String[] {String.valueOf(authenticationRequest.getPassiveAuth())}); if (log.isDebugEnabled()) { StringBuilder queryStringBuilder = new StringBuilder(""); for (Map.Entry<String, String[]> entry : modifiableParameters.entrySet()) { StringBuilder paramValueBuilder = new StringBuilder(""); String[] paramValueArr = entry.getValue(); if (paramValueArr != null) { for (String paramValue : paramValueArr) { paramValueBuilder.append("{").append(paramValue).append("}"); } } queryStringBuilder .append("\n") .append(entry.getKey() + "=" + paramValueBuilder.toString()); } log.debug("\nInbound Request parameters: " + queryStringBuilder.toString()); } return new AuthenticationFrameworkWrapper( request, modifiableParameters, authenticationRequest.getRequestHeaders()); } return request; }