Package org.openid4java.message

Examples of org.openid4java.message.ParameterList


                }

                // mark the current request type as already tried
                alreadyTried.put(assocReq.getType(), null);

                ParameterList respParams = new ParameterList();
                int status = call(opEndpoint, assocReq, respParams);

                // process the response
                if (status == HttpStatus.SC_OK) // success response
                {
View Full Code Here


            _log.info("No association found, " +
                      "contacting the OP for direct verification...");

            VerifyRequest vrfy = VerifyRequest.createVerifyRequest(authResp);

            ParameterList responseParams = new ParameterList();

            int respCode = call(op.toString(), vrfy, responseParams);
            if (HttpStatus.SC_OK == respCode)
            {
                VerifyResponse vrfyResp =
View Full Code Here

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

      // retrieve the previously stored discovery information
      DiscoveryInformation discovered = (DiscoveryInformation) httpReq
          .getSession().getAttribute("openid-disc");
View Full Code Here

                int index = theRealValue.indexOf(":");
                String key = theRealValue.substring(0, index);
                String value = theRealValue.substring(index + 1);
                paramsMap.put(key, value);
            }
            ParameterList response = new ParameterList(paramsMap);

            // verify the response; ConsumerManager needs to be the same
            // (static) instance used to place the authentication request
            VerificationResult verification =
                manager.verify(returnToUrl.toString(), response, discovered);
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

    }
    log.debug("Receiving URL = '{}", receivingURL.toString());

    // Extract the parameters from the authentication response
    // (which comes in as a HTTP request from the OpenID provider)
    ParameterList parameterList = new ParameterList(request.getParameterMap());

    try {

      // Verify the response
      // ConsumerManager needs to be the same (static) instance used
View Full Code Here

        AuthRequest authReq = consumerManager.authenticate(discoveryInformation, callbackURL);
        return authReq.getDestinationUrl(true);
    }

    public String getIdentifier(String receivingURL, Map<String, Object> params, DiscoveryInformation discoveryInformation) throws OpenIDException {
        VerificationResult verification = consumerManager.verify(receivingURL, new ParameterList(params), discoveryInformation);

        Identifier verified = verification.getVerifiedId();
        if (verified != null)
            return verified.getIdentifier();
View Full Code Here

    @Inject
    private Instance<OpenIdProviderBeanApi> opBean;

    public void handleIncomingMessage(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws InvalidRequestException {
        ParameterList parameterList = new ParameterList(httpRequest.getParameterMap());

        String mode = parameterList.getParameterValue("openid.mode");

        Message associationResponse;

        if ("associate".equals(mode)) {
            associationResponse = openIdServerManager.get().associationResponse(parameterList);
            writeMessageToResponse(associationResponse, httpResponse);
        } else if ("checkid_setup".equals(mode) || "checkid_immediate".equals(mode)) {
            dialogueManager.beginDialogue();
            String claimedIdentifier = parameterList.getParameterValue("openid.claimed_id");
            String opLocalIdentifier = parameterList.getParameterValue("openid.identity");

            openIdProviderRequest.get().setParameterList(parameterList);
            openIdProviderRequest.get().setClaimedIdentifier(claimedIdentifier);

            MessageExtension ext = null;
            try {
                AuthRequest authReq = AuthRequest.createAuthRequest(parameterList, openIdServerManager.get().getRealmVerifier());
                if (authReq.hasExtension(AxMessage.OPENID_NS_AX)) {
                    ext = authReq.getExtension(AxMessage.OPENID_NS_AX);
                }
            } catch (MessageException e) {
                throw new RuntimeException(e);
            }

            if (ext instanceof FetchRequest) {
                FetchRequest fetchRequest = (FetchRequest) ext;

                List<OpenIdRequestedAttribute> requestedAttributes = new LinkedList<OpenIdRequestedAttribute>();
                handleAttributeRequests(fetchRequest, requestedAttributes, false);
                handleAttributeRequests(fetchRequest, requestedAttributes, true);
                openIdProviderRequest.get().setRequestedAttributes(requestedAttributes);
                openIdProviderRequest.get().setFetchRequest(fetchRequest);
            }

            if (claimedIdentifier != null && opLocalIdentifier != null) {
                boolean immediate = "checkid_immediate".equals(mode);
                String realm = parameterList.getParameterValue("openid.realm");
                if (realm == null) {
                    realm = parameterList.getParameterValue("openid.return_to");
                }

                if (opLocalIdentifier.equals(AuthRequest.SELECT_ID)) {
                    openIdProviderSpi.get().authenticate(realm, null, immediate, responseHandler.createResponseHolder(httpResponse));
                } else {
View Full Code Here

            requestedAttributes.add(requestedAttribute);
        }
    }

    public void sendAuthenticationResponse(boolean authenticationSuccesful, Map<String, List<String>> attributeValues, HttpServletResponse response) {
        ParameterList parameterList = openIdProviderRequest.get().getParameterList();
        String userName = openIdProviderRequest.get().getUserName();
        String opLocalIdentifier = opBean.get().getOpLocalIdentifierForUserName(userName);
        String claimedIdentifier = openIdProviderRequest.get().getClaimedIdentifier();
        if (claimedIdentifier.equals(AuthRequest.SELECT_ID)) {
            claimedIdentifier = opLocalIdentifier;
View Full Code Here

    @Inject
    private Instance<DialogueBean> dialogue;

    public void handleIncomingMessage(HttpServletRequest httpRequest,
                                      HttpServletResponse httpResponse) throws InvalidRequestException {
        processIncomingMessage(new ParameterList(httpRequest.getParameterMap()), httpRequest.getQueryString(), httpResponse);
    }   
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.