Class HTTPRedirectBinding
Supports the HTTP redirect binding.
Inheritance
Inherited Members
Namespace: ComponentSpace.SAML2.Bindings
Assembly: ComponentSpace.Saml2.dll
Syntax
public static class HTTPRedirectBinding
Remarks
Refer to the Bindings for the OASIS Security Assertion Markup Language (SAML) V2.0 specification for further details.
Methods
CreateRequestRedirectURL(String, XmlElement, String, AsymmetricAlgorithm)
Creates the redirect URL containing the SAML request and optional relay state and generated signature query string parameters.
Declaration
public static string CreateRequestRedirectURL(string baseURL, XmlElement samlMessage, string relayState, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseURL | The base URL to which the query string parameters are appended. |
System.Xml.XmlElement | samlMessage | The SAML request. |
System.String | relayState | The relay state or |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to generate the signature or |
Returns
Type | Description |
---|---|
System.String | The redirect URL. |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the URL cannot be created. |
CreateRequestRedirectURL(String, XmlElement, String, AsymmetricAlgorithm, String)
Creates the redirect URL containing the SAML request and optional relay state and generated signature query string parameters.
Declaration
public static string CreateRequestRedirectURL(string baseURL, XmlElement samlMessage, string relayState, AsymmetricAlgorithm key, string signatureAlgorithm)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseURL | The base URL to which the query string parameters are appended. |
System.Xml.XmlElement | samlMessage | The SAML request. |
System.String | relayState | The relay state or |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to generate the signature or |
System.String | signatureAlgorithm | The signature algorithm or |
Returns
Type | Description |
---|---|
System.String | The redirect URL. |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the URL cannot be created. |
CreateResponseRedirectURL(String, XmlElement, String, AsymmetricAlgorithm)
Creates the redirect URL containing the SAML response and optional relay state and generated signature query string parameters.
Declaration
public static string CreateResponseRedirectURL(string baseURL, XmlElement samlMessage, string relayState, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseURL | The base URL to which the query string parameters are appended. |
System.Xml.XmlElement | samlMessage | The SAML response. |
System.String | relayState | The relay state or |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to generate the signature or |
Returns
Type | Description |
---|---|
System.String | The redirect URL. |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the URL cannot be created. |
CreateResponseRedirectURL(String, XmlElement, String, AsymmetricAlgorithm, String)
Creates the redirect URL containing the SAML response and optional relay state and generated signature query string parameters.
Declaration
public static string CreateResponseRedirectURL(string baseURL, XmlElement samlMessage, string relayState, AsymmetricAlgorithm key, string signatureAlgorithm)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseURL | The base URL to which the query string parameters are appended. |
System.Xml.XmlElement | samlMessage | The SAML response. |
System.String | relayState | The relay state or |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to generate the signature or |
System.String | signatureAlgorithm | The signature algorithm or |
Returns
Type | Description |
---|---|
System.String | The redirect URL. |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the URL cannot be created. |
GetMessageFromRedirectURL(String, out XmlElement, out String, out Boolean, out Boolean, AsymmetricAlgorithm)
Extracts the SAML request or response and optional relay state from the redirect URL's query string.
Declaration
public static void GetMessageFromRedirectURL(string redirectURL, out XmlElement samlMessage, out string relayState, out bool isRequest, out bool signed, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.String | redirectURL | The HTTP redirect URL including the query string. |
System.Xml.XmlElement | samlMessage | The returned SAML request or response. |
System.String | relayState | The returned relay state or |
System.Boolean | isRequest |
|
System.Boolean | signed | Indicates whether the SAML message is signed. |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to verify the signature or |
Remarks
If a key is supplied and the message is signed then the signature is verified.
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the message and relay state cannot be extracted from the redirect URL. |
SAMLSignatureException | Thrown when the signature verification fails. |
GetRequestFromRedirectURL(String, out XmlElement, out String, out Boolean, AsymmetricAlgorithm)
Extracts the SAML request and optional relay state from the redirect URL's query string.
Declaration
public static void GetRequestFromRedirectURL(string redirectURL, out XmlElement samlMessage, out string relayState, out bool signed, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.String | redirectURL | The HTTP redirect URL including the query string. |
System.Xml.XmlElement | samlMessage | The returned SAML request. |
System.String | relayState | The returned relay state or |
System.Boolean | signed | Indicates whether the SAML request is signed. |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to verify the signature or |
Remarks
If a key is supplied and the message is signed then the signature is verified.
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the message and relay state cannot be extracted from the redirect URL. |
SAMLSignatureException | Thrown when the signature verification fails. |
GetResponseFromRedirectURL(String, out XmlElement, out String, out Boolean, AsymmetricAlgorithm)
Extracts the SAML response and optional relay state from the redirect URL's query string.
Declaration
public static void GetResponseFromRedirectURL(string redirectURL, out XmlElement samlMessage, out string relayState, out bool signed, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.String | redirectURL | The HTTP redirect URL including the query string. |
System.Xml.XmlElement | samlMessage | The returned SAML response. |
System.String | relayState | The returned relay state or |
System.Boolean | signed | Indicates whether the SAML response is signed. |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to verify the signature or |
Remarks
If a key is supplied and the message is signed then the signature is verified.
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the message and relay state cannot be extracted from the redirect URL. |
SAMLSignatureException | Thrown when the signature verification fails. |
ReceiveMessage(HttpRequestBase, out XmlElement, out String, out Boolean, out Boolean, AsymmetricAlgorithm)
Receives the SAML request or response and optional relay state by extracting them from the query string.
Declaration
public static void ReceiveMessage(HttpRequestBase httpRequest, out XmlElement samlMessage, out string relayState, out bool isRequest, out bool signed, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | httpRequest | The HTTP request containing the query string. |
System.Xml.XmlElement | samlMessage | The returned SAML request or response. |
System.String | relayState | The returned relay state or |
System.Boolean | isRequest |
|
System.Boolean | signed | Indicates whether the SAML message is signed. |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to verify the signature or |
Remarks
If a key is supplied and the message is signed then the signature is verified.
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the receive fails. |
SAMLSignatureException | Thrown when the signature verification fails. |
ReceiveMessage(HttpRequestBase, out XmlElement, out String, out String, out String, out Boolean)
Receives the SAML request or response and optional relay state by extracting them from the query string.
Declaration
public static void ReceiveMessage(HttpRequestBase httpRequest, out XmlElement samlMessage, out string relayState, out string signatureAlgorithm, out string signature, out bool isRequest)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | httpRequest | The HTTP request containing the query string. |
System.Xml.XmlElement | samlMessage | The returned SAML request or response. |
System.String | relayState | The returned relay state or |
System.String | signatureAlgorithm | The returned signature algorithm or |
System.String | signature | The returned signature or |
System.Boolean | isRequest |
|
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the receive fails. |
ReceiveRequest(HttpRequestBase, out XmlElement, out String, out Boolean, AsymmetricAlgorithm)
Receives the SAML request and optional relay state by extracting them from the query string.
Declaration
public static void ReceiveRequest(HttpRequestBase httpRequest, out XmlElement samlMessage, out string relayState, out bool signed, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | httpRequest | The HTTP request containing the query string. |
System.Xml.XmlElement | samlMessage | The returned SAML request. |
System.String | relayState | The returned relay state or |
System.Boolean | signed | Indicates whether the SAML request is signed. |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to verify the signature or |
Remarks
If a key is supplied and the message is signed then the signature is verified.
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the receive fails. |
SAMLSignatureException | Thrown when the signature verification fails. |
ReceiveRequest(HttpRequestBase, out XmlElement, out String, out String, out String)
Receives the SAML request and optional relay state by extracting them from the query string.
Declaration
public static void ReceiveRequest(HttpRequestBase httpRequest, out XmlElement samlMessage, out string relayState, out string signatureAlgorithm, out string signature)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | httpRequest | The HTTP request containing the query string. |
System.Xml.XmlElement | samlMessage | The returned SAML request. |
System.String | relayState | The returned relay state or |
System.String | signatureAlgorithm | The returned signature algorithm or |
System.String | signature | The returned signature or |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the receive fails. |
ReceiveResponse(HttpRequestBase, out XmlElement, out String, out Boolean, AsymmetricAlgorithm)
Receives the SAML response and optional relay state by extracting them from the query string.
Declaration
public static void ReceiveResponse(HttpRequestBase httpRequest, out XmlElement samlMessage, out string relayState, out bool signed, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | httpRequest | The HTTP request containing the query string. |
System.Xml.XmlElement | samlMessage | The returned SAML response. |
System.String | relayState | The returned relay state or |
System.Boolean | signed | Indicates whether the SAML response is signed. |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to verify the signature or |
Remarks
If a key is supplied and the message is signed then the signature is verified.
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the receive fails. |
SAMLSignatureException | Thrown when the signature verification fails. |
ReceiveResponse(HttpRequestBase, out XmlElement, out String, out String, out String)
Receives the SAML response and optional relay state by extracting them from the query string.
Declaration
public static void ReceiveResponse(HttpRequestBase httpRequest, out XmlElement samlMessage, out string relayState, out string signatureAlgorithm, out string signature)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | httpRequest | The HTTP request containing the query string. |
System.Xml.XmlElement | samlMessage | The returned SAML response. |
System.String | relayState | The returned relay state or |
System.String | signatureAlgorithm | The returned signature algorithm or |
System.String | signature | The returned signature or |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the receive fails. |
SendRequest(HttpResponseBase, String, XmlElement, String, AsymmetricAlgorithm)
Sends the SAML request and optional relay state and generated signature as query string parameters in an HTTP redirect.
Declaration
public static void SendRequest(HttpResponseBase httpResponse, string baseURL, XmlElement samlMessage, string relayState, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpResponseBase | httpResponse | The HTTP response used to perform the redirect. |
System.String | baseURL | The base URL to which the query string parameters are appended. |
System.Xml.XmlElement | samlMessage | The SAML request. |
System.String | relayState | The relay state or |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to generate the signature or |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the send fails. |
SendRequest(HttpResponseBase, String, XmlElement, String, AsymmetricAlgorithm, String)
Sends the SAML request and optional relay state and generated signature as query string parameters in an HTTP redirect.
Declaration
public static void SendRequest(HttpResponseBase httpResponse, string baseURL, XmlElement samlMessage, string relayState, AsymmetricAlgorithm key, string signatureAlgorithm)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpResponseBase | httpResponse | The HTTP response used to perform the redirect. |
System.String | baseURL | The base URL to which the query string parameters are appended. |
System.Xml.XmlElement | samlMessage | The SAML request. |
System.String | relayState | The relay state or |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to generate the signature or |
System.String | signatureAlgorithm | The signature algorithm or |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the send fails. |
SendResponse(HttpResponseBase, String, XmlElement, String, AsymmetricAlgorithm)
Sends the SAML response and optional relay state and generated signature as query string parameters in an HTTP redirect.
Declaration
public static void SendResponse(HttpResponseBase httpResponse, string baseURL, XmlElement samlMessage, string relayState, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpResponseBase | httpResponse | The HTTP response used to perform the redirect. |
System.String | baseURL | The base URL to which the query string parameters are appended. |
System.Xml.XmlElement | samlMessage | The SAML response. |
System.String | relayState | The relay state or |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to generate the signature or |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the send fails. |
SendResponse(HttpResponseBase, String, XmlElement, String, AsymmetricAlgorithm, String)
Sends the SAML response and optional relay state and generated signature as query string parameters in an HTTP redirect.
Declaration
public static void SendResponse(HttpResponseBase httpResponse, string baseURL, XmlElement samlMessage, string relayState, AsymmetricAlgorithm key, string signatureAlgorithm)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpResponseBase | httpResponse | The HTTP response used to perform the redirect. |
System.String | baseURL | The base URL to which the query string parameters are appended. |
System.Xml.XmlElement | samlMessage | The SAML response. |
System.String | relayState | The relay state or |
System.Security.Cryptography.AsymmetricAlgorithm | key | The key to generate the signature or |
System.String | signatureAlgorithm | The signature algorithm or |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown when the send fails. |
VerifyRequestSignature(String, String, String, AsymmetricAlgorithm)
Verifies the request signature.
Declaration
public static void VerifyRequestSignature(string redirectURL, string signatureAlgorithm, string signature, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.String | redirectURL | The HTTP redirect URL including the query string. |
System.String | signatureAlgorithm | The signature algorithm. |
System.String | signature | The encoded signature. |
System.Security.Cryptography.AsymmetricAlgorithm | key | The signature key. |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown if the signature is invalid. |
VerifyRequestSignature(HttpRequestBase, String, String, AsymmetricAlgorithm)
Verifies the request signature.
Declaration
public static void VerifyRequestSignature(HttpRequestBase httpRequest, string signatureAlgorithm, string signature, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | httpRequest | The HTTP request containing the query string. |
System.String | signatureAlgorithm | The signature algorithm. |
System.String | signature | The encoded signature. |
System.Security.Cryptography.AsymmetricAlgorithm | key | The signature key. |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown if the signature is invalid. |
VerifyResponseSignature(String, String, String, AsymmetricAlgorithm)
Verifies the response signature.
Declaration
public static void VerifyResponseSignature(string redirectURL, string signatureAlgorithm, string signature, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.String | redirectURL | The HTTP redirect URL including the query string. |
System.String | signatureAlgorithm | The signature algorithm. |
System.String | signature | The encoded signature. |
System.Security.Cryptography.AsymmetricAlgorithm | key | The signature key. |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown if the signature is invalid. |
VerifyResponseSignature(HttpRequestBase, String, String, AsymmetricAlgorithm)
Verifies the response signature.
Declaration
public static void VerifyResponseSignature(HttpRequestBase httpRequest, string signatureAlgorithm, string signature, AsymmetricAlgorithm key)
Parameters
Type | Name | Description |
---|---|---|
System.Web.HttpRequestBase | httpRequest | The HTTP request containing the query string. |
System.String | signatureAlgorithm | The signature algorithm. |
System.String | signature | The encoded signature. |
System.Security.Cryptography.AsymmetricAlgorithm | key | The signature key. |
Exceptions
Type | Condition |
---|---|
SAMLBindingException | Thrown if the signature is invalid. |