Package org.openid4java.consumer

Examples of org.openid4java.consumer.ConsumerManager


        } catch (IOException ex) {
            System.err.print(ex.getMessage());
        }
        try {
            if (consumerManager == null) {
                consumerManager = new ConsumerManager();
                consumerManager.setAssociations(new InMemoryConsumerAssociationStore());
                consumerManager.setNonceVerifier(new InMemoryNonceVerifier(10000));
            }
        } catch (Exception ex) {
            final String message = "Exception creating ConsumerManager!";
View Full Code Here


        log.info("Getting consumer manager for - " + OPUri);
        if (!managers.containsKey(OPUri)) {
            // create a new manager
            log.info("Creating new consumer manager for - " + OPUri);
            try {
                ConsumerManager cm = new ConsumerManager();
                cm.setConnectTimeout(30000);
                cm.setSocketTimeout(30000);
                cm.setFailedAssocExpire(0); // sec 0 = disabled
                // cm.setMaxAssocAttempts(4); //default
                managers.put(OPUri, cm);
                return cm;
            } catch (ConsumerException e) {
                log.warning("Failed to create ConsumerManager for - " + OPUri);
View Full Code Here

                    log.info("Found - " + di.getOPEndpoint());
                    target = di.getOPEndpoint().toString();
                }
            }

            ConsumerManager manager = getManager(target);
            // try {
            // discoveries = manager.discover(target);
            // } catch (YadisException e) {
            // log.info("Could not connect in time!!!!!!!!!!!!!!!!!!!!!!");
            // return new
            // StringRepresentation("Could not connect to Identity Server in time.",MediaType.TEXT_HTML);
            // }

            // attempt to associate with the OpenID provider
            // and retrieve one service endpoint for authentication
            DiscoveryInformation discovered = manager.associate(discoveries);

            // store the discovery information in the user's session
            // getContext().getAttributes().put("openid-disc", discovered);
            String sessionId = String.valueOf(System
                    .identityHashCode(discovered));
            session.put(sessionId, discovered);

            getResponse().getCookieSettings().add(
                    new CookieSetting(DESCRIPTOR_COOKIE, sessionId));
            log.info("Setting DESCRIPTOR COOKIE");

            // obtain a AuthRequest message to be sent to the OpenID provider
            AuthRequest authReq = manager.authenticate(discovered,
                    returnToUrl.toString()); // TODO maybe add TIMESTAMP?
            // Domain wide realm add meta to main page
            // http://localhost:8080/oauth/xrds?returnTo=http://localhost:8080/oauth/openid_login\r\n
            // log.info("OpenID - REALM = " +
            // getReference().getHostIdentifier());
View Full Code Here

            // receivingURL.append(getOriginalRef().getSchemeSpecificPart(true));
            // log.info("receivingURL = "+receivingURL);

            log.info("OpenID disc : " + discovered.getOPEndpoint());
            log.info("OpenID orig ref : " + getOriginalRef());
            ConsumerManager manager = getManager(discovered.getOPEndpoint()
                    .toString());

            VerificationResult verification = manager.verify(getOriginalRef()
                    .toString(), response, discovered);
            log.info("verification = " + verification);

            // examine the verification result and extract the verified
            // identifier
View Full Code Here

        l.info("Getting consumer manager for - " + OPUri);
        if (!managers.containsKey(OPUri)) {
            // create a new manager
            l.info("Creating new consumer manager for - " + OPUri);
            try {
                ConsumerManager cm = new ConsumerManager();
                cm.setConnectTimeout(30000);
                cm.setSocketTimeout(30000);
                cm.setFailedAssocExpire(0); // sec 0 = disabled
                // cm.setMaxAssocAttempts(4); //default
                managers.put(OPUri, cm);
                return cm;
            } catch (ConsumerException e) {
                l.warning("Failed to create ConsumerManager for - " + OPUri);
View Full Code Here

                l.info("Found - " + di.getOPEndpoint());
                target = di.getOPEndpoint().toString();
            }
        }

        ConsumerManager manager = getManager(target);
        DiscoveryInformation discovered = manager.associate(discoveries);

        // store the discovery information in the user's session
        // getContext().getAttributes().put("openid-disc", discovered);
        String sessionId = String.valueOf(System.identityHashCode(discovered));
        session.put(sessionId, discovered);

        response.getCookieSettings().add(
                new CookieSetting(OpenIdConsumer.DESCRIPTOR_COOKIE, sessionId));
        l.info("Setting DESCRIPTOR COOKIE");

        // obtain a AuthRequest message to be sent to the OpenID provider
        AuthRequest authReq = manager.authenticate(discovered, redir); // TODO
                                                                       // maybe
                                                                       // add
                                                                       // TIMESTAMP?;
        String ref = request.getResourceRef().getBaseRef().toString();
        l.info("OpenID - REALM = " + ref);
View Full Code Here

            // extract the receiving URL from the HTTP request

            l.info("getOriginalRef = " + request.getOriginalRef());

            ConsumerManager manager = getManager(discovered.getOPEndpoint()
                    .toString());
            String redir = request.getResourceRef().getHostIdentifier()
                    + request.getResourceRef().getPath() + "?return=true";

            VerificationResult verification = manager.verify(redir, response,
                    discovered);

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

        // configure the return_to URL where your application will receive
        // the authentication responses from the OpenID provider
        this.returnToUrl = returnToUrl;

        // instantiate a ConsumerManager object
        manager = new ConsumerManager();
        manager.setAssociations(new InMemoryConsumerAssociationStore());
        manager.setNonceVerifier(new InMemoryNonceVerifier(5000));

        // for a working demo, not enforcing RP realm discovery
        // since this new feature is not deployed
View Full Code Here

    webSession = cf;
    identifiedUser = iu;
    urlProvider = up;
    accountManager = am;
    manager = new ConsumerManager();
    allowedOpenIDs = ac.getAllowedOpenIDs();
    papeMaxAuthAge = (int) ConfigUtil.getTimeUnit(config, //
        "auth", null, "maxOpenIdSessionAge", -1, TimeUnit.SECONDS);
  }
View Full Code Here

    @Create
    public void init()
        throws ConsumerException
    {
        manager = new ConsumerManager();
        discovered = null;
        id = null;
        validatedId = null;
    }
View Full Code Here

TOP

Related Classes of org.openid4java.consumer.ConsumerManager

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.