org.openid4java.message.sreg
Class SRegMessage

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

public class SRegMessage
extends java.lang.Object
implements MessageExtension, MessageExtensionFactory

Base class for the Simple Registration implementation.

Encapsulates:

Considering that: Support for Simple Registration is implemented as follows:

Author:
Marius Scurtescu, Johnny Bufu
See Also:
MessageExtension

Field Summary
private static org.apache.commons.logging.Log _log
           
protected  ParameterList _parameters
          The Simple Registration extension-specific parameters.
private  java.lang.String _typeUri
           
private static boolean DEBUG
           
static java.lang.String OPENID_NS_SREG
          The Simple Registration 1.0 namespace URI.
static java.lang.String OPENID_NS_SREG11
          The Simple Registration 1.1 namespace URI.
 
Constructor Summary
SRegMessage()
          Constructs an empty (no parameters) Simple Registration extension.
SRegMessage(ParameterList params)
          Constructs an Simple Registration extension with a specified list of parameters.
 
Method Summary
 MessageExtension getExtension(ParameterList parameterList, boolean isRequest)
          Instantiates the apropriate Simple Registration object (request / response) for the supplied parameter list.
 ParameterList getParameters()
          Gets ParameterList containing the Simple Registration extension-specific parameters.
 java.lang.String getParameterValue(java.lang.String name)
          Gets a the value of the parameter with the specified name.
 java.lang.String getTypeUri()
          Gets the Type URI that identifies the Simple Registration extension.
 java.lang.String multivalDecode(java.lang.String value)
          Decodes a string value according to the conventions for supporting multiple values for a parameter (commas and backslashes are escaped).
 java.lang.String multivalEncode(java.lang.String value)
          Encodes a string value according to the conventions for supporting multiple values for a parameter (commas and backslashes are escaped).
 boolean providesIdentifier()
          Simple Registration doesn't implement authentication services.
 void setParameters(ParameterList params)
          Sets the extension's parameters to the supplied list.
 void setTypeUri(java.lang.String typeUri)
          Sets the SREG type URI.
 boolean signRequired()
          Simple registration parameters are REQUIRED to be signed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

private static org.apache.commons.logging.Log _log

DEBUG

private static final boolean DEBUG

OPENID_NS_SREG

public static final java.lang.String OPENID_NS_SREG
The Simple Registration 1.0 namespace URI.

See Also:
Constant Field Values

OPENID_NS_SREG11

public static final java.lang.String OPENID_NS_SREG11
The Simple Registration 1.1 namespace URI.

See Also:
Constant Field Values

_parameters

protected ParameterList _parameters
The Simple Registration extension-specific parameters.

The openid. prefix is not part of the parameter names


_typeUri

private java.lang.String _typeUri
Constructor Detail

SRegMessage

public SRegMessage()
Constructs an empty (no parameters) Simple Registration extension.


SRegMessage

public SRegMessage(ParameterList params)
Constructs an Simple Registration extension with a specified list of parameters.

The parameter names in the list should not contain the openid..

Method Detail

getTypeUri

public java.lang.String getTypeUri()
Gets the Type URI that identifies the Simple Registration extension.

Specified by:
getTypeUri in interface MessageExtension
Specified by:
getTypeUri in interface MessageExtensionFactory

setTypeUri

public void setTypeUri(java.lang.String typeUri)
Sets the SREG type URI. Hack to support both SREG 1.0 and 1.1, until 1.1 spec gets fixed.


getParameters

public ParameterList getParameters()
Gets ParameterList containing the Simple Registration extension-specific parameters.

The openid. prefix is not part of the parameter names, as it is handled internally by the Message class.

The openid.ns. parameter is also handled by the Message class.

Specified by:
getParameters in interface MessageExtension
See Also:
Message

getParameterValue

public java.lang.String getParameterValue(java.lang.String name)
Gets a the value of the parameter with the specified name.

Parameters:
name - The name of the parameter, without the openid. prefix.
Returns:
The parameter value, or null if not found.

setParameters

public void setParameters(ParameterList params)
Sets the extension's parameters to the supplied list.

The parameter names in the list should not contain the openid. prefix.

Specified by:
setParameters in interface MessageExtension
See Also:
Message

multivalEncode

public java.lang.String multivalEncode(java.lang.String value)
Encodes a string value according to the conventions for supporting multiple values for a parameter (commas and backslashes are escaped).

Parameters:
value - String value to be encoded.
Returns:
The encoded value.

multivalDecode

public java.lang.String multivalDecode(java.lang.String value)
Decodes a string value according to the conventions for supporting multiple values for a parameter (commas and backslashes are escaped).

Parameters:
value - String value to be decoded.
Returns:
The dencoded value.

providesIdentifier

public boolean providesIdentifier()
Simple Registration doesn't implement authentication services.

Specified by:
providesIdentifier in interface MessageExtension
Returns:
false

signRequired

public boolean signRequired()
Simple registration parameters are REQUIRED to be signed.

Specified by:
signRequired in interface MessageExtension
Returns:
true

getExtension

public MessageExtension getExtension(ParameterList parameterList,
                                     boolean isRequest)
                              throws MessageException
Instantiates the apropriate Simple Registration object (request / response) for the supplied parameter list.

Specified by:
getExtension in interface MessageExtensionFactory
Parameters:
parameterList - The Simple Registration specific parameters (without the openid. prefix) extracted from the openid message.
isRequest - Indicates whether the parameters were extracted from an OpenID request (true), or from an OpenID response.
Returns:
MessageExtension implementation for the supplied extension parameters.
Throws:
MessageException - If a Simple Registration object could not be instantiated from the supplied parameter list.


Copyright 2006-2008 Sxip Identity Corporation