Package org.openid4java.discovery

Examples of org.openid4java.discovery.Identifier


    public void successfulVerificationReturnsExpectedAuthentication() throws Exception {
        ConsumerManager mgr = mock(ConsumerManager.class);
        OpenID4JavaConsumer consumer = new OpenID4JavaConsumer(mgr, new NullAxFetchListFactory());
        VerificationResult vr = mock(VerificationResult.class);
        DiscoveryInformation di = mock(DiscoveryInformation.class);
        Identifier id = new Identifier() {
            public String getIdentifier() {
                return "id";
            }
        };
        Message msg = mock(Message.class);
View Full Code Here


        } catch (AssociationException e) {
            throw new OpenIDConsumerException("Error verifying openid response", e);
        }

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

        if (verified == null) {
            Identifier id = discovered.getClaimedIdentifier();
            return new OpenIDAuthenticationToken(OpenIDAuthenticationStatus.FAILURE,
                    id == null ? "Unknown" : id.getIdentifier(),
                    "Verification status message: [" + verification.getStatusMsg() + "]",
                    Collections.<OpenIDAttribute>emptyList());
        }

        List<OpenIDAttribute> attributes = fetchAxAttributes(verification.getAuthResponse(), attributesToFetch);
View Full Code Here

         // (static) instance used to place the authentication request
         VerificationResult verification = openIdConsumerManager.verify(
               receivingURL.toString(), parameterList, discovered);

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

            OpenIdPrincipal principal = createPrincipal(identifier.getIdentifier(),
                  discovered.getOPEndpoint(), attributeValues);

            openIdRelyingPartySpi.get().loginSucceeded(principal,
                  responseHandler.createResponseHolder(httpResponse));
         }
View Full Code Here

            String queryString = request.getQueryString();
            if( queryString != null && queryString.length() > 0 )
                receivingURL.append("?").append(queryString);
            VerificationResult verification = manager.verify(receivingURL.toString(), openidResp, discovered);

            Identifier verified = verification.getVerifiedId();
            String openid = null;
           
            if( verified != null ){
                AuthSuccess authSuccess = (AuthSuccess)verification.getAuthResponse();
                /*
 
View Full Code Here

            final VerificationResult verification = consumerManager.verify(receivingURL.toString(), response, discovered);

            // 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");
View Full Code Here

     * @throws IOException if an I/O error occurs
     */
    @Override
    protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
            throws ServletException, IOException {
        final Identifier identifier = this.verifyResponse(request);
        response.sendRedirect(REDIRECT_LOCATION);
    }
View Full Code Here

        DiscoveryInformation discovered = null;
        String receivingURL = null;
        String queryString = null;
        VerificationResult verification = null;
        Identifier verified = null;
        HttpSession session = null;

        session = request.getSession();

        // Retrieve the previously stored discovery information
View Full Code Here

    // asserted identifier in the AuthResponse
    String assertId = authResp.getIdentity();

    // claimed identifier in the AuthResponse, without fragment
    Identifier respClaimed =
      consumerManager.getDiscovery().parseIdentifier(authResp.getClaimed(), true);

    // the OP endpoint sent in the response
    String respEndpoint = authResp.getOpEndpoint();
View Full Code Here

      session.removeAttribute("access_token_secret");
      session.removeAttribute("accessor");
      session.removeAttribute("user");

      // Get Claimed Identifier
      Identifier claimedId = authResponse.getClaimedId();
      session.setAttribute("user",
          (claimedId == null) ? UNKNOWN : claimedId.getIdentifier());


      if (authResponse.getAuthResultType() == ResultType.SETUP_NEEDED) {
        throw new ServletException("setup needed");
      }
View Full Code Here

        String rc = params.getFirstValue("return");
        if (rc != null && rc.length() > 0) {
            Map<String, String> axRequired = new HashMap<String, String>();
            Map<String, String> axOptional = new HashMap<String, String>();
            Identifier i = verifyResponse(axRequired, axOptional);
            if (i == null) {
                log.info("Authentication Failed");
                getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND);
                return new StringRepresentation("Authentication Failed");
            }
            log.info("Identifier = " + i.getIdentifier());
            String id = i.getIdentifier();
            if (id != null) {
                // New Code, always return JSON and let filter handle any
                // callback.
                // TODO maybe move it to use Principal.
                JSONObject obj = new JSONObject();
                try {
                    obj.put("id", i.getIdentifier());
                    for (String s : axRequired.keySet()) {
                        obj.put(s, axRequired.get(s));
                    }
                    for (String s : axOptional.keySet()) {
                        obj.put(s, axOptional.get(s));
View Full Code Here

TOP

Related Classes of org.openid4java.discovery.Identifier

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.