com.dyuproject.openid
Class Identifier

java.lang.Object
  extended by com.dyuproject.openid.Identifier
All Implemented Interfaces:
Serializable

public final class Identifier
extends Object
implements Serializable

The openid identifier is the user-supplied openid.

Author:
David Yu
See Also:
Serialized Form
Date created:
Jan 10, 2009

Nested Class Summary
static interface Identifier.Resolver
          Resolves the non-url identifier by assigning the openid server endpoint url or the location of the xrds document.
static class Identifier.ResolverCollection
          Allows for chaining the resolution until it is successfully resolved.
 
Field Summary
static String ASSIGNED_PREFIX
          "http://"
static String CHECKED_PREFIX
          "http"
 
Constructor Summary
Identifier(String id)
           
 
Method Summary
 String getId()
          Gets the id.
static Identifier getIdentifier(String id, Identifier.Resolver resolver, OpenIdContext context)
          Returns an Identifier with the id same as the url if the given id is a valid url; If not, the given resolver will resolve the url.
 String getUrl()
          Gets the url.
 boolean isResolved()
          Checks whether this identifier is resolved - meaning the url (openid server endpoint) is provided.
 boolean isUrlContentTypeXrds()
          Checks whether the url is an xrds document.
 void resolve(String url)
          Resolves this identifier by providing a non-null url - which is the user's openid server.
 void resolve(String url, boolean xrds)
          Resolves this identifier by providing a non-null url - which is the user's openid server.
 void resolve(String url, boolean xrds, String newId)
          Resolves this identifier by providing a non-null url - which is the user's openid server.
 void resolve(String url, String newId)
          Resolves this identifier by providing a non-null url - which is the user's openid server, and also changing the id of this identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECKED_PREFIX

public static final String CHECKED_PREFIX
"http"

See Also:
Constant Field Values

ASSIGNED_PREFIX

public static final String ASSIGNED_PREFIX
"http://"

See Also:
Constant Field Values
Constructor Detail

Identifier

public Identifier(String id)
Method Detail

resolve

public void resolve(String url)
Resolves this identifier by providing a non-null url - which is the user's openid server.


resolve

public void resolve(String url,
                    boolean xrds)
Resolves this identifier by providing a non-null url - which is the user's openid server. The flag xrds is to indicate that this url points to an xrds document.


resolve

public void resolve(String url,
                    String newId)
Resolves this identifier by providing a non-null url - which is the user's openid server, and also changing the id of this identifier.


resolve

public void resolve(String url,
                    boolean xrds,
                    String newId)
Resolves this identifier by providing a non-null url - which is the user's openid server. The flag xrds is to indicate that this url points to an xrds document. If newId is not null, it will replace the id of this identifier.


getUrl

public String getUrl()
Gets the url.


getId

public String getId()
Gets the id.


isUrlContentTypeXrds

public boolean isUrlContentTypeXrds()
Checks whether the url is an xrds document.


isResolved

public boolean isResolved()
Checks whether this identifier is resolved - meaning the url (openid server endpoint) is provided.


getIdentifier

public static Identifier getIdentifier(String id,
                                       Identifier.Resolver resolver,
                                       OpenIdContext context)
Returns an Identifier with the id same as the url if the given id is a valid url; If not, the given resolver will resolve the url.



Copyright © 2008-2013. All Rights Reserved.