Class SamlMessageReader
- Namespace
- Fdyay.IdentityServer.Saml.Messages
- Assembly
- Fdyay.IdentityServer.Saml.dll
Parses SAML protocol messages from XML, with entity/DTD processing disabled (XXE-safe).
public static class SamlMessageReader
- Inheritance
-
SamlMessageReader
- Inherited Members
Methods
FindAssertionElement(XmlDocument)
Returns the single saml:Assertion element, or null if absent or ambiguous.
public static XmlElement? FindAssertionElement(XmlDocument doc)
Parameters
docXmlDocument
Returns
LoadDocument(string)
Loads untrusted SAML XML with a hardened reader (no DTD, no external entity resolution).
public static XmlDocument LoadDocument(string xml)
Parameters
xmlstring
Returns
LoadDocument(string, long)
The same, refusing a document longer than maxCharacters; zero means no limit.
public static XmlDocument LoadDocument(string xml, long maxCharacters)
Parameters
Returns
ReadAuthnRequest(XmlDocument)
Parses a samlp:AuthnRequest into a model. Signature validation is performed separately.
public static SamlAuthnRequest ReadAuthnRequest(XmlDocument doc)
Parameters
docXmlDocument
Returns
Exceptions
- SamlFormatException
The document is not a readable AuthnRequest.
ReadAuthnRequest(XmlDocument, Action<ReadErrorInspectorContext<SamlAuthnRequest>>?)
Parses a samlp:AuthnRequest, collecting what is wrong with it and handing that to
errorInspector when anything is. Duende's ReadAuthnRequestAsync, measured.
public static SamlAuthnRequest ReadAuthnRequest(XmlDocument doc, Action<ReadErrorInspectorContext<SamlAuthnRequest>>? errorInspector)
Parameters
docXmlDocumentThe request as received.
errorInspectorAction<ReadErrorInspectorContext<SamlAuthnRequest>>AuthnRequestErrorInspector: asked only when there is an error, and the read fails on any it leaves standing. Null refuses at the first, as this reader did before it collected them.
Returns
Exceptions
- SamlFormatException
An error was left standing; the message is the first one's.
ReadLogoutRequest(XmlDocument)
Parses a samlp:LogoutRequest. Signature validation is performed separately.
public static SamlLogoutRequest ReadLogoutRequest(XmlDocument doc)
Parameters
docXmlDocument
Returns
Exceptions
- SamlFormatException
The document is not a readable LogoutRequest.
ReadLogoutRequest(XmlDocument, Action<ReadErrorInspectorContext<SamlLogoutRequest>>?)
Parses a samlp:LogoutRequest, handing what is wrong with it to errorInspector when anything
is. Duende's ReadLogoutRequestAsync, as ReadAuthnRequest(XmlDocument, Action<ReadErrorInspectorContext<SamlAuthnRequest>>?).
public static SamlLogoutRequest ReadLogoutRequest(XmlDocument doc, Action<ReadErrorInspectorContext<SamlLogoutRequest>>? errorInspector)
Parameters
docXmlDocumenterrorInspectorAction<ReadErrorInspectorContext<SamlLogoutRequest>>
Returns
Exceptions
- SamlFormatException
An error was left standing; the message is the first one's.
ReadLogoutResponse(XmlDocument)
Parses a samlp:LogoutResponse. Signature validation is performed separately.
public static SamlLogoutResponse ReadLogoutResponse(XmlDocument doc)
Parameters
docXmlDocument
Returns
Exceptions
- SamlFormatException
The document is not a readable LogoutResponse.
ReadLogoutResponse(XmlDocument, Action<ReadErrorInspectorContext<SamlLogoutResponse>>?)
Parses a samlp:LogoutResponse, handing what is wrong with it to errorInspector when anything
is. Duende's ReadLogoutResponseAsync, as ReadAuthnRequest(XmlDocument, Action<ReadErrorInspectorContext<SamlAuthnRequest>>?).
public static SamlLogoutResponse ReadLogoutResponse(XmlDocument doc, Action<ReadErrorInspectorContext<SamlLogoutResponse>>? errorInspector)
Parameters
docXmlDocumenterrorInspectorAction<ReadErrorInspectorContext<SamlLogoutResponse>>
Returns
Remarks
A response whose status could not be read, let through, reads as no success.
Exceptions
- SamlFormatException
An error was left standing; the message is the first one's.
ReadResponse(XmlDocument)
Parses a samlp:Response into a model. Signature validation is performed separately.
public static SamlResponse ReadResponse(XmlDocument doc)
Parameters
docXmlDocument