|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||
See:
Description
| Interface Summary | |
|---|---|
| ConsumerAssociationStore | |
| NonceVerifier | |
| Class Summary | |
|---|---|
| AbstractNonceVerifier | |
| ConsumerManager | Manages OpenID communications with an OpenID Provider (Server). |
| EhcacheNonceVerifier | |
| InMemoryConsumerAssociationStore | |
| InMemoryNonceVerifier | |
| SampleConsumer | Sample Consumer (Relying Party) implementation. |
| VerificationResult | |
| Exception Summary | |
|---|---|
| ConsumerException | |
Provides functionality for OpenID-enabling Consumer (Relying Party) sites.
The general usage pattern for a Consumer site is outlined below:
// instantiate a ConsumerManager object
public static manager = new ConsumerManager();
// --- placing the authentication request ---
// determine a return_to URL where your application will receive
// the authentication responses from the OpenID provider
String returnToUrl = "http://example.com/openid";
// build an Identifier instance from the user-supplied identifier
Identifier identifier = Discovery.parseIdentifier(userSuppliedString);
// perform discovery on the user-supplied identifier
List discoveries = Discovery.discover(identifier);
// attempt to associate with an OpenID provider
// and retrieve one service endpoint for authentication
DiscoveryInformation discovered = manager.associate(discoveries);
// store the discovery information in the user's session
session.setAttribute("openid-disco", discovered);
// Attribute Exchange example: fetching the 'email' attribute
FetchRequest fetch = new FetchRequest();
fetch.addAttribute("email", // attribute alias
"http://schema.openid.net/contact/email", // type URI
true); // required
// obtain a AuthRequest message to be sent to the OpenID provider
AuthRequest authReq = manager.authenticate(discovered, returnToUrl);
// attach the extension to the authentication request
authReq.addExtensionParams(fetch);
if (! discovered.isVersion2() )
{
// Option 1: GET HTTP-redirect to the OpenID Provider endpoint
// The only method supported in OpenID 1.x
// redirect-URL usually limited to 255 bytes
return authReq.getRedirectUrl();
}
else
{
// Option 2: HTML FORM Redirection
// Allows payloads > 255 bytes
//