Skip to content

Commit

Permalink
Merge pull request #2149 from tidusjar/develop
Browse files Browse the repository at this point in the history
Removed some early disposition that seemed to be causing errors in th…
  • Loading branch information
tidusjar authored Apr 12, 2018
2 parents bb4ea79 + 7d62b4a commit 2f2cc64
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/Ombi/StartupExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ private static async Task ValidateUserAccessToken(IServiceProvider serviceProvid
if (user == null)
{
context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
context.Response.RegisterForDispose(um);
await context.Response.WriteAsync("Invalid User Access Token");
}
else
Expand All @@ -178,7 +177,6 @@ private static async Task ValidateUserAccessToken(IServiceProvider serviceProvid
var roles = await um.GetRolesAsync(user);
var principal = new GenericPrincipal(identity, roles.ToArray());
context.User = principal;
context.Response.RegisterForDispose(um);
await next();
}
}
Expand All @@ -191,15 +189,13 @@ private static async Task ValidateApiKey(IServiceProvider serviceProvider, HttpC
if (!valid)
{
context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
context.Response.RegisterForDispose(settingsProvider);
await context.Response.WriteAsync("Invalid API Key");
}
else
{
var identity = new GenericIdentity("API");
var principal = new GenericPrincipal(identity, new[] { "Admin", "ApiUser" });
context.User = principal;
context.Response.RegisterForDispose(settingsProvider);
await next();
}
}
Expand Down

0 comments on commit 2f2cc64

Please sign in to comment.