Skip to content

Commit

Permalink
Fix remaining tets
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersAbel committed Mar 26, 2020
1 parent a0011d5 commit 8ad7586
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
12 changes: 6 additions & 6 deletions Sustainsys.Saml2/SAML2P/Saml2LogoutRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ protected override string LocalName
/// </summary>
/// <returns>string containing the Xml data.</returns>
public override string ToXml()
{
return ToXElement().ToString();
}

public override XElement ToXElement()
{
var x = new XElement(Saml2Namespaces.Saml2P + LocalName);

Expand All @@ -103,12 +108,7 @@ public override string ToXml()
x.Add(new XElement(Saml2Namespaces.Saml2P + "SessionIndex",
SessionIndex));

return x.ToString();
}

public override XElement ToXElement()
{
throw new NotImplementedException();
return x;
}
}
}
20 changes: 18 additions & 2 deletions Sustainsys.Saml2/SAML2P/Saml2LogoutResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,24 @@ public override string ToXml()

public override XElement ToXElement()
{
throw new NotImplementedException();
}
var xe = new XElement(Saml2Namespaces.Saml2P + "LogoutResponse",
new XAttribute("ID", Id.Value),
new XAttribute("Version", "2.0"),
new XAttribute("IssueInstant", IssueInstant.ToSaml2DateTimeString()),
new XElement(Saml2Namespaces.Saml2P + "Status",
new XElement(Saml2Namespaces.Saml2P + "StatusCode",
new XAttribute("Value", StatusCodeHelper.FromCode(Status)))));

if(Issuer != null)
{
xe.AddFirst(new XElement(Saml2Namespaces.Saml2 + "Issuer", Issuer.Id));
}

xe.AddAttributeIfNotNullOrEmpty("InResponseTo", InResponseTo?.Value);
xe.AddAttributeIfNotNullOrEmpty("Destination", DestinationUrl?.OriginalString);

return xe;
}

/// <summary>
/// Appends xml for the Saml2LogoutResponse to the given parent node.
Expand Down
7 changes: 7 additions & 0 deletions Sustainsys.Saml2/WebSSO/Saml2PostBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;

namespace Sustainsys.Saml2.WebSso
{
Expand Down Expand Up @@ -46,6 +47,12 @@ public override UnbindResult Unbind(HttpRequestData request, IOptions options)
}

public override CommandResult Bind(ISaml2Message message, ILoggerAdapter logger)
{
return Bind(message, logger, null);
}

public override CommandResult Bind<TMessage>(
TMessage message, ILoggerAdapter logger, Action<TMessage, XDocument> xmlCreatedNotification)
{
if(message == null)
{
Expand Down

0 comments on commit 8ad7586

Please sign in to comment.