org.restlet.ext.openid
Class OpenIdVerifier

java.lang.Object
  extended by org.restlet.ext.openid.OpenIdVerifier
All Implemented Interfaces:
Verifier

public class OpenIdVerifier
extends Object
implements Verifier

Verifier that will do remote verification of using a provided openid_identifier. The verifier will search for the openid_identifier in the following three ways

  1. Check the query for an openid_identifier
  2. Check the request attribute map for an openid_identifier
  3. Use the default openid_identifier if possible
If an openid_identifier is found, it will do a temporary redirect (or return a form) to the identifier to continue the authentication process. Upon successful authentication the verifier will set the User.

The verifier can also try to request the following attributes to be returned by the OpenIdProvider - setOptionalAttribute and setRequiredAttribute.

Author:
Martin Svensson

Field Summary
static String PROVIDER_FLICKR
           
static String PROVIDER_GOOGLE
           
static String PROVIDER_MYOPENID
           
static String PROVIDER_MYSPACE
           
static String PROVIDER_YAHOO
           
 
Fields inherited from interface org.restlet.security.Verifier
RESULT_INVALID, RESULT_MISSING, RESULT_STALE, RESULT_UNKNOWN, RESULT_UNSUPPORTED, RESULT_VALID
 
Constructor Summary
OpenIdVerifier()
          Default constructor.
OpenIdVerifier(String defaultProvider)
          Constructor with a default OpenIdProvider/Identifier.
OpenIdVerifier(String defaultProvider, RelayingParty rp)
           
 
Method Summary
 void addOptionalAttribute(AttributeExchange attributeName)
          Adds required User attribute to retrieve during authentication.
 void addRequiredAttribute(AttributeExchange attributeName)
          Adds an optional User attribute to retrieve during authentication
 void clearOptionalAttributes()
          Clears the set of optional attributes to retrieve.
 void clearRequiredAttributes()
          Clears the set of required attributes to retrieve.
 void setDefaultProvider(String provider)
          Sets the default provider.
 void setUseDefaultProvider(boolean useDefault)
          Indicates if the defaultProvider must be used in case none is provided in the request.
 int verify(Request request, Response response)
          Verifies a request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROVIDER_FLICKR

public static final String PROVIDER_FLICKR
See Also:
Constant Field Values

PROVIDER_GOOGLE

public static final String PROVIDER_GOOGLE
See Also:
Constant Field Values

PROVIDER_MYOPENID

public static final String PROVIDER_MYOPENID
See Also:
Constant Field Values

PROVIDER_MYSPACE

public static final String PROVIDER_MYSPACE
See Also:
Constant Field Values

PROVIDER_YAHOO

public static final String PROVIDER_YAHOO
See Also:
Constant Field Values
Constructor Detail

OpenIdVerifier

public OpenIdVerifier()
Default constructor.


OpenIdVerifier

public OpenIdVerifier(String defaultProvider)
Constructor with a default OpenIdProvider/Identifier.

Parameters:
defaultProvider - The default OpenIdProvider/Identifier.

OpenIdVerifier

public OpenIdVerifier(String defaultProvider,
                      RelayingParty rp)
Method Detail

addOptionalAttribute

public void addOptionalAttribute(AttributeExchange attributeName)
Adds required User attribute to retrieve during authentication.

Parameters:
attributeName - The name of the attribute. See valid attributes.

addRequiredAttribute

public void addRequiredAttribute(AttributeExchange attributeName)
Adds an optional User attribute to retrieve during authentication

Parameters:
attributeName - The name of the attribute. See valid attributes.

clearOptionalAttributes

public void clearOptionalAttributes()
Clears the set of optional attributes to retrieve.


clearRequiredAttributes

public void clearRequiredAttributes()
Clears the set of required attributes to retrieve.


setDefaultProvider

public void setDefaultProvider(String provider)
Sets the default provider. Will also set useDefaultProvider to true.


setUseDefaultProvider

public void setUseDefaultProvider(boolean useDefault)
Indicates if the defaultProvider must be used in case none is provided in the request.

Parameters:
useDefault - True if the defaultProvider must be used.

verify

public int verify(Request request,
                  Response response)
Verifies a request. The verifier will be called twice to verify a request since verification is done remotely using callbacks. Also sets the user object.

Specified by:
verify in interface Verifier
Returns:
Verifier.RESULT_INVALID if it fails, Verifier.RESULT_VALID if success, Verifier.RESULT_MISSING while waiting for a callback response.


Copyright © 2005-2013 Restlet.