org.openid4java.message.pape
Class PapeResponse

java.lang.Object
  extended by org.openid4java.message.pape.PapeMessage
      extended by org.openid4java.message.pape.PapeResponse
All Implemented Interfaces:
MessageExtension, MessageExtensionFactory

public class PapeResponse
extends PapeMessage

Implements the extension for OpenID Provider Authentication Policy responses.

Author:
Marius Scurtescu, Johnny Bufu

Field Summary
private static org.apache.commons.logging.Log _log
           
static java.lang.String AUTH_AGE_UNKNOWN
           
private static boolean DEBUG
           
protected static java.util.List PAPE_FIELDS
           
 
Fields inherited from class org.openid4java.message.pape.PapeMessage
_parameters, OPENID_NS_PAPE, PAPE_POLICY_MULTI_FACTOR, PAPE_POLICY_MULTI_FACTOR_PHYSICAL, PAPE_POLICY_PHISHING_RESISTANT
 
Constructor Summary
protected PapeResponse()
          Constructs a Pape Response with an empty parameter list.
protected PapeResponse(ParameterList params)
          Constructs a Pape Response from a parameter list.
 
Method Summary
 void addAuthPolicy(java.lang.String policyUri)
          Adds an authentication policy URI to the auth_policies parameter.
static PapeResponse createPapeResponse()
          Constructs a Pape Response with an empty parameter list.
static PapeResponse createPapeResponse(ParameterList params)
           
 int getAuthAge()
          Gets the value of the auth_age parameter.
 java.lang.String getAuthPolicies()
          Gets the auth_policies parameter value.
 java.util.List getAuthPoliciesList()
          Gets a list with the auth_policies.
 int getNistAuthLevel()
          Gets the value of the nist_auth_level parameter.
private  boolean isValid()
          Checks the validity of the extension.
 void setAuthAge(int seconds)
          Sets the auth_age parameter.
 void setAuthPolicies(java.lang.String policyUris)
          Sets a new value for the auth_policies parameter.
 void setNistAuthLevel(int level)
           
 
Methods inherited from class org.openid4java.message.pape.PapeMessage
getExtension, getParameter, getParameters, getParameterValue, getTypeUri, hasParameter, providesIdentifier, set, setParameters
 
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

AUTH_AGE_UNKNOWN

public static final java.lang.String AUTH_AGE_UNKNOWN
See Also:
Constant Field Values

PAPE_FIELDS

protected static final java.util.List PAPE_FIELDS
Constructor Detail

PapeResponse

protected PapeResponse()
Constructs a Pape Response with an empty parameter list.


PapeResponse

protected PapeResponse(ParameterList params)
Constructs a Pape 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

createPapeResponse

public static PapeResponse createPapeResponse()
Constructs a Pape Response with an empty parameter list.


createPapeResponse

public static PapeResponse createPapeResponse(ParameterList params)
                                       throws MessageException
Throws:
MessageException

getAuthPolicies

public java.lang.String getAuthPolicies()
Gets the auth_policies parameter value.


setAuthPolicies

public void setAuthPolicies(java.lang.String policyUris)
Sets a new value for the auth_policies parameter. The previous value of the parameter will be owerwritten.

Parameters:
policyUris - Space separated list of authentication policy URIs to be set.
See Also:
addAuthPolicy(String)

addAuthPolicy

public void addAuthPolicy(java.lang.String policyUri)
Adds an authentication policy URI to the auth_policies parameter.

Parameters:
policyUri - The authentication policy URI to be set.
See Also:
setAuthPolicies(String)

getAuthPoliciesList

public java.util.List getAuthPoliciesList()
Gets a list with the auth_policies. An empty list is returned if no authentication policies exist.


setAuthAge

public void setAuthAge(int seconds)
Sets the auth_age parameter.

Parameters:
seconds - The number of seconds since the user was actively authenticated by the OP, or -1 if the auth_age is unknown.

getAuthAge

public int getAuthAge()
Gets the value of the auth_age parameter.

Returns:
The number of seconds since the user was actively authenticated by the OP. For the special value "unknown" 0 is returned; if the parameter is not present, -1 is returned.

getNistAuthLevel

public int getNistAuthLevel()
Gets the value of the nist_auth_level parameter.

NIST levels are integers between 1 and 4 inclusive. Level 0 is used to signify that the OP recognizes the parameter and the user authentication did not meet the requirements of Level 1.

Returns:
The NIST level, or -1 if the parameter is not set.

setNistAuthLevel

public void setNistAuthLevel(int level)
                      throws MessageException
Throws:
MessageException

isValid

private boolean isValid()
Checks the validity of the extension.

Used when constructing a extension from a parameter list.

Returns:
True if the extension is valid, false otherwise.


Copyright 2006-2007 Sxip Identity Corporation