Examples of SecureDiscoveryInformation


Examples of com.google.step2.discovery.SecureDiscoveryInformation

    log.info("Receiving URL: " + receivingUrl);

    // we'll do discovery right now. This will prevent the consumerManager
    // from repeating discovery later, and will allow us to modify the
    // VerificationResult depending on whether the discovery was secure.
    SecureDiscoveryInformation d2 = getDiscoveryInfoForClaimedId(authResponse,
        discovered);

    VerificationResult verification =
      consumerManager.verify(receivingUrl, authResponse, d2);
View Full Code Here

Examples of com.google.step2.discovery.SecureDiscoveryInformation

    // perform discovery on the claimed identifier in the assertion
    @SuppressWarnings("unchecked")
    List<SecureDiscoveryInformation> discoveries =
        consumerManager.getDiscovery().discover(respClaimed);

    SecureDiscoveryInformation firstServiceMatch = null;

    // find the newly discovered service endpoint that matches the assertion
    // - OP endpoint, OP-specific ID and protocol version must match
    // - prefer (first = highest priority) endpoint with an association
    for (SecureDiscoveryInformation service : discoveries) {
View Full Code Here

Examples of com.google.step2.discovery.SecureDiscoveryInformation

                    {
                        log.debug("Step2 discovery for identity: "+responseClaimedId);
                    }

                    // get Step2 secure discovery information
                    SecureDiscoveryInformation secureDiscovered = null;
                   
                    // validate previously discovered secure discovery information
                    if (discovered instanceof SecureDiscoveryInformation)
                    {
                        // check for matching version, identifiers, and endpoints
                        if (discovered.isVersion2() && discovered.hasClaimedIdentifier() && discovered.getClaimedIdentifier().equals(responseClaimedId) && discovered.getOPEndpoint().equals(responseEndpoint))
                        {
                            String discoveredProviderId = (discovered.hasDelegateIdentifier() ? discovered.getDelegateIdentifier() : discovered.getClaimedIdentifier().getIdentifier());
                            if (discoveredProviderId.equals(providerId))
                            {
                                secureDiscovered = (SecureDiscoveryInformation)discovered;

                                if (log.isDebugEnabled())
                                {
                                    log.debug("Matched previously discovered Step2 secure discovery information for "+responseClaimedId+" identity: "+secureDiscovered.getOPEndpoint());
                                }
                            }
                        }
                    }

                    // discover secure discovery information if necessary
                    if (secureDiscovered == null)
                    {
                        // perform discovery on claimed identifier
                        List<SecureDiscoveryInformation> discoveredInfos = openIDStep2ConsumerManager.getDiscovery().discover(responseClaimedId);
                        // match secure discovered information: prefer previously associated matches
                        for (SecureDiscoveryInformation discoveredInfo : discoveredInfos)
                        {
                            // match secure discovered information
                            String version = discoveredInfo.getVersion();
                            if ((version != null) && version.equals(DiscoveryInformation.OPENID2_OP) && discoveredInfo.isVersion2() && discoveredInfo.getOPEndpoint().equals(responseEndpoint))
                            {
                                String discoveredProviderId = (discoveredInfo.hasDelegateIdentifier() ? discoveredInfo.getDelegateIdentifier() : discoveredInfo.getClaimedIdentifier().getIdentifier());
                                if (discoveredProviderId.equals(providerId))
                                {
                                    // match previously associated or first discovered
                                    if (openIDStep2ConsumerManager.getPrivateAssociationStore().load(discoveredInfo.getOPEndpoint().toString(), authResponse.getHandle()) != null)
                                    {
                                        secureDiscovered = discoveredInfo;
                                        break;
                                    }
                                    else if (secureDiscovered == null)
                                    {
                                        secureDiscovered = discoveredInfo;                                   
                                    }
                                }                           
                            }
                        }

                        if (log.isDebugEnabled() && (secureDiscovered != null))
                        {
                            log.debug("Discovered Step2 secure discovery information for "+responseClaimedId+" identity: "+secureDiscovered.getOPEndpoint());
                        }
                    }

                    if (log.isDebugEnabled() && (secureDiscovered != null))
                    {
                        log.debug("Verify Step2 OpenID authentication request using: "+secureDiscovered.getOPEndpoint());
                    }

                    // verify using secure discovery information
                    results.verification = openIDStep2ConsumerManager.verify(authRequestURL, authParams, secureDiscovered);

                    if (log.isDebugEnabled() && (results.verification != null))
                    {
                        log.debug("Verified Step2 OpenID authentication request: "+authRequestURL);
                    }
                   
                    // verify secure verified identifier
                    if ((results.verification.getAuthResponse() instanceof AuthSuccess) && (results.verification.getVerifiedId() != null))
                    {
                        // verify secure verification
                        boolean secureVerification = ((secureDiscovered != null) && (secureDiscovered.getClaimedIdentifier() != null) && secureDiscovered.isSecure());
                        if (secureVerification)
                        {
                            try
                            {
                                UrlIdentifier verifiedClaimedId = new UrlIdentifier(results.verification.getVerifiedId().getIdentifier(), true);
                                secureVerification = secureDiscovered.getClaimedIdentifier().getIdentifier().equals(verifiedClaimedId.getIdentifier());
                            }
                            catch (OpenIDException oide)
                            {
                                secureVerification = false;
                            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.