Class SamlResponse
- Namespace
- ComponentSpace.Saml2.Protocols
- Assembly
- ComponentSpace.Saml2.dll
Represents a SAML response.
public class SamlResponse : StatusResponseType
- Inheritance
-
SamlResponse
- Inherited Members
Remarks
Refer to the Assertions and Protocol for the OASIS Security Assertion Markup Language (SAML) V2.0 specification for further details.
Constructors
SamlResponse()
Initializes a new instance of the SAMLResponse class.
public SamlResponse()
SamlResponse(XmlElement)
Initializes a new instance of the SAMLResponse class from XML.
public SamlResponse(XmlElement xmlElement)
Parameters
xmlElementXmlElementThe SAML response XML.
Exceptions
- SamlSerializationException
Thrown when the XML deserialization fails.
Properties
Assertions
Gets or sets the assertions.
This includes all unsigned, signed and encrypted assertions.
The list may contain unencrypted and unsigned SAML assertions asSAMLAssertion objects,
signed SAML assertions as XmlElement objects,
and encrypted SAML assertions as EncryptedAssertion objects.
To get just the unencrypted, unsigned assertions use GetUnsignedAssertions.
To get just the signed assertions use GetSignedAssertions.
To get just the encrypted assertions use GetEncryptedAssertions.
public IList<AssertionListItem> Assertions { get; set; }
Property Value
- IList<AssertionListItem>
The assertions.
- See Also
Methods
GetEncryptedAssertion()
Returns the encrypted SAML assertion.
It's assumed the SAML response contains a single encrypted SAML assertion.
To get the unencrypted, unsigned assertion use GetUnsignedAssertion.
To get the signed assertion use GetSignedAssertion.
public EncryptedAssertion GetEncryptedAssertion()
Returns
- EncryptedAssertion
The encrypted assertion or
nullif none.
- See Also
GetEncryptedAssertions()
Returns all encrypted assertions.
To get the unencrypted, unsigned assertions use GetUnsignedAssertions.
To get the signed assertions use GetSignedAssertions.
public IList<EncryptedAssertion> GetEncryptedAssertions()
Returns
- IList<EncryptedAssertion>
The encrypted assertions.
- See Also
GetSignedAssertion()
Returns the SAML assertion.
It's assumed the SAML response contains a single signed SAML assertion.
To get the unencrypted, unsigned assertion use GetUnsignedAssertion.
To get the encrypted assertion use GetEncryptedAssertion.
public XmlElement GetSignedAssertion()
Returns
- XmlElement
The SAML assertion or
nullif none.
Exceptions
- SamlSignatureException
Thrown when the signature verification fails.
- See Also
GetSignedAssertions()
Returns all signed assertions.
To get the unencrypted, unsigned assertions use GetUnsignedAssertions.
To get the encrypted assertions use GetEncryptedAssertions.
public IList<XmlElement> GetSignedAssertions()
Returns
- IList<XmlElement>
The signed assertions.
- See Also
GetUnsignedAssertion()
Returns the SAML assertion.
It's assumed the SAML response contains a single unencrypted, unsigned SAML assertion.
To get the signed assertion use GetSignedAssertion.
To get the encrypted assertion use GetEncryptedAssertion.
public SamlAssertion GetUnsignedAssertion()
Returns
- SamlAssertion
The SAML assertion or
nullif none.
- See Also
GetUnsignedAssertions()
Returns all unencrypted, unsigned assertions.
To get the signed assertions use GetSignedAssertions.
To get the encrypted assertions use GetEncryptedAssertions.
public IList<SamlAssertion> GetUnsignedAssertions()
Returns
- IList<SamlAssertion>
The assertions.
- See Also
IsValid(XmlElement)
Indicates whether the XML is a SAML response.
public static bool IsValid(XmlElement xmlElement)
Parameters
xmlElementXmlElementThe XML to test.
Returns
- bool
trueif the XML is a SAML response; otherwisefalse.
ToXml(XmlDocument)
Serializes the SAML response to XML.
public override XmlElement ToXml(XmlDocument xmlDocument)
Parameters
xmlDocumentXmlDocumentThe owning XML document.
Returns
- XmlElement
The SAML response as XML.
Exceptions
- SamlSerializationException
Thrown when the XML serialization fails.