org.openid4java.message
Class AssociationResponse

java.lang.Object
  extended by org.openid4java.message.Message
      extended by org.openid4java.message.AssociationResponse

public class AssociationResponse
extends Message

The OpenID Association Response message.

Handles OpenID 2.0 and OpenID 1.x messages.

Author:
Marius Scurtescu, Johnny Bufu
See Also:
AssociationSessionType

Field Summary
protected static java.util.List optionalFields
           
protected static java.util.List requiredFields
           
 
Fields inherited from class org.openid4java.message.Message
_destinationUrl, MODE_CANCEL, MODE_IDRES, MODE_SETUP_NEEDED, OPENID2_NS
 
Constructor Summary
protected AssociationResponse(AssociationRequest assocReq, Association assoc)
          Constructs an AssociationResponse for a given association request.
protected AssociationResponse(ParameterList params)
          Constructs an AssociationResponse message from a parameter list.
 
Method Summary
static AssociationResponse createAssociationResponse(AssociationRequest assocReq, Association assoc)
           
static AssociationResponse createAssociationResponse(ParameterList params)
           
 Association getAssociation(DiffieHellmanSession dhSess)
          Generates an Association object from an Association Response.
 java.util.List getRequiredFields()
           
 AssociationSessionType getType()
          Gets the association / session type of the association response.
 boolean isVersion2()
          Returns true for OpenID 2.0 messages, false otherwise.
 void setAssocHandle(java.lang.String handle)
          Sets the handle of the association.
 void setExpire(java.lang.Long seconds)
          Sets the lifetime, in seconds, of the association.
 void setMacKey(java.lang.String key)
          Sets the unecrtypted MAC key of the association.
 void setMacKeyEnc(java.lang.String key)
          Sets the encrypted MAC key of the association.
 void setPublicKey(java.lang.String key)
          Sets the OP's (server's) public key for the association.
 void setType(AssociationSessionType type)
          Sets the association / session type for the association response.
 void validate()
          Checks if the message is a valid OpenID Association Response..
 
Methods inherited from class org.openid4java.message.Message
addExtension, addExtensionFactory, createMessage, createMessage, getDestinationUrl, getExtension, getExtensionAlias, getExtensionFactory, getExtensions, getParameter, getParameterMap, getParameters, getParameterValue, hasExtension, hasExtensionFactory, hasParameter, keyValueFormEncoding, set, wwwFormEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requiredFields

protected static final java.util.List requiredFields

optionalFields

protected static final java.util.List optionalFields
Constructor Detail

AssociationResponse

protected AssociationResponse(AssociationRequest assocReq,
                              Association assoc)
                       throws AssociationException
Constructs an AssociationResponse for a given association request.

Parameters:
assocReq - The association request that needs to be responded.
assoc - The association which will be used to sign authentication responses.
Throws:
AssociationException

AssociationResponse

protected AssociationResponse(ParameterList params)
Constructs an AssociationResponse message from a parameter list.

Useful for processing incoming messages.

Method Detail

createAssociationResponse

public static AssociationResponse createAssociationResponse(AssociationRequest assocReq,
                                                            Association assoc)
                                                     throws MessageException,
                                                            AssociationException
Throws:
MessageException
AssociationException

createAssociationResponse

public static AssociationResponse createAssociationResponse(ParameterList params)
                                                     throws MessageException
Throws:
MessageException

getRequiredFields

public java.util.List getRequiredFields()
Overrides:
getRequiredFields in class Message

isVersion2

public boolean isVersion2()
Returns true for OpenID 2.0 messages, false otherwise.


setType

public void setType(AssociationSessionType type)
Sets the association / session type for the association response.


getType

public AssociationSessionType getType()
                               throws AssociationException
Gets the association / session type of the association response.

Throws:
AssociationException

setAssocHandle

public void setAssocHandle(java.lang.String handle)
Sets the handle of the association.


setExpire

public void setExpire(java.lang.Long seconds)
Sets the lifetime, in seconds, of the association.


setMacKey

public void setMacKey(java.lang.String key)
Sets the unecrtypted MAC key of the association.

Should be called only for association responses using no-encryption sessions.

Parameters:
key - The unencrypted MAC key.

setPublicKey

public void setPublicKey(java.lang.String key)
Sets the OP's (server's) public key for the association.

Parameters:
key - The server's public key for the association.

setMacKeyEnc

public void setMacKeyEnc(java.lang.String key)
Sets the encrypted MAC key of the association.

Should be called only for association responses using Diffie-Hellman sessions.

Parameters:
key - The encrypted MAC key.

validate

public void validate()
              throws MessageException
Checks if the message is a valid OpenID Association Response..

Overrides:
validate in class Message
Throws:
MessageException - if message validation failed.

getAssociation

public Association getAssociation(DiffieHellmanSession dhSess)
                           throws AssociationException
Generates an Association object from an Association Response.

Parameters:
dhSess - The Diffie-Helman session containing the private key used to encrypt / decrypt the MAC key exchange. Should be null for no-encryption sessions.
Throws:
AssociationException


Copyright © 2011 Sxip. All Rights Reserved.