C# Class dk.nita.saml20.Saml20Assertion

Encapsulates the functionality required of a DK-SAML 2.0 Assertion.
Datei anzeigen Open project: symplified/Symplified.Auth Class Usage Examples

Private Properties

Property Type Description
AddSignature void
CheckCertificateCanSign void
CheckSignature bool
ExtractAttributes void
InsertAttributes void
LoadXml void

Public Methods

Method Description
CheckSignature ( IEnumerable keys ) : bool

Check the signature of the XmlDocument using the list of keys. If the signature key is found, the SigningKey property is set.

CheckValid ( IEnumerable trustedSigners ) : void

Verifies the assertion's signature and its time to live.

GetSignatureKeys ( ) : System.Security.Cryptography.Xml.KeyInfo

Returns the KeyInfo element of the signature of the token.

GetXml ( ) : XmlElement

Gets the assertion as an XmlDocument.

IsExpired ( ) : bool

Checks if the expiration time has been exceeded.

Saml20Assertion ( ) : System

Initializes a new instance of the Saml20Assertion class.

Saml20Assertion ( XmlElement assertion, IEnumerable trustedSigners, AssertionProfile profile, bool quirksMode ) : System

Initializes a new instance of the Saml20Assertion class.

Saml20Assertion ( XmlElement assertion, IEnumerable trustedSigners, AssertionProfile profile, bool quirksMode, bool autoValidate ) : System

Initializes a new instance of the Saml20Assertion class.

Saml20Assertion ( XmlElement assertion, IEnumerable trustedSigners, bool quirksMode ) : System

Initializes a new instance of the Saml20Assertion class.

Sign ( X509Certificate2 cert ) : void

Signs the assertion with the given certificate.

WriteAssertion ( XmlWriter writer ) : void

Writes the token to a writer.

Private Methods

Method Description
AddSignature ( XmlDocument assertionDocument, X509Certificate2 cert ) : void
CheckCertificateCanSign ( X509Certificate2 cert ) : void
CheckSignature ( AsymmetricAlgorithm key ) : bool
ExtractAttributes ( ) : void

Extracts the list of attributes from the <AttributeStatement> of the assertion, and stores it in _assertionAttributes.

InsertAttributes ( ) : void

Merges the modified attributes into AttributeStatement of the assertion.

LoadXml ( XmlElement element, IEnumerable trustedSigners ) : void

Loads an assertion from XML.

Method Details

CheckSignature() public method

Check the signature of the XmlDocument using the list of keys. If the signature key is found, the SigningKey property is set.
public CheckSignature ( IEnumerable keys ) : bool
keys IEnumerable A list of KeyDescriptor elements. Probably extracted from the metadata describing the IDP that sent the message.
return bool

CheckValid() public method

Verifies the assertion's signature and its time to live.
if the assertion's signature can not be verified or its time to live has been exceeded.
public CheckValid ( IEnumerable trustedSigners ) : void
trustedSigners IEnumerable
return void

GetSignatureKeys() public method

Returns the KeyInfo element of the signature of the token.
public GetSignatureKeys ( ) : System.Security.Cryptography.Xml.KeyInfo
return System.Security.Cryptography.Xml.KeyInfo

GetXml() public method

Gets the assertion as an XmlDocument.
public GetXml ( ) : XmlElement
return System.Xml.XmlElement

IsExpired() public method

Checks if the expiration time has been exceeded.
public IsExpired ( ) : bool
return bool

Saml20Assertion() public method

Initializes a new instance of the Saml20Assertion class.
public Saml20Assertion ( ) : System
return System

Saml20Assertion() public method

Initializes a new instance of the Saml20Assertion class.
public Saml20Assertion ( XmlElement assertion, IEnumerable trustedSigners, AssertionProfile profile, bool quirksMode ) : System
assertion System.Xml.XmlElement The assertion.
trustedSigners IEnumerable If null, the signature of the given assertion is not verified.
profile AssertionProfile Determines the type of validation to perform on the token
quirksMode bool if set to true quirks mode is enabled.
return System

Saml20Assertion() public method

Initializes a new instance of the Saml20Assertion class.
public Saml20Assertion ( XmlElement assertion, IEnumerable trustedSigners, AssertionProfile profile, bool quirksMode, bool autoValidate ) : System
assertion System.Xml.XmlElement The assertion.
trustedSigners IEnumerable If null, the signature of the given assertion is not verified.
profile AssertionProfile Determines the type of validation to perform on the token
quirksMode bool if set to true quirks mode is enabled.
autoValidate bool Turn automatic validation on or off
return System

Saml20Assertion() public method

Initializes a new instance of the Saml20Assertion class.
public Saml20Assertion ( XmlElement assertion, IEnumerable trustedSigners, bool quirksMode ) : System
assertion System.Xml.XmlElement The assertion.
trustedSigners IEnumerable If null, the signature of the given assertion is not verified.
quirksMode bool if set to true quirks mode is enabled.
return System

Sign() public method

Signs the assertion with the given certificate.
public Sign ( X509Certificate2 cert ) : void
cert System.Security.Cryptography.X509Certificates.X509Certificate2 The certificate to sign the assertion with.
return void

WriteAssertion() public method

Writes the token to a writer.
public WriteAssertion ( XmlWriter writer ) : void
writer System.Xml.XmlWriter The writer.
return void