/** * Gets the OpenID message as a ParameterList. * * @return ParameterList containing the OpenID message. */ public ParameterList getOpenIDParams() { return new ParameterList(_openidMessage.getParameterMap()); }
/** * Gets the OpenID message as a ParameterList. * @return ParameterList containing the OpenID message. */ public ParameterList getOpenIDParams() { return new ParameterList(_openidMessage.getParameterMap()); }
/** * We sign directly (final 'true') because we don't add extensions * response message can be either a DirectError or an AuthSuccess here. * Note: * The association handle returned in the Response is either the 'public' * created in a previous association, or is a 'private' handle created * specifically for the verification step when in non-association mode * * @param service the service * @param parameters the parameters * @param successFullAuthentication the success full authentication * @param id the id * @param parameterList the parameter list * @return response response */ protected Response buildAuthenticationResponse(final OpenIdService service, final Map<String, String> parameters, final boolean successFullAuthentication, final String id, final ParameterList parameterList) { val response = serverManager.authResponse(parameterList, id, id, successFullAuthentication, true); parameters.putAll(response.getParameterMap()); LOGGER.debug("Parameters passed for the OpenID response are [{}]", parameters.keySet()); return buildRedirect(service, parameters); }
/** * We sign directly (final 'true') because we don't add extensions * response message can be either a DirectError or an AuthSuccess here. * * @param serverManager the server manager * @param ticketId the ticket id * @param service the service * @param parameters the parameters * @param associated the associated * @param successFullAuthentication the success full authentication * @param id the id * @return response response */ protected Response buildAuthenticationResponse(final ServerManager serverManager, final String ticketId, final OpenIdService service, final Map<String, String> parameters, final boolean associated, final boolean successFullAuthentication, final String id) { final Message response = serverManager.authResponse(this.parameterList, id, id, successFullAuthentication, true); parameters.putAll(response.getParameterMap()); if (!associated) { parameters.put(OpenIdProtocolConstants.OPENID_ASSOCHANDLE, ticketId); } return buildRedirect(service, parameters); }
/** * Gets the association response. Determines the mode first. * If mode is set to associate, will set the response. Then * builds the response parameters next and returns. * * @param request the request * @return the association response */ public Map<String, String> getAssociationResponse(final HttpServletRequest request) { final ParameterList parameters = new ParameterList(request.getParameterMap()); final String mode = parameters.hasParameter(OpenIdProtocolConstants.OPENID_MODE) ? parameters.getParameterValue(OpenIdProtocolConstants.OPENID_MODE) : null; Message response = null; if (StringUtils.equals(mode, OpenIdProtocolConstants.ASSOCIATE)) { response = serverManager.associationResponse(parameters); } final Map<String, String> responseParams = new HashMap<>(); if (response != null) { responseParams.putAll(response.getParameterMap()); } return responseParams; }
/** * Gets the association response. Determines the mode first. * If mode is set to associate, will set the response. Then * builds the response parameters next and returns. * * @param request the request * @return the association response */ public Map<String, String> getAssociationResponse(final HttpServletRequest request) { val parameters = new ParameterList(request.getParameterMap()); val mode = parameters.hasParameter(OpenIdProtocolConstants.OPENID_MODE) ? parameters.getParameterValue(OpenIdProtocolConstants.OPENID_MODE) : null; val response = FunctionUtils.doIf(StringUtils.equals(mode, OpenIdProtocolConstants.ASSOCIATE), () -> this.serverManager.associationResponse(parameters), () -> null) .get(); val responseParams = new HashMap<String, String>(); if (response != null) { responseParams.putAll(response.getParameterMap()); } return responseParams; }
/** * Makes a HTTP call to the specified URL with the parameters specified * in the Message. * * @param url URL endpoint for the HTTP call * @param request Message containing the parameters * @param response ParameterList that will hold the parameters received in * the HTTP response * @return the status code of the HTTP call */ private int call(String url, Message request, ParameterList response) throws MessageException { int responseCode = -1; try { if (DEBUG) _log.debug("Performing HTTP POST on " + url); HttpResponse resp = _httpFetcher.post(url, request.getParameterMap()); responseCode = resp.getStatusCode(); String postResponse = resp.getBody(); response.copyOf(ParameterList.createFromKeyValueForm(postResponse)); if (DEBUG) _log.debug("Retrived response:\n" + postResponse); } catch (IOException e) { _log.error("Error talking to " + url + " response code: " + responseCode, e); } return responseCode; }
/** * Makes a HTTP call to the specified URL with the parameters specified * in the Message. * * @param url URL endpoint for the HTTP call * @param request Message containing the parameters * @param response ParameterList that will hold the parameters received in * the HTTP response * @return the status code of the HTTP call */ private int call(String url, Message request, ParameterList response) throws MessageException { int responseCode = -1; try { if (DEBUG) _log.debug("Performing HTTP POST on " + url); HttpResponse resp = _httpFetcher.post(url, request.getParameterMap()); responseCode = resp.getStatusCode(); String postResponse = resp.getBody(); response.copyOf(ParameterList.createFromKeyValueForm(postResponse)); if (DEBUG) _log.debug("Retrived response:\n" + postResponse); } catch (IOException e) { _log.error("Error talking to " + url + " response code: " + responseCode, e); } return responseCode; }
/** * Makes a HTTP call to the specified URL with the parameters specified * in the Message. * * @param url URL endpoint for the HTTP call * @param request Message containing the parameters * @param response ParameterList that will hold the parameters received in * the HTTP response * @return the status code of the HTTP call */ private int call(String url, Message request, ParameterList response) throws MessageException { int responseCode = -1; try { if (DEBUG) _log.debug("Performing HTTP POST on " + url); HttpResponse resp = _httpFetcher.post(url, request.getParameterMap()); responseCode = resp.getStatusCode(); String postResponse = resp.getBody(); response.copyOf(ParameterList.createFromKeyValueForm(postResponse)); if (DEBUG) _log.debug("Retrived response:\n" + postResponse); } catch (IOException e) { _log.error("Error talking to " + url + " response code: " + responseCode, e); } return responseCode; }
/** * Makes a HTTP call to the specified URL with the parameters specified * in the Message. * * @param url URL endpoint for the HTTP call * @param request Message containing the parameters * @param response ParameterList that will hold the parameters received in * the HTTP response * @return the status code of the HTTP call */ private int call(String url, Message request, ParameterList response) throws MessageException { int responseCode = -1; try { if (DEBUG) { _log.debug("Performing HTTP POST on " + url); } HttpResponse resp = _httpFetcher.post(url, request.getParameterMap()); responseCode = resp.getStatusCode(); String postResponse = resp.getBody(); response.copyOf(ParameterList.createFromKeyValueForm(postResponse)); if (DEBUG) { _log.debug("Retrived response:\n" + postResponse); } } catch (IOException e) { _log.error("Error talking to " + url + " response code: " + responseCode, e); } return responseCode; }
/** * Makes a HTTP call to the specified URL with the parameters specified * in the Message. * * @param url URL endpoint for the HTTP call * @param request Message containing the parameters * @param response ParameterList that will hold the parameters received in * the HTTP response * @return the status code of the HTTP call */ private int call(String url, Message request, ParameterList response) throws MessageException { int responseCode = -1; try { if (DEBUG) _log.debug("Performing HTTP POST on " + url); HttpResponse resp = _httpFetcher.post(url, request.getParameterMap()); responseCode = resp.getStatusCode(); String postResponse = resp.getBody(); response.copyOf(ParameterList.createFromKeyValueForm(postResponse)); if (DEBUG) _log.debug("Retrived response:\n" + postResponse); } catch (IOException e) { _log.error("Error talking to " + url + " response code: " + responseCode, e); } return responseCode; }
@SuppressWarnings("unchecked") Map<String, String> m = (Map<String, String>) response .getParameterMap(); for (String key : m.keySet()) { f.add(key, m.get(key));
Map<String, String> parameters = message.getParameterMap(); ReturnResponse returnResponse = new ReturnResponse(destinationUrl); for (String paramKey : parameters.keySet()) {