Package org.openid4java.message.ax

Examples of org.openid4java.message.ax.FetchResponse


        // try to get additional details
        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);

          if (ext instanceof FetchResponse) {
            FetchResponse fetchResp = (FetchResponse) ext;

            details.setMail(fetchResp.getAttributeValue("email"));

            String fullname = fetchResp.getAttributeValue("fullname");
            if (fullname == null) {
              String firstname = fetchResp.getAttributeValue("firstname");
              String lastname = fetchResp.getAttributeValue("lastname");

              if (firstname == null) {
                fullname = lastname == null ? null : lastname;
              } else if (lastname != null) {
                fullname = firstname + " " + lastname;
View Full Code Here


                AuthSuccess authSuccess =
                        (AuthSuccess) verification.getAuthResponse();

                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);
                }

                return verified;  // success
            }
View Full Code Here

        // try to get additional details
        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);

          if (ext instanceof FetchResponse) {
            FetchResponse fetchResp = (FetchResponse) ext;

            details.setMail(fetchResp.getAttributeValue("email"));

            String fullname = fetchResp.getAttributeValue("fullname");
            if (fullname == null) {
              String firstname = fetchResp.getAttributeValue("firstname");
              String lastname = fetchResp.getAttributeValue("lastname");

              if (firstname == null) {
                fullname = lastname == null ? null : lastname;
              } else if (lastname != null) {
                fullname = firstname + " " + lastname;
View Full Code Here

        p.setValidatedId(verified.getIdentifier());
        AuthSuccess authSuccess = (AuthSuccess) verification
            .getAuthResponse();

        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          FetchResponse fetchResp = (FetchResponse) authSuccess
              .getExtension(AxMessage.OPENID_NS_AX);

          p.setEmail(fetchResp.getAttributeValue("email"));
          p.setFirstName(fetchResp.getAttributeValue("firstname"));
          p.setLastName(fetchResp.getAttributeValue("lastname"));
          p.setFullName(fetchResp.getAttributeValue("fullname"));

          // also use the ax namespace for compatibility
          if (p.getEmail() == null) {
            p.setEmail(fetchResp.getAttributeValue("emailax"));
          }
          if (p.getFirstName() == null) {
            p.setFirstName(fetchResp
                .getAttributeValue("firstnameax"));
          }
          if (p.getLastName() == null) {
            p.setLastName(fetchResp.getAttributeValue("lastnameax"));
          }
          if (p.getFullName() == null) {
            p.setFullName(fetchResp.getAttributeValue("fullnameax"));
          }

        }
        userProfile = p;
        return p;
View Full Code Here

        // try to get additional details
        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);

          if (ext instanceof FetchResponse) {
            FetchResponse fetchResp = (FetchResponse) ext;

            details.setMail(fetchResp.getAttributeValue("email"));

            String fullname = fetchResp.getAttributeValue("fullname");
            if (fullname == null) {
              String firstname = fetchResp.getAttributeValue("firstname");
              String lastname = fetchResp.getAttributeValue("lastname");

              if (firstname == null) {
                fullname = lastname == null ? null : lastname;
              } else if (lastname != null) {
                fullname = firstname + " " + lastname;
View Full Code Here

                    AuthSuccess authResponse = (AuthSuccess)verification.getAuthResponse();
                    if (authResponse.hasExtension(AxMessage.OPENID_NS_AX))
                    {
                        try
                        {
                            FetchResponse axResponse = (FetchResponse)authResponse.getExtension(AxMessage.OPENID_NS_AX);
                            email = axResponse.getAttributeValue("email");
                            fullName = axResponse.getAttributeValue("fullname");
                            firstName = axResponse.getAttributeValue("firstname");
                            lastName = axResponse.getAttributeValue("lastname");
                            nickname = axResponse.getAttributeValue("nickname");
                        }
                        catch (OpenIDException oide)
                        {
                            throw new RuntimeException("Unexpected OpenID authenticated attribute exchange fetch exception: "+oide, oide);
                        }
View Full Code Here

        HttpSession session = httpReq.getSession(true);
        session.setAttribute("openid_identifier", authSuccess.getIdentity());

        if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
          FetchResponse fetchResp = (FetchResponse) authSuccess
                  .getExtension(AxMessage.OPENID_NS_AX);
          session.setAttribute("emailFromFetch", fetchResp.getAttributeValues("email").get(0));
        }
        if (authSuccess.hasExtension(SRegMessage.OPENID_NS_SREG)) {
          SRegResponse sregResp = (SRegResponse) authSuccess
                  .getExtension(SRegMessage.OPENID_NS_SREG);
          session.setAttribute("emailFromSReg", sregResp.getAttributeValue("email"));
View Full Code Here

    replay(authRequest);
    return authRequest;
  }
 
  private FetchResponse createMockFetchResponse() {
    FetchResponse response = createMock(FetchResponse.class);
    expect(response.getAttributeValues("email")).andReturn(Lists.newArrayList("john@example.com"));
    replay(response);
    return response;
  }
View Full Code Here

TOP

Related Classes of org.openid4java.message.ax.FetchResponse

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.