net.geant.edugain.base
Class AuthenticationResponse

java.lang.Object
  extended by net.geant.edugain.base.Response
      extended by net.geant.edugain.base.AuthenticationResponse
All Implemented Interfaces:
java.io.Serializable

public class AuthenticationResponse
extends Response
implements java.io.Serializable

A response containing authentication data according to a previously issued AuthNReq. It must contain an anonymised handle to allow further attribute requests, and may contain any other attributes about the entity that originated the request, according to service and privacy policies.

This class extends Response.

Since:
1.0
Author:
Jose Manuel Macias, Jaime Perez
See Also:
Serialized Form

Field Summary
private  java.util.ArrayList<AttributeValues> attributeValueList
           
private  java.lang.String subjectHandle
           
 
Fields inherited from class net.geant.edugain.base.Response
additionalData, consumerId, EDUGAIN_NAMESPACE_RESULT_ACCEPTED, EDUGAIN_NAMESPACE_RESULT_CONNECT_TO, EDUGAIN_NAMESPACE_RESULT_DENY, EDUGAIN_NAMESPACE_RESULT_EXPIRED_MESSAGE, EDUGAIN_NAMESPACE_RESULT_FAULT, EDUGAIN_NAMESPACE_RESULT_INCOMPATIBLE_VERSIONS, EDUGAIN_NAMESPACE_RESULT_INSUFFICIENT_DATA, EDUGAIN_NAMESPACE_RESULT_INVALID_CREDENTIALS, EDUGAIN_NAMESPACE_RESULT_MALFORMED_MESSAGE, EDUGAIN_NAMESPACE_RESULT_REDIRECT_USER_TO, EDUGAIN_NAMESPACE_RESULT_TRUST_ERROR, EDUGAIN_NAMESPACE_RESULT_UNKNOWN_HOMESITE, errorMessage, errorReason, inResponseTo, interfaces, issued, log, notBefore, notOnOrAfter, producerId, recipient, responseID, result, resultMessage, samlObject, strictMode, validator
 
Constructor Summary
AuthenticationResponse()
          Creates a new instance of AuthenticationResponse
AuthenticationResponse(boolean strict)
          Creates a new instance of AuthenticationResponse
AuthenticationResponse(org.w3c.dom.Element element)
          Creates a new instance of AuthenticationResponse, filling the fields with the SAML document from an Element.
AuthenticationResponse(org.w3c.dom.Element element, boolean strict)
          Creates a new instance of AuthenticationResponse, filling the fields with the SAML document from an Element.
AuthenticationResponse(java.io.InputStream stream)
          Creates a new instance of AuthenticationResponse, filling the fields with the SAML document from an InputStream.
AuthenticationResponse(java.io.InputStream stream, boolean strict)
          Creates a new instance of AuthenticationResponse, filling the fields with the SAML document from an InputStream.
AuthenticationResponse(org.opensaml.saml2.core.Response rsp)
          Creates a new instance of AuthenticationResponse, filling the fields with the Response data received.
AuthenticationResponse(org.opensaml.SAMLResponse rsp)
          Creates a new instance of AuthenticationResponse, filling the fields with the SAMLResponse data received.
AuthenticationResponse(org.opensaml.SAMLResponse rsp, boolean strict)
          Creates a new instance of AuthenticationResponse, filling the fields with the SAMLResponse data received.
 
Method Summary
 void addAttributeValue(AttributeValues values)
          Adds the specified attribute-value to the current list.
 void addAttributeValue(java.lang.String namespace, java.lang.String name, java.lang.String[] values)
          Adds the specified attribute-value to the current list.
 void fromSAML(org.opensaml.saml2.core.Response response)
          Fill this AuthenticationResponse with a SAML 2 Response
 void fromSAML(org.opensaml.SAMLResponse response)
          Fill this AuthenticationResponse with a SAMLResponse.
 java.util.ArrayList<AttributeValues> getAttributeValueList()
          Returns a list of elements, each of them corresponding to one attribute that the identity is willing to deliver upon successful authentication
 java.lang.String getSubjectHandle()
          Returns identification string returned upon successfull authentication
 void setAttributeValueList(java.util.ArrayList<AttributeValues> attributeValueList)
          Sets the list of elements - each of them corresponding to one attribute- that the identity is willing to deliver upon successful authentication
 void setSubjectHandle(java.lang.String subjectHandle)
          Sets the identification string returned upon successfull authentication
 java.lang.Object toSAML()
          Converts this response object into a SAML response.
private  org.opensaml.SAMLResponse toSAML1(int minor)
          Map the current AuthenticationResponse to a SAML 1.X response.
private  org.opensaml.saml2.core.Response toSAML2(int minor)
          Map the current AuthenticationResponse to a SAML 2.X response.
 
Methods inherited from class net.geant.edugain.base.Response
addInterface, fromSAML, generateResponseID, getAdditionalData, getConsumerId, getInResponseTo, getInterfaces, getIssued, getNotBefore, getNotOnOrAfter, getProducerId, getRecipient, getResponseID, getResult, getResultMessage, isStrict, setAdditionalData, setConsumerId, setInResponseTo, setInterfaces, setIssued, setNotBefore, setNotOnOrAfter, setProducerId, setRecipient, setResponseID, setResult, setResultMessage, setStrict, setValidator, toBase64, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attributeValueList

