|
|
@ -168,7 +168,6 @@ namespace Ombi
|
|
|
|
if (user == null)
|
|
|
|
if (user == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
|
|
|
|
context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
|
|
|
|
context.Response.RegisterForDispose(um);
|
|
|
|
|
|
|
|
await context.Response.WriteAsync("Invalid User Access Token");
|
|
|
|
await context.Response.WriteAsync("Invalid User Access Token");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -178,7 +177,6 @@ namespace Ombi
|
|
|
|
var roles = await um.GetRolesAsync(user);
|
|
|
|
var roles = await um.GetRolesAsync(user);
|
|
|
|
var principal = new GenericPrincipal(identity, roles.ToArray());
|
|
|
|
var principal = new GenericPrincipal(identity, roles.ToArray());
|
|
|
|
context.User = principal;
|
|
|
|
context.User = principal;
|
|
|
|
context.Response.RegisterForDispose(um);
|
|
|
|
|
|
|
|
await next();
|
|
|
|
await next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -191,7 +189,6 @@ namespace Ombi
|
|
|
|
if (!valid)
|
|
|
|
if (!valid)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
|
|
|
|
context.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
|
|
|
|
context.Response.RegisterForDispose(settingsProvider);
|
|
|
|
|
|
|
|
await context.Response.WriteAsync("Invalid API Key");
|
|
|
|
await context.Response.WriteAsync("Invalid API Key");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -199,7 +196,6 @@ namespace Ombi
|
|
|
|
var identity = new GenericIdentity("API");
|
|
|
|
var identity = new GenericIdentity("API");
|
|
|
|
var principal = new GenericPrincipal(identity, new[] { "Admin", "ApiUser" });
|
|
|
|
var principal = new GenericPrincipal(identity, new[] { "Admin", "ApiUser" });
|
|
|
|
context.User = principal;
|
|
|
|
context.User = principal;
|
|
|
|
context.Response.RegisterForDispose(settingsProvider);
|
|
|
|
|
|
|
|
await next();
|
|
|
|
await next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|