com.dyuproject.openid
Class OpenIdUser

java.lang.Object
  extended by com.dyuproject.openid.OpenIdUser
All Implemented Interfaces:
Serializable, org.mortbay.util.ajax.JSON.Convertible

public final class OpenIdUser
extends Object
implements Serializable, org.mortbay.util.ajax.JSON.Convertible

The openid user where the identity, claimedId and association metadata are persisted.

Author:
David Yu
See Also:
Serialized Form
Date created:
Sep 10, 2008

Field Summary
static String ATTR_NAME
           
 
Constructor Summary
OpenIdUser()
           
 
Method Summary
 void addExtension(String namespace, String alias)
          Adds an extension mapping for this user's openid provider if this extension truly is available on the user's openid provider.
 void fromJSON(Map map)
           
 Map<String,Object> getA()
          Shorthand for getAttributes(), which is convenient for views/templates.
 String getAssocHandle()
          Gets the handle/key for the openid associated.
 Object getAttribute(String name)
          Gets the custom, persistent attribute mapped to the given key.
 Map<String,Object> getAttributes()
          Gets the custom attributes that was peristed across different http requests.
 String getClaimedId()
          Gets the claimed id of the user.
 String getExtension(String namespace)
          Gets the alias of the extension mapped with the given namespace.
 Map<String,String> getExtensions()
          Gets the extensions added to this user's openid provider.
 String getIdentifier()
          Gets the raw identifier (openid_identifier) supplied on the login form.
 String getIdentity()
          Gets the user's openid identity.
 String getOpenIdDelegate()
          Gets the user's local id
 String getOpenIdServer()
          Gets the user's openid server.
 boolean isAssociated()
          Checks whether this user is already associated with his openid provider.
 boolean isAuthenticated()
          Checks whether this user is already authenticated.
static OpenIdUser populate(OpenIdUser user)
          Populate/clone the provided user.
static OpenIdUser populate(String identifier, String claimedId, String openIdServer)
          Creates a new OpenIdUser pre-populated with discovery data (to skip discovery).
static OpenIdUser populate(String identifier, String claimedId, String openIdServer, String openIdDelegate)
          Creates a new OpenIdUser pre-populated with discovery data (to skip discovery).
 Object removeAttribute(String name)
          Removes the custom, persistent attribute mapped to the given key.
 void setAttribute(String key, Object value)
          Sets a custom attribute that will be peristent across different http requests.
 void toJSON(org.mortbay.util.ajax.JSON.Output out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_NAME

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

OpenIdUser

public OpenIdUser()
Method Detail

populate

public static OpenIdUser populate(OpenIdUser user)
Populate/clone the provided user.


populate

public static OpenIdUser populate(String identifier,
                                  String claimedId,
                                  String openIdServer)
Creates a new OpenIdUser pre-populated with discovery data (to skip discovery).


populate

public static OpenIdUser populate(String identifier,
                                  String claimedId,
                                  String openIdServer,
                                  String openIdDelegate)
Creates a new OpenIdUser pre-populated with discovery data (to skip discovery).


isAssociated

public boolean isAssociated()
Checks whether this user is already associated with his openid provider.


isAuthenticated

public boolean isAuthenticated()
Checks whether this user is already authenticated.


getIdentifier

public String getIdentifier()
Gets the raw identifier (openid_identifier) supplied on the login form.


getClaimedId

public String getClaimedId()
Gets the claimed id of the user. If this is a generic id (E.g the user does not own this id), this will either be the user's local id or identity.


getOpenIdServer

public String getOpenIdServer()
Gets the user's openid server.


getOpenIdDelegate

public String getOpenIdDelegate()
Gets the user's local id


getIdentity

public String getIdentity()
Gets the user's openid identity.


getAssocHandle

public String getAssocHandle()
Gets the handle/key for the openid associated.


setAttribute

public void setAttribute(String key,
                         Object value)
Sets a custom attribute that will be peristent across different http requests.


getAttributes

public Map<String,Object> getAttributes()
Gets the custom attributes that was peristed across different http requests.


getA

public Map<String,Object> getA()
Shorthand for getAttributes(), which is convenient for views/templates.


getAttribute

public Object getAttribute(String name)
Gets the custom, persistent attribute mapped to the given key.


removeAttribute

public Object removeAttribute(String name)
Removes the custom, persistent attribute mapped to the given key.


getExtensions

public Map<String,String> getExtensions()
Gets the extensions added to this user's openid provider.


addExtension

public void addExtension(String namespace,
                         String alias)
Adds an extension mapping for this user's openid provider if this extension truly is available on the user's openid provider.
 NOTE: 
   This is invoked only on discovery and association.
   The mappings are not persistent across different http requests (transient).
 


getExtension

public String getExtension(String namespace)
Gets the alias of the extension mapped with the given namespace.


fromJSON

public void fromJSON(Map map)
Specified by:
fromJSON in interface org.mortbay.util.ajax.JSON.Convertible

toJSON

public void toJSON(org.mortbay.util.ajax.JSON.Output out)
Specified by:
toJSON in interface org.mortbay.util.ajax.JSON.Convertible


Copyright © 2008-2013. All Rights Reserved.