Skip to content

Commit

Permalink
Include application base path in Logged out path
Browse files Browse the repository at this point in the history
- Fixes #1166
  • Loading branch information
AndersAbel committed Mar 16, 2020
1 parent 158bb27 commit ec96dbc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Samples/SampleOwinApplication/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class HomeController : Controller
{
public ActionResult Index()
{
var ctx = HttpContext.GetOwinContext();

return View();
}

Expand Down
8 changes: 8 additions & 0 deletions Samples/SampleOwinApplication/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ public partial class Startup
{
public void Configuration(IAppBuilder app)
{
app.Map("/foo", a =>
{
a.Use((ctx, next) =>
{
return next.Invoke();
});
});

ConfigureAuth(app);
}
}
Expand Down
3 changes: 2 additions & 1 deletion Sustainsys.Saml2.Owin/Saml2AuthenticationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ protected async override Task ApplyResponseGrantAsync()
}
else
{
redirectUrl = Context.Request.Path.ToUriComponent();
// ApplicationUrl is base path, after consideration taken to PublicOrigin.
redirectUrl = urls.ApplicationUrl.AbsolutePath + Context.Request.Path.ToString().TrimStart('/');
}
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/Owin.Tests/Saml2AuthenticationMiddlewareTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public async Task Saml2AuthenticationMiddleware_CreatesRedirectOnAuthRevoke()
context.Response.Headers["Location"].Should().StartWith("https://idp.example.com/logout?SAMLRequest");
var returnUrl = ExtractRequestState(options.DataProtector, context).ReturnUrl;

returnUrl.Should().Be("/LoggedOut");
returnUrl.Should().Be("/ExternalPath/LoggedOut");
}

[TestMethod]
Expand Down

0 comments on commit ec96dbc

Please sign in to comment.