mirror of
https://github.com/hargata/lubelog.git
synced 2025-12-10 00:46:08 -06:00
Compare commits
2 Commits
9f14cd0a5e
...
4d9c5c7237
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d9c5c7237 | ||
|
|
d4f06b96ff |
@ -146,6 +146,7 @@ namespace CarCareTracker.Controllers
|
||||
var userAccessToken = decodedToken?.access_token ?? string.Empty;
|
||||
var tokenParser = new JsonWebTokenHandler();
|
||||
bool passedSignatureCheck = true;
|
||||
string signatureValidationError = "check jwks endpoint";
|
||||
if (!string.IsNullOrWhiteSpace(openIdConfig.JwksURL))
|
||||
{
|
||||
//validate token signature if jwks endpoint is provided
|
||||
@ -165,6 +166,10 @@ namespace CarCareTracker.Controllers
|
||||
if (!validatedIdToken.IsValid)
|
||||
{
|
||||
passedSignatureCheck = false;
|
||||
if (validatedIdToken.Exception != null && !string.IsNullOrWhiteSpace(validatedIdToken.Exception.Message))
|
||||
{
|
||||
signatureValidationError = validatedIdToken.Exception.Message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -238,7 +243,7 @@ namespace CarCareTracker.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogError($"OpenID Provider did not provide a valid id_token: check jwks endpoint");
|
||||
_logger.LogError($"OpenID Provider did not provide a valid id_token: {signatureValidationError}");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -329,6 +334,10 @@ namespace CarCareTracker.Controllers
|
||||
if (!validatedIdToken.IsValid)
|
||||
{
|
||||
passedSignatureCheck = false;
|
||||
if (validatedIdToken.Exception != null && !string.IsNullOrWhiteSpace(validatedIdToken.Exception.Message))
|
||||
{
|
||||
results.Add(OperationResponse.Failed($"Failed JWT Validation: {validatedIdToken.Exception.Message}"));
|
||||
}
|
||||
} else
|
||||
{
|
||||
results.Add(OperationResponse.Succeed($"Passed JWT Validation - Valid To: {validatedIdToken.SecurityToken.ValidTo}"));
|
||||
|
||||
@ -406,15 +406,20 @@
|
||||
title: 'Setup Credentials',
|
||||
html: `
|
||||
<input type="text" id="authUsername" class="swal2-input" placeholder="Username">
|
||||
<input type="password" id="authPassword" class="swal2-input" placeholder="Password" onkeydown="handleSwalEnter(event)">
|
||||
<input type="password" id="authPassword" class="swal2-input" placeholder="Password">
|
||||
<input type="password" id="authPasswordVerify" class="swal2-input" placeholder="Confirm Password" onkeydown="handleSwalEnter(event)">
|
||||
`,
|
||||
confirmButtonText: 'Setup',
|
||||
focusConfirm: false,
|
||||
preConfirm: () => {
|
||||
const username = $("#authUsername").val();
|
||||
const password = $("#authPassword").val();
|
||||
const passwordConfirm = $("#authPasswordVerify").val();
|
||||
if (!username || !password) {
|
||||
Swal.showValidationMessage(`Please enter username and password`)
|
||||
Swal.showValidationMessage(`Please enter username and password`);
|
||||
}
|
||||
if (password != passwordConfirm){
|
||||
Swal.showValidationMessage(`Passwords must match`);
|
||||
}
|
||||
return { username, password }
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user