Package org.growersnation.site.auth.openid

Examples of org.growersnation.site.auth.openid.DiscoveryInformationMemento


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

      // Create a memento to rebuild the discovered information in a subsequent request
      DiscoveryInformationMemento memento = new DiscoveryInformationMemento();
      if (discovered.getClaimedIdentifier() != null) {
        memento.setClaimedIdentifier(discovered.getClaimedIdentifier().getIdentifier());
      }
      memento.setDelegate(discovered.getDelegateIdentifier());
      if (discovered.getOPEndpoint() != null) {
        memento.setOpEndpoint(discovered.getOPEndpoint().toString());
      }
      memento.setTypes(discovered.getTypes());
      memento.setVersion(discovered.getVersion());

      // Create a temporary User to preserve state between requests without
      // using a session (we could be in a cluster)
      User tempUser = new User(sessionToken);
      tempUser.setOpenIDDiscoveryInformationMemento(memento);
View Full Code Here


    // Must have a temporary User to be here
    User tempUser = tempUserOptional.get();

    // Retrieve the discovery information
    final DiscoveryInformationMemento memento = tempUser.getOpenIDDiscoveryInformationMemento();
    Identifier identifier = new Identifier() {
      @Override
      public String getIdentifier() {
        return memento.getClaimedIdentifier();
      }
    };

    DiscoveryInformation discovered;
    try {
      discovered = new DiscoveryInformation(
        URI.create(memento.getOpEndpoint()).toURL(),
        identifier,
        memento.getDelegate(),
        memento.getVersion(),
        memento.getTypes()
      );
    } catch (DiscoveryException e) {
      throw new WebApplicationException(e, Response.Status.UNAUTHORIZED);
    } catch (MalformedURLException e) {
      throw new WebApplicationException(e, Response.Status.UNAUTHORIZED);
View Full Code Here

TOP

Related Classes of org.growersnation.site.auth.openid.DiscoveryInformationMemento

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.