net.geant.edugain.base
Class AttributeRequest

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

public class AttributeRequest
extends Request
implements java.io.Serializable

A request for attributes pertaining to a certain subject. It must contain the handle corresponding to the subject, a list of attribute identifiers requested, and a resource/service identifier.

This class extends Request.

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

Field Summary
protected  java.util.ArrayList<javax.xml.namespace.QName> attributeNameList
          A list of the attribute names whose values are requested.
protected  java.lang.String homeSite
          The home site of the user where the request is going to be solved.
protected  java.net.URI referred
          The URI from where the requester has been redirected to this service.
protected  java.lang.String subjectHandle
          The identification string obtained upon the last successful authentication of the subject requesting access to the resource.
 
Fields inherited from class net.geant.edugain.base.Request
cacheReference, consumerId, issued, log, producerId, requestID, resource, samlObject, strictMode, validator
 
Constructor Summary
AttributeRequest()
          Creates a new instance of AttributeRequest
AttributeRequest(boolean strict)
          Creates a new instance of AttributeRequest
AttributeRequest(org.w3c.dom.Element element)
          Creates a new instance of AttributeRequest, filling the fields with the SAML document from an Element.
AttributeRequest(org.w3c.dom.Element element, boolean strict)
          Creates a new instance of AttributeRequest, filling the fields with the SAML document from an Element.
AttributeRequest(java.io.InputStream stream)
          Creates a new instance of AttributeRequest, filling the fields with the SAML document from an InputStream.
AttributeRequest(java.io.InputStream stream, boolean strict)
          Creates a new instance of AttributeRequest, filling the fields with the SAML document from an InputStream.
AttributeRequest(org.opensaml.saml2.core.RequestAbstractType request)
          Creates a new instance of AttributeRequest, filling the fields with the SAML 2 Request data received.
AttributeRequest(org.opensaml.SAMLRequest request)
          Creates a new instance of AttributeRequest, filling the fields with the SAMLRequest data received.
AttributeRequest(org.opensaml.SAMLRequest request, boolean strict)
          Creates a new instance of AttributeRequest, filling the fields with the SAMLRequest data received
 
Method Summary
 void addAttributeName(java.lang.String namespace, java.lang.String name)
          Adds the specified action to the current list.
 void fromSAML(org.opensaml.saml2.core.RequestAbstractType request)
          Fill this AttributeRequest from a SAML 2 Request
 void fromSAML(org.opensaml.SAMLRequest request)
          Fill this AttributeRequest from a SAMLRequest.
 java.util.ArrayList<javax.xml.namespace.QName> getAttributeNameList()
          Get values for the AttributeNameList
 java.lang.String getHomeSite()
          Gets the value of the HomeSite
 java.net.URI getReferred()
          Gets the URI from where the requester was redirected to this service
 java.lang.String getSubjectHandle()
          Gets the value of the SubjectHandle
 void setAttributeNameList(java.util.ArrayList<javax.xml.namespace.QName> list)
          Set values for the AttributeNameList
 void setHomeSite(java.lang.String homesite)
          Sets the HomeSite
 void setReferred(java.net.URI ref)
          Sets the URI from where the requester was redirected to this service
 void setSubjectHandle(java.lang.String handle)
          Sets the subject handle
 java.lang.Object toSAML()
          Converts the eduGAIN AttributeRequest object into a SAML request.
 org.opensaml.SAMLRequest toSAML1(int minor)
          Map the current AttributeRequest to a SAML 1.X response.
private  org.opensaml.saml2.core.RequestAbstractType toSAML2(int minor)
          Map the current AttributeRequest to a SAML 2.X response.
 
Methods inherited from class net.geant.edugain.base.Request
fromSAML, generateRequestID, getCacheReference, getConsumerId, getIssued, getProducerId, getRequestID, getResource, isStrict, setCacheReference, setConsumerId, setIssued, setProducerId, setRequestID, setResource, setStrict, setValidator, toBase64, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

subjectHandle

protected java.lang.String subjectHandle
The identification string obtained upon the last successful authentication of the subject requesting access to the resource.


attributeNameList

protected java.util.ArrayList<javax.xml.namespace.QName> attributeNameList
A list of the attribute names whose values are requested. If no AttributeNameList is included in a request, all "available" (those that can be released according to the applicable policy) attributes are requested. [optional]


homeSite

protected java.lang.String homeSite
The home site of the user where the request is going to be solved. This value corresponds to the ConnectTo value in the HomeLocationRequest operation.


referred

protected java.net.URI referred
The URI from where the requester has been redirected to this service.

Constructor Detail

AttributeRequest

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

Throws:
BaseException

AttributeRequest

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

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

AttributeRequest

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

Parameters:
stream - The InputStream.
Throws:
BaseException

AttributeRequest

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

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

AttributeRequest

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

Parameters:
element - The Element.
Throws:
BaseException

AttributeRequest

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

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

AttributeRequest

public AttributeRequest(org.opensaml.SAMLRequest request)
                 throws BaseException
Creates a new instance of AttributeRequest, filling the fields with the SAMLRequest data received.

Parameters:
request - The original SAML request.
Throws:
BaseException

AttributeRequest

public AttributeRequest(org.opensaml.SAMLRequest request,
                        boolean strict)
                 throws BaseException
Creates a new instance of AttributeRequest, filling the fields with the SAMLRequest data received

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

AttributeRequest

public AttributeRequest(org.opensaml.saml2.core.RequestAbstractType request)
                 throws BaseException
Creates a new instance of AttributeRequest, filling the fields with the SAML 2 Request data received.

Parameters:
request - The original SAML request.
Throws:
BaseException
Method Detail

setSubjectHandle

public void setSubjectHandle(java.lang.String handle)
Sets the subject handle


getSubjectHandle

public java.lang.String getSubjectHandle()
Gets the value of the SubjectHandle


getAttributeNameList

public java.util.ArrayList<javax.xml.namespace.QName> getAttributeNameList()
Get values for the AttributeNameList


addAttributeName

public void addAttributeName(java.lang.String namespace,
                             java.lang.String name)
Adds the specified action to the current list.


setAttributeNameList

public void setAttributeNameList(java.util.ArrayList<javax.xml.namespace.QName> list)
Set values for the AttributeNameList


setHomeSite

public void setHomeSite(java.lang.String homesite)
Sets the HomeSite


getHomeSite

public java.lang.String getHomeSite()
Gets the value of the HomeSite


setReferred

public void setReferred(java.net.URI ref)
Sets the URI from where the requester was redirected to this service


getReferred

public java.net.URI getReferred()
Gets the URI from where the requester was redirected to this service


fromSAML

public void fromSAML(org.opensaml.SAMLRequest request)
              throws BaseException
Fill this AttributeRequest from a SAMLRequest.

Specified by:
fromSAML in class Request
Parameters:
request - The SAMLRequest
Throws:
BaseException

fromSAML

public void fromSAML(org.opensaml.saml2.core.RequestAbstractType request)
              throws BaseException
Fill this AttributeRequest from a SAML 2 Request

Specified by:
fromSAML in class Request
Parameters:
request - The SAML 2 Request
Throws:
BaseException

toSAML

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

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

toSAML1

public org.opensaml.SAMLRequest toSAML1(int minor)
                                 throws BaseException
Map the current AttributeRequest to a SAML 1.X response.

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

toSAML2

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

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