This commit is contained in:
2019-04-30 18:34:33 +00:00
parent 6a6f94c51e
commit 7b9010b060
14 changed files with 43 additions and 40 deletions

View File

@@ -29,7 +29,7 @@ namespace AyaNova.Api.Controllers
private readonly IConfiguration _configuration;
private readonly ApiServerState serverState;
private readonly IMetrics metrics;
private const int JWT_LIFETIME_DAYS=7;
private const int JWT_LIFETIME_DAYS = 7;
/// <summary>
/// ctor
@@ -120,7 +120,7 @@ namespace AyaNova.Api.Controllers
};
string TestToken = Jose.JWT.Encode(payload, secretKey, Algorithm);
//Post JWT creation test payloads
switch (creds.Password)
{
@@ -129,9 +129,9 @@ namespace AyaNova.Api.Controllers
break;
case "TRANSPOSE_SIGNATURE":
//Transpose two characters in the signature
int len=TestToken.Length;
var Transposed = TestToken.Substring(0,len-5) + TestToken[len-4] + TestToken[len-5] + TestToken.Substring(len-3,3);
TestToken=Transposed;
int len = TestToken.Length;
var Transposed = TestToken.Substring(0, len - 5) + TestToken[len - 4] + TestToken[len - 5] + TestToken.Substring(len - 3, 3);
TestToken = Transposed;
break;
}
@@ -139,7 +139,7 @@ namespace AyaNova.Api.Controllers
return Ok(new ApiOkResponse(new
{
token = TestToken
}));
}, true));
}
@@ -181,7 +181,7 @@ namespace AyaNova.Api.Controllers
{
//This is leaking information, instead just act like bad creds
//return StatusCode(401, new ApiErrorResponse(ApiErrorCode.NOT_AUTHORIZED, null, "User deactivated"));
return StatusCode(401, new ApiErrorResponse(ApiErrorCode.AUTHENTICATION_FAILED));
return StatusCode(401, new ApiErrorResponse(ApiErrorCode.AUTHENTICATION_FAILED));
}
//build the key (JWT set in startup.cs)
@@ -218,7 +218,7 @@ namespace AyaNova.Api.Controllers
token = token
//,
//id = u.Id
}));
}, true));
}
}