This commit is contained in:
@@ -676,7 +676,7 @@ namespace AyaNova.Api.Controllers
|
||||
{ "exp", exp.ToUnixTimeSeconds().ToString() },//in payload exp must be in unix epoch time per standard
|
||||
{ "iss", "ayanova.com" },
|
||||
{ "id", "1"},
|
||||
{ "int","1" }
|
||||
{ "j","1" }
|
||||
};
|
||||
return Jose.JWT.Encode(payload, secretKey, Jose.JwsAlgorithm.HS256);
|
||||
}
|
||||
|
||||
@@ -484,6 +484,21 @@ namespace AyaNova
|
||||
u.currentAuthToken != JWT
|
||||
)//except "/api/v8/auth" and prelogin notify/hello routes so user can login
|
||||
{
|
||||
|
||||
//It may be a local report render request from a job
|
||||
if (context.Request.Host.Host == "127.0.0.1")
|
||||
{
|
||||
//check if token has j value set
|
||||
if (context.Request.IsLocal())
|
||||
{
|
||||
if (context.User.Claims.FirstOrDefault(c => c.Type == "j") != null)
|
||||
{
|
||||
//it's a local request, the jwt already passed earlier so we issued it and it has the correct claim set so allow it
|
||||
await next.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
context.Response.StatusCode = 401;
|
||||
context.Response.Headers.Add("X-AyaNova-Authorization-Error", "E2004 - Authorization token replaced by more recent login");
|
||||
await context.Response.WriteAsync("E2004 - Authorization token replaced by more recent login");
|
||||
|
||||
Reference in New Issue
Block a user