org.openid4java.message.sreg
Class SRegResponse

java.lang.Object
  extended by org.openid4java.message.sreg.SRegMessage
      extended by org.openid4java.message.sreg.SRegResponse
All Implemented Interfaces:
MessageExtension, MessageExtensionFactory

public class SRegResponse
extends SRegMessage

Implements the extension for Simple Registration fetch responses.

Author:
Marius Scurtescu, Johnny Bufu

Field Summary
protected static java.util.List SREG_FIELDS
           
 
Fields inherited from class org.openid4java.message.sreg.SRegMessage
_parameters, OPENID_NS_SREG, OPENID_NS_SREG11
 
Constructor Summary
protected SRegResponse()
          Constructs a SReg Response with an empty parameter list.
protected SRegResponse(ParameterList params)
          Constructs a SReg Response from a parameter list.
 
Method Summary
 void addAttribute(java.lang.String attr, java.lang.String value)
          Adds an attribute to the SReg response.
static SRegResponse createFetchResponse()
          Constructs a SReg Response with an empty parameter list.
static SRegResponse createSRegResponse(ParameterList params)
           
static SRegResponse createSRegResponse(SRegRequest req, java.util.Map userData)
          Creates a SRegResponse from a SRegRequest message and the data released by the user.
 java.util.List getAttributeNames()
          Gets a list of attribute names in the SReg response.
 java.util.Map getAttributes()
          Gets a map with attribute names -> values.
 java.lang.String getAttributeValue(java.lang.String attr)
          Returns the value of an attribute.
 
Methods inherited from class org.openid4java.message.sreg.SRegMessage
getExtension, getParameters, getParameterValue, getTypeUri, multivalDecode, multivalEncode, providesIdentifier, setParameters, setTypeUri, signRequired
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SREG_FIELDS

protected static final java.util.List SREG_FIELDS
Constructor Detail

SRegResponse

protected SRegResponse()
Constructs a SReg Response with an empty parameter list.


SRegResponse

protected SRegResponse(ParameterList params)
Constructs a SReg Response from a parameter list.

The parameter list can be extracted from a received message with the getExtensionParams method of the Message class, and MUST NOT contain the "openid.." prefix.

Method Detail

createFetchResponse

public static SRegResponse createFetchResponse()
Constructs a SReg Response with an empty parameter list.


createSRegResponse

public static SRegResponse createSRegResponse(ParameterList params)
                                       throws MessageException
Throws:
MessageException

createSRegResponse

public static SRegResponse createSRegResponse(SRegRequest req,
                                              java.util.Map userData)
                                       throws MessageException
Creates a SRegResponse from a SRegRequest message and the data released by the user.

Parameters:
req - SRegRequest message.
userData - Map with the data released by the user.
Returns:
Properly formed SRegResponse.
Throws:
MessageException - if any attribute-name in the userData map does not correspond to an SREG field-name.

addAttribute

public void addAttribute(java.lang.String attr,
                         java.lang.String value)
                  throws MessageException
Adds an attribute to the SReg response. The allowed attribute names are the ones defined in the SReg specification: nickname, email, fullname, dob, gender, postcode, country, language, timezone.

Parameters:
attr - An attribute name.
value - The value of the attribute.
Throws:
MessageException

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String attr)
Returns the value of an attribute.

Parameters:
attr - The attribute name.
Returns:
The attribute value.

getAttributeNames

public java.util.List getAttributeNames()
Gets a list of attribute names in the SReg response.


getAttributes

public java.util.Map getAttributes()
Gets a map with attribute names -> values.



Copyright © 2011 Sxip. All Rights Reserved.