jwt dltoken changes
This commit is contained in:
@@ -209,7 +209,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
List<fileData> FileData = new List<fileData>();
|
List<fileData> FileData = new List<fileData>();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!uploadFormData.FormFieldData.ContainsKey("FileData") ||
|
!uploadFormData.FormFieldData.ContainsKey("FileData") ||
|
||||||
!uploadFormData.FormFieldData.ContainsKey("AttachToObjectType") ||
|
!uploadFormData.FormFieldData.ContainsKey("AttachToObjectType") ||
|
||||||
!uploadFormData.FormFieldData.ContainsKey("AttachToObjectId"))
|
!uploadFormData.FormFieldData.ContainsKey("AttachToObjectId"))
|
||||||
{
|
{
|
||||||
@@ -439,6 +439,8 @@ namespace AyaNova.Api.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//this is necessary because they might have an expired JWT but this would just keep on working without a date check
|
||||||
|
//the default is the same timespan as the jwt so it's all good
|
||||||
var utcNow = new DateTimeOffset(DateTime.Now.ToUniversalTime(), TimeSpan.Zero);
|
var utcNow = new DateTimeOffset(DateTime.Now.ToUniversalTime(), TimeSpan.Zero);
|
||||||
if (DownloadUser.DlKeyExpire < utcNow.DateTime)
|
if (DownloadUser.DlKeyExpire < utcNow.DateTime)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -115,9 +115,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
{ "iat", iat.ToUnixTimeSeconds().ToString() },
|
{ "iat", iat.ToUnixTimeSeconds().ToString() },
|
||||||
{ "exp", exp.ToUnixTimeSeconds().ToString() },//in payload exp must be in unix epoch time per standard
|
{ "exp", exp.ToUnixTimeSeconds().ToString() },//in payload exp must be in unix epoch time per standard
|
||||||
{ "iss", Issuer },
|
{ "iss", Issuer },
|
||||||
{ "id", "1" },
|
{ "id", "1" }
|
||||||
{ "name","Manager Account - TESTING"},
|
|
||||||
{ "ayanova/roles", "0" }
|
|
||||||
};
|
};
|
||||||
string TestToken = Jose.JWT.Encode(payload, secretKey, Algorithm);
|
string TestToken = Jose.JWT.Encode(payload, secretKey, Algorithm);
|
||||||
|
|
||||||
@@ -139,7 +137,9 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
return Ok(ApiOkResponse.Response(new
|
return Ok(ApiOkResponse.Response(new
|
||||||
{
|
{
|
||||||
token = TestToken
|
token = TestToken,
|
||||||
|
name = "Manager Account - TESTING",
|
||||||
|
roles = "0"
|
||||||
}, true));
|
}, true));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -201,11 +201,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
{ "iat", iat.ToUnixTimeSeconds().ToString() },
|
{ "iat", iat.ToUnixTimeSeconds().ToString() },
|
||||||
{ "exp", exp.ToUnixTimeSeconds().ToString() },//in payload exp must be in unix epoch time per standard
|
{ "exp", exp.ToUnixTimeSeconds().ToString() },//in payload exp must be in unix epoch time per standard
|
||||||
{ "iss", "ayanova.com" },
|
{ "iss", "ayanova.com" },
|
||||||
{ "id", u.Id.ToString() },
|
{ "id", u.Id.ToString() }
|
||||||
{ "name", u.Name},
|
|
||||||
{ "usertype", u.UserType},
|
|
||||||
{ "ayanova/roles", ((int)u.Roles).ToString()},
|
|
||||||
{ "dlt", DownloadToken }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -220,16 +216,13 @@ namespace AyaNova.Api.Controllers
|
|||||||
log.LogDebug($"User number \"{u.Id}\" logged in from \"{Util.StringUtil.MaskIPAddress(HttpContext.Connection.RemoteIpAddress.ToString())}\" ok");
|
log.LogDebug($"User number \"{u.Id}\" logged in from \"{Util.StringUtil.MaskIPAddress(HttpContext.Connection.RemoteIpAddress.ToString())}\" ok");
|
||||||
metrics.Measure.Meter.Mark(MetricsRegistry.SuccessfulLoginMeter);
|
metrics.Measure.Meter.Mark(MetricsRegistry.SuccessfulLoginMeter);
|
||||||
|
|
||||||
//TODO: This needs to return the authorization roles of the user in the payload and it should all be in the token
|
|
||||||
//and remove the issued, expires id etc so that all that is returned is an encoded token with that info in it
|
|
||||||
return Ok(ApiOkResponse.Response(new
|
return Ok(ApiOkResponse.Response(new
|
||||||
{
|
{
|
||||||
// ok = 1,
|
token = token,
|
||||||
// issued = iat,
|
name = u.Name,
|
||||||
// expires = exp,
|
usertype = u.UserType,
|
||||||
token = token
|
roles = ((int)u.Roles).ToString(),
|
||||||
//,
|
dlt = DownloadToken
|
||||||
//id = u.Id
|
|
||||||
}, true));
|
}, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user