forked from Sustainsys/Saml2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notifications to allow modification of generated XML
- Closes Sustainsys#978 - Closes Sustainsys#1158
- Loading branch information
Showing
26 changed files
with
445 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Xml.Linq; | ||
|
||
namespace Sustainsys.Saml2.Internal | ||
{ | ||
static class XDocumentExtensions | ||
{ | ||
public static string ToStringWithXmlDeclaration(this XDocument xDocument) | ||
{ | ||
if (xDocument.Declaration != null) | ||
{ | ||
return xDocument.Declaration?.ToString() + "\r\n" + xDocument.ToString(); | ||
} | ||
|
||
return xDocument.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Sustainsys.Saml2.Internal; | ||
using Sustainsys.Saml2.WebSso; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Xml.Linq; | ||
|
||
namespace Sustainsys.Saml2.Saml2P | ||
{ | ||
static class Saml2MessageExtensions | ||
{ | ||
/// <summary> | ||
/// Serializes the message into wellformed XML. | ||
/// </summary> | ||
/// <param name="message">Saml2 message to transform to XML</param> | ||
/// <param name="xmlCreatedNotification">Notification allowing modification of XML tree before serialization.</param> | ||
/// <returns>string containing the Xml data.</returns> | ||
public static string ToXml<TMessage>( | ||
this TMessage message, Action<XDocument> xmlCreatedNotification) | ||
where TMessage : ISaml2Message | ||
{ | ||
var xDocument = new XDocument(message.ToXElement()); | ||
|
||
xmlCreatedNotification(xDocument); | ||
|
||
return xDocument.ToStringWithXmlDeclaration(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.