Skip to content

Commit

Permalink
Better handling of httpcontext in SampleIdentityServer3
Browse files Browse the repository at this point in the history
- HttpContext.Current is not reliable in all scenarious, grabbing it from
  the owin dictionary instead.
- Ignore headerswritten check if no httpcontext is found to make the same
  code work in self hosted environments too.
  • Loading branch information
AndersAbel committed Mar 3, 2016
1 parent 0ae2689 commit d3ae09a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion SampleIdentityServer3/Startup.cs
Expand Up @@ -155,9 +155,11 @@ private void UseIdSrv3LogoutOnFederatedLogout(IAppBuilder app, KentorAuthService
{
await next.Invoke();
var httpContext = context.Get<HttpContextBase>(typeof(HttpContextBase).FullName);
if (context.Authentication.AuthenticationResponseRevoke != null
&& context.Response.StatusCode % 100 == 3
&& !HttpContext.Current.Response.HeadersWritten)
&& (httpContext == null || !httpContext.Response.HeadersWritten))
{
var finalLocation = context.Response.Headers["Location"];
Expand Down

0 comments on commit d3ae09a

Please sign in to comment.