Package org.openid4java.message

Examples of org.openid4java.message.AuthSuccess


            result.setOPSetupUrl(fail.getUserSetupUrl());
            _log.info("Received auth immediate failure.");
            return result;
        }

        AuthSuccess authResp = AuthSuccess.createAuthSuccess(response);
        _log.info("Received positive auth response.");

        authResp.validate();

        result.setAuthResponse(authResp);

        // [1/4] return_to verification
        if (! verifyReturnTo(receivingUrl, authResp))
View Full Code Here


      // examine the verification result and extract the verified
      // identifier
      Identifier verified = verification.getVerifiedId();
      if (verified != null) {
        AuthSuccess authSuccess = (AuthSuccess) verification
            .getAuthResponse();

        receiveSimpleRegistration(httpReq, authSuccess);

        receiveAttributeExchange(httpReq, authSuccess);
View Full Code Here

            // examine the verification result and extract the verified
            // identifier
            Identifier verified = verification.getVerifiedId();
            if (verified != null) {
                AuthSuccess authSuccess = (AuthSuccess) verification
                        .getAuthResponse();
                if (!openId.equals(authSuccess.getIdentity()))
                {
                    throw new ServletException("Invalid Openid");
                }
            }
            
View Full Code Here

      // Examine the verification result and extract the verified identifier
      Optional<Identifier> verified = Optional.fromNullable(verification.getVerifiedId());
      if (verified.isPresent()) {
        // Verified
        AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();

        // We have successfully authenticated so remove the temp user
        // and replace it with a potentially new one
        userDao.delete(tempUser);

        tempUser = new User(UUID.randomUUID());
        tempUser.setOpenIDIdentifier(verified.get().getIdentifier());

        // Provide a basic authority in light of successful authentication
        tempUser.getAuthorities().add(Authority.ROLE_PUBLIC);

        // Extract additional information
        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          tempUser.setEmailAddress(extractEmailAddress(authSuccess));
          tempUser.setFirstName(extractFirstName(authSuccess));
          tempUser.setLastName(extractLastName(authSuccess));
        }
        log.info("Extracted a temporary {}", tempUser);
View Full Code Here

            // examine the verification result and extract the verified identifier
            Identifier identifier = verification.getVerifiedId();

            if (identifier != null) {
                AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();

                Map<String, List<String>> attributeValues = null;
                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
                    FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
                    @SuppressWarnings("unchecked")
                    Map<String, List<String>> attrValues = fetchResp.getAttributes();
                    attributeValues = attrValues;
                }
View Full Code Here

                                                             response, discovered);
           
            // examine the verification result and extract the verified identifier
            Identifier verified = verification.getVerifiedId();
            if (verified != null) {
                AuthSuccess authSuccess =
                    (AuthSuccess) verification.getAuthResponse();
               
                System.out.println("*** EXT: " + authSuccess.getExtensions());
                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
                    FetchResponse fetchResp = (FetchResponse) authSuccess
                        .getExtension(AxMessage.OPENID_NS_AX);
                   
                    List emails = fetchResp.getAttributeValues("email");
                    String email = (String) emails.get(0);
                    System.out.println("XXX email is " + email);
View Full Code Here

         // examine the verification result and extract the verified identifier
         Identifier identifier = verification.getVerifiedId();

         if (identifier != null)
         {
            AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();

            Map<String, List<String>> attributeValues = null;
            if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX))
            {
               FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
               @SuppressWarnings("unchecked")
               Map<String, List<String>> attrValues = fetchResp.getAttributes();
               attributeValues = attrValues;
            }
View Full Code Here

            Identifier verified = verification.getVerifiedId();
            String openid = null;
           
            if( verified != null ){
                AuthSuccess authSuccess = (AuthSuccess)verification.getAuthResponse();
                /*
                 * This piece of code does not work with blogspot.com while it works well
                 * with myopenid.com.
                request.setAttribute("opendpoint", authSuccess.getOpEndpoint());
                request.setAttribute("claimed", authSuccess.getClaimed());
                session.setAttribute("openid", authSuccess.getClaimed());
                 */
                openid = (String)session.getAttribute(OPENID_CLAIMED_ID_SESSION);
                session.removeAttribute(OPENID_CLAIMED_ID_SESSION);
               
                if (authSuccess.hasExtension(SRegMessage.OPENID_NS_SREG)) {
                    logger.info("resp contains SREG extension");
                    MessageExtension ext = authSuccess.getExtension(SRegMessage.OPENID_NS_SREG);
                    if (ext instanceof SRegResponse) {
                        logger.info("got a sreg response");
                        SRegResponse sregResp = (SRegResponse) ext;
                        Map sregmap = sregResp.getAttributes();
                        request.setAttribute(sregmapAttrName,  sregmap);
                    }
                }

                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
                    FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
                    logger.info("resp contains AX extension");

                    request.setAttribute(axmapAttrName, fetchResp.getAttributes());
                    List aliases = fetchResp.getAttributeAliases();
                    for (Iterator iter = aliases.iterator(); iter.hasNext();) {
View Full Code Here

            // examine the verification result and extract the verified
            // identifier

            final Identifier verified = verification.getVerifiedId();
            if (verified != null) {
                final AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();
                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
                    final FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension(AxMessage.OPENID_NS_AX);
                    final String email = fetchResp.getAttributeValue("email");
                    final String lastname = fetchResp.getAttributeValue("LastName");
                    final String firstname = fetchResp.getAttributeValue("FirstName");
                    final String fullname = fetchResp.getAttributeValue("fullname");
                    final HttpSession session = request.getSession();
View Full Code Here

     * @return Signature.
     * @throws MessageException
     * @throws AssociationException
     */
    private String getSignature(boolean compatibilty) throws MessageException, AssociationException {
        AuthSuccess openidResp = null;

        openidResp = AuthSuccess.createAuthSuccess(opAdress, openID, openID, compatibilty,
                returnTo, nonce, null, assoc, true);

        // sign the message
        return openidResp.getSignature();
    }
View Full Code Here

TOP

Related Classes of org.openid4java.message.AuthSuccess

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.