This commit is contained in:
2022-03-04 18:41:49 +00:00
parent c584e62e50
commit 1e7369382e
4 changed files with 103 additions and 7 deletions

View File

@@ -663,6 +663,24 @@ namespace AyaNova.Api.Controllers
await ct.SaveChangesAsync();
return NoContent();
}
//generate an internal JWT key for reporting purposes used by corejobnotify to send reports as manager account
internal static string GenRpt()
{
byte[] secretKey = System.Text.Encoding.ASCII.GetBytes(ServerBootConfig.AYANOVA_JWT_SECRET);
var iat = new DateTimeOffset(DateTime.Now.ToUniversalTime(), TimeSpan.Zero);
var exp = new DateTimeOffset(DateTime.Now.AddMinutes(ServerBootConfig.AYANOVA_REPORT_RENDERING_TIMEOUT).ToUniversalTime(), TimeSpan.Zero);
var payload = new Dictionary<string, object>()
{
{ "exp", exp.ToUnixTimeSeconds().ToString() },//in payload exp must be in unix epoch time per standard
{ "iss", "ayanova.com" },
{ "id", "1"},
{ "int","1" }
};
return Jose.JWT.Encode(payload, secretKey, Jose.JwsAlgorithm.HS256);
}
//------------------------------------------------------
public class CredentialsParam