Skip to content

Commit

Permalink
Call the MessageUnbound notification on logout too (#580)
Browse files Browse the repository at this point in the history
  • Loading branch information
explunit committed Nov 12, 2016
1 parent 25a7ec8 commit 503b8e8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Kentor.AuthServices.Tests/WebSSO/LogoutCommandTests.cs
Expand Up @@ -238,11 +238,18 @@ public void LogoutCommand_Run_HandlesLogoutResponse()
{
notifiedCommandResult = cr;
};
var responseUnboundCalled = false;
options.Notifications.MessageUnbound = ur =>
{
ur.Should().NotBeNull();
responseUnboundCalled = true;
};

var actual = CommandFactory.GetCommand(CommandFactory.LogoutCommandName)
.Run(request, options);

actual.Should().BeSameAs(notifiedCommandResult);
responseUnboundCalled.Should().BeTrue("the ResponseUnbound notification should have been called.");

var expected = new CommandResult
{
Expand Down
Expand Up @@ -67,7 +67,7 @@ public KentorAuthServicesNotifications()
public Func<HttpRequestData, Saml2Binding> GetBinding { get; set; }

/// <summary>
/// Notification called when the ACS command has extracted data from
/// Notification called when the command has extracted data from
/// request (by using <see cref="Saml2Binding.Unbind(HttpRequestData, IOptions)"/>)
/// </summary>
public Action<UnbindResult> MessageUnbound { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions Kentor.AuthServices/WebSSO/LogOutCommand.cs
Expand Up @@ -70,6 +70,8 @@ public CommandResult Run(HttpRequestData request, IOptions options)
if (binding != null)
{
var unbindResult = binding.Unbind(request, options);
options.Notifications.MessageUnbound(unbindResult);

VerifyMessageIsSigned(unbindResult, options);
switch (unbindResult.Data.LocalName)
{
Expand Down

0 comments on commit 503b8e8

Please sign in to comment.