Package org.openid4java.message

Examples of org.openid4java.message.ParameterList


    public String verifyResponse(HttpServletRequest httpReq) {
        try {
            // extract the parameters from the authentication response
            // (which comes in as a HTTP request from the OpenID providerType)
            ParameterList response =
                    new ParameterList(httpReq.getParameterMap());

            StringBuilder receivingURL = new StringBuilder(returnToUrl());
            String queryString = httpReq.getQueryString();
            if (queryString != null && queryString.length() > 0) {
                receivingURL.append("?").append(httpReq.getQueryString());
            }

            // verify the response; ConsumerManager needs to be the same
            // (static) instance used to place the authentication request
            VerificationResult verification =
                    manager.verify(receivingURL.toString(), response,
                            discovered);

            // The OpenId provider cancelled the authentication
            if ("cancel".equals(response.getParameterValue("openid.mode"))) {
                // TODO This should be done at a higher level. i.e. instead of
                // returning a string, return an
                // object that holds more information for the UI to render
                FacesMessages.instance().add(StatusMessage.Severity.INFO,
                        "Authentication Request Cancelled");
View Full Code Here


    manager.getRealmVerifier().setEnforceRpId(false);
  }

  public String processRequest(HttpServletRequest httpReq, HttpServletResponse httpResp) throws Exception {
    // extract the parameters from the request
    ParameterList request = new ParameterList(httpReq.getParameterMap());

    String mode = request.hasParameter("openid.mode") ? request.getParameterValue("openid.mode") : null;

    Message response;
    String responseText;

    if ("associate".equals(mode)) {
View Full Code Here

        response.sendRedirect(authReq.getDestinationUrl(true));
    }

    @RequestMapping(value = "/openidAnswer", method = GET)
    public ModelAndView showAnswer(HttpServletRequest request) throws Exception {
        ParameterList response = new ParameterList(request.getParameterMap());

        // retrieve the previously stored discovery information
        DiscoveryInformation discovered =
                (DiscoveryInformation) request.getSession().getAttribute(DISCOVERY_SESSION_KEY);
View Full Code Here

        }
        return redirectUrl.toString();
    }

    private static ParameterList getParameterList(HttpServletRequest request) {
        return new ParameterList(request.getParameterMap());
    }
View Full Code Here

            authReq = manager.authenticate(discovered, returnToUrl);
            String destinationUrl = authReq.getDestinationUrl(true);
           
            ClientRequest req = new ClientRequest(destinationUrl);
            ClientResponse<String> resp = null;
            ParameterList response = null;
            try {
               resp = req.get(String.class);
               String body = resp.getEntity();
               String[] paramValues = body.split("\n");
               Map<String, String> paramsMap = new HashMap<String, String>();
               for (String paramValue : paramValues) {
                   String theRealValue = paramValue.trim();
                   if (theRealValue.isEmpty()) {
                       continue;
                   }
                   int index = theRealValue.indexOf(":");
                   String key = theRealValue.substring(0, index);
                   String value = theRealValue.substring(index + 1);
                   paramsMap.put(key, value);
               }
               response = new ParameterList(paramsMap);
            } finally {
               resp.releaseConnection();
            }

            // verify the response; ConsumerManager needs to be the same
View Full Code Here

  private void serveAuthenticationRequest(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException
  {
    // extract the parameters from the request
        ParameterList request = new ParameterList(req.getParameterMap());

        String mode = request.hasParameter("openid.mode") ?
                request.getParameterValue("openid.mode") : null;

        Message response;
        String responseText;

        if ("associate".equals(mode))
        {
            // --- process an association request ---
            response = manager.associationResponse(request);
            responseText = response.keyValueFormEncoding();
        }
        else if ("checkid_immediate".equals(mode))
        {
          String userSelectedClaimedId = (String) request.getParameter("openid.claimed_id").getValue();
         
            String realm = (String) request.getParameter("openid.realm").getValue();
           
            if (!isTrustedRealm(realm, userSelectedClaimedId)) {
                response = DirectError.createDirectError("checkid_immediate is not supported");
                responseText = response.keyValueFormEncoding();
                directResponse(resp, responseText);
View Full Code Here

     
      if(adapter instanceof OpenIDLifecycle)
      {
         lifeCycle = (OpenIDLifecycle) adapter;
      }
      ParameterList responselist = new ParameterList(parameterMap);
     
      if(lifeCycle == null)
         throw new IllegalStateException("Lifecycle not found");
     
      DiscoveryInformation discovered =
View Full Code Here

    WOSession session = context.session();

    // extract the parameters from the authentication response
    // (which comes in as a HTTP request from the OpenID provider)
    ParameterList responseParameters = new ParameterList();
    Enumeration formValueKeyEnum = request.formValueKeys().objectEnumerator();
    while (formValueKeyEnum.hasMoreElements()) {
      String formValueKey = (String) formValueKeyEnum.nextElement();
      String formValue = request.stringFormValueForKey(formValueKey);
      responseParameters.set(new Parameter(formValueKey, formValue));
      EROpenIDManager.log.debug("Response parameter: " + formValueKey + " => " + formValue);
    }

    // retrieve the previously stored discovery information
    DiscoveryInformation discovered = (DiscoveryInformation) session.objectForKey(EROpenIDManager.DISCOVERY_INFO_KEY);
View Full Code Here

  protected String getOpenIdReturnUrl() {
    return WicketUtils.toUrl(OpenIdReturnPage.class).toString();
  }

  public void processReturn(PageParameters params) {
    ParameterList response = new ParameterList(WicketUtils.toMap(params));
    try {
      VerificationResult verificationResult = getConsumerManager().verify(getOpenIdReturnUrl(), response,
          discoveryInformation);
      Identifier verifiedIdentifier = verificationResult.getVerifiedId();
      if (verifiedIdentifier != null) {
View Full Code Here

  protected String getOpenIdReturnUrl() {
    return WicketUtils.toAbsolutePath(OpenIdReturnPage.class);
  }

  public void processReturn(PageParameters params) {
    ParameterList response = new ParameterList(params);
    try {
      VerificationResult verificationResult = getConsumerManager().verify(getOpenIdReturnUrl(), response,
          discoveryInformation);
      Identifier verifiedIdentifier = verificationResult.getVerifiedId();
      if (verifiedIdentifier != null) {
View Full Code Here

TOP

Related Classes of org.openid4java.message.ParameterList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.