net.geant.edugain.base
Class AuthenticationRequest

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

public class AuthenticationRequest
extends Request
implements java.io.Serializable

A request for authentication data about the subject requesting a service. It may imply a redirection to the home domain in order to perform a direct exchange of credentials.

This class extends Request.

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

Field Summary
private  java.lang.String authenticatingPrincipal
          A string (simple or in URN format) that identifies the principal [username/object] that is requesting the authentication.
private  java.net.URI authenticationMethod
          URI that identifies a authentication method (e.g.
private  java.lang.String authnType
          A identification of the protocol used in the authentication.
private  java.util.ArrayList<HomeLocator> homeLocators
          A list of data that will be used by the Metadata Service to evaluate the request.
protected  java.lang.String homeSite
          The home site of the user where the request is going to be solved.
protected  java.net.URI shire
          The URI from where the requester has been redirected to this service.
 
Fields inherited from class net.geant.edugain.base.Request
cacheReference, consumerId, issued, log, producerId, requestID, resource, samlObject, strictMode, validator
 
Constructor Summary
AuthenticationRequest()
          Creates a new instance of AuthenticationRequest
AuthenticationRequest(boolean strict)
          Creates a new instance of AuthenticationRequest
AuthenticationRequest(org.w3c.dom.Element element)
          Creates a new instance of AuthenticationRequest, filling the fields with the SAML document from an Element.
AuthenticationRequest(org.w3c.dom.Element element, boolean strict)
          Creates a new instance of AuthenticationRequest, filling the fields with the SAML document from an Element.
AuthenticationRequest(java.io.InputStream stream)
          Creates a new instance of AuthenticationRequest, filling the fields with the SAML document from an InputStream.
AuthenticationRequest(java.io.InputStream stream, boolean strict)
          Creates a new instance of AuthenticationRequest, filling the fields with the SAML document from an InputStream.
AuthenticationRequest(org.opensaml.saml2.core.RequestAbstractType request)
          Creates a new instance of AuthenticationRequest, filling the fields with the SAML 2 Request data received.
AuthenticationRequest(org.opensaml.SAMLRequest request)
          Creates a new instance of AuthenticationRequest, filling the fields with the SAMLRequest data received.
AuthenticationRequest(org.opensaml.SAMLRequest request, boolean strict)
          Creates a new instance of AuthenticationRequest, filling the fields with the SAMLRequest data received
 
Method Summary
 void addHomeLocator(HomeLocator locator)
          Adds the specified home locator to the current list.
 void fromSAML(org.opensaml.saml2.core.RequestAbstractType request)
          Fill this AuthenticationRequest from a SAML 2 Request
 void fromSAML(org.opensaml.SAMLRequest request)
          Fill this AuthenticationRequest from a SAMLRequest.
 java.lang.String getAuthenticatingPrincipal()
          Gets the reference of the subject (principal) that is requesting the authentication.
 java.net.URI getAuthMethod()
          Gets the authentication method to be used
 java.lang.String getAuthType()
          Returns the value of the authentication type field
 java.util.ArrayList<HomeLocator> getHomeLocators()
          Returns the list of home locators
 java.lang.String getHomeSite()
          Gets the value of the HomeSite
 java.net.URI getShire()
          Gets the URI from where the requester was redirected to this service
 void setAuthenticatingPrincipal(java.lang.String principal)
          Sets the reference for the subject (principal) that is requesting the authentication.
 void setAuthMethod(java.net.URI method)
          Sets the authentication method to be used
 void setAuthType(java.lang.String authType)
          Sets a value for the authentication type field
 void setHomeLocators(java.util.ArrayList<HomeLocator> homeLocators)
          Sets the list of home locators
 void setHomeSite(java.lang.String homesite)
          Sets the HomeSite
 void setShire(java.net.URI ref)
          Sets the URI from where the requester was redirected to this service
 java.lang.Object toSAML()
          Converts the eduGAIN AuthenticationRequest object into a SAML request.
 org.opensaml.SAMLRequest toSAML1(int minor)
          Map the current AuthenticationRequest to a SAML 1.X response.
private  org.opensaml.saml2.core.Response toSAML2(int minor)
          Map the current AuthenticationRequest 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

authnType

private java.lang.String authnType
A identification of the protocol used in the authentication.


authenticationMethod

private java.net.URI authenticationMethod
URI that identifies a authentication method (e.g. password, PKI) to be used to authenticate the subject.


authenticatingPrincipal

private java.lang.String authenticatingPrincipal
A string (simple or in URN format) that identifies the principal [username/object] that is requesting the authentication.


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.


shire

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


homeLocators

private java.util.ArrayList<HomeLocator> homeLocators
A list of data that will be used by the Metadata Service to evaluate the request. Each individual locator consists of an attribute-value pair.

Constructor Detail

AuthenticationRequest

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

Throws:
BaseException

AuthenticationRequest

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

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

AuthenticationRequest

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

Parameters:
stream - The InputStream.
Throws:
BaseException

AuthenticationRequest

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

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

AuthenticationRequest

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

Parameters:
element - The Element.
Throws:
BaseException

AuthenticationRequest

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

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

AuthenticationRequest

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

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

AuthenticationRequest

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

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

AuthenticationRequest

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

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

setAuthMethod

public void setAuthMethod(java.net.URI method)
Sets the authentication method to be used


getAuthMethod

public java.net.URI getAuthMethod()
Gets the authentication method to be used


setAuthenticatingPrincipal

public void setAuthenticatingPrincipal(java.lang.String principal)
Sets the reference for the subject (principal) that is requesting the authentication.


getAuthenticatingPrincipal

public java.lang.String getAuthenticatingPrincipal()
Gets the reference of the subject (principal) that is requesting the authentication.


setHomeSite

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


getHomeSite

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


setShire

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


getShire

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


getAuthType

public java.lang.String getAuthType()
Returns the value of the authentication type field


setAuthType

public void setAuthType(java.lang.String authType)
Sets a value for the authentication type field


getHomeLocators

public java.util.ArrayList<HomeLocator> getHomeLocators()
Returns the list of home locators


addHomeLocator

public void addHomeLocator(HomeLocator locator)
Adds the specified home locator to the current list.


setHomeLocators

public void setHomeLocators(java.util.ArrayList<HomeLocator> homeLocators)
Sets the list of home locators


fromSAML

public void fromSAML(org.opensaml.SAMLRequest request)
              throws BaseException
Fill this AuthenticationRequest 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 AuthenticationRequest 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 AuthenticationRequest 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 AuthenticationRequest to a SAML 1.X response.

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

toSAML2

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

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