private java.util.ArrayList<AttributeValues> attributeValueList

subjectHandle

private java.lang.String subjectHandle
Constructor Detail

AuthenticationResponse

public AuthenticationResponse()
                       throws BaseException
Creates a new instance of AuthenticationResponse

Throws:
BaseException

AuthenticationResponse

public AuthenticationResponse(boolean strict)
                       throws BaseException
Creates a new instance of AuthenticationResponse

Parameters:
strict - Whether to use strict mode or not.
Throws:
BaseException

AuthenticationResponse

public AuthenticationResponse(java.io.InputStream stream)
                       throws BaseException
Creates a new instance of AuthenticationResponse, filling the fields with the SAML document from an InputStream.

Parameters:
stream - The InputStream.
Throws:
BaseException

AuthenticationResponse

public AuthenticationResponse(java.io.InputStream stream,
                              boolean strict)
                       throws BaseException
Creates a new instance of AuthenticationResponse, filling the fields with the SAML document from an InputStream.

Parameters:
stream - The InputStream.
strict - Whether to use strict mode or not.
Throws:
BaseException

AuthenticationResponse

public AuthenticationResponse(org.w3c.dom.Element element)
                       throws BaseException
Creates a new instance of AuthenticationResponse, filling the fields with the SAML document from an Element.

Parameters:
element - The Element.
Throws:
BaseException

AuthenticationResponse

public AuthenticationResponse(org.w3c.dom.Element element,
                              boolean strict)
                       throws BaseException
Creates a new instance of AuthenticationResponse, filling the fields with the SAML document from an Element.

Parameters:
element - The Element.
strict - Whether to use strict mode or not.
Throws:
BaseException

AuthenticationResponse

public AuthenticationResponse(org.opensaml.SAMLResponse rsp)
                       throws BaseException
Creates a new instance of AuthenticationResponse, filling the fields with the SAMLResponse data received.

Parameters:
rsp - The original SAML response.
Throws:
BaseException

AuthenticationResponse

public AuthenticationResponse(org.opensaml.SAMLResponse rsp,
                              boolean strict)
                       throws BaseException
Creates a new instance of AuthenticationResponse, filling the fields with the SAMLResponse data received.

Parameters:
rsp - The original SAML response.
strict - Whether to use strict mode or not.
Throws:
BaseException

AuthenticationResponse

public AuthenticationResponse(org.opensaml.saml2.core.Response rsp)
                       throws BaseException
Creates a new instance of AuthenticationResponse, filling the fields with the Response data received.

Parameters:
rsp - The original SAML 2 response.
Throws:
BaseException
Method Detail

getAttributeValueList

public java.util.ArrayList<AttributeValues> getAttributeValueList()
Returns a list of elements, each of them corresponding to one attribute that the identity is willing to deliver upon successful authentication


addAttributeValue

public void addAttributeValue(java.lang.String namespace,
                              java.lang.String name,
                              java.lang.String[] values)
Adds the specified attribute-value to the current list.

Parameters:
namespace - The namespace of the attribute.
name - The name of the attribute.
values - A set of values for the attribute.

addAttributeValue

public void addAttributeValue(AttributeValues values)
Adds the specified attribute-value to the current list.

Parameters:
values - The AttributeValues to add.

setAttributeValueList

public void setAttributeValueList(java.util.ArrayList<AttributeValues> attributeValueList)
Sets the list of elements - each of them corresponding to one attribute- that the identity is willing to deliver upon successful authentication


getSubjectHandle

public java.lang.String getSubjectHandle()
Returns identification string returned upon successfull authentication


setSubjectHandle

public void setSubjectHandle(java.lang.String subjectHandle)
Sets the identification string returned upon successfull authentication


fromSAML

public void fromSAML(org.opensaml.SAMLResponse response)
              throws BaseException
Fill this AuthenticationResponse with a SAMLResponse.

Specified by:
fromSAML in class Response
Parameters:
response - The SAML response.
Throws:
BaseException

fromSAML

public void fromSAML(org.opensaml.saml2.core.Response response)
              throws BaseException
Fill this AuthenticationResponse with a SAML 2 Response

Specified by:
fromSAML in class Response
Throws:
BaseException

toSAML

public java.lang.Object toSAML()
                        throws BaseException
Converts this response object into a SAML response. Please consider that this method returns an OpenSAML1 or an OpenSAML2 Response object depending on the SAML version eduGAIN is configured to use.

Specified by:
toSAML in class Response
Returns:
A SAMLResponse or a Response, depending on the SAML version eduGAIN is configured to use.
Throws:
BaseException

toSAML1

private org.opensaml.SAMLResponse toSAML1(int minor)
                                   throws BaseException
Map the current AuthenticationResponse to a SAML 1.X response.

Parameters:
minor - The minor version number (can be 0 or 1).
Returns:
The SAMLResponse that corresponds with this AuthenticationResponse.
Throws:
BaseException

toSAML2

private org.opensaml.saml2.core.Response toSAML2(int minor)
                                          throws BaseException
Map the current AuthenticationResponse to a SAML 2.X response.

Parameters:
minor - The minor version number (can be 0 or 1).
Returns:
The Response that corresponds with this AuthenticationResponse.
Throws:
BaseException