misc: add support for number field values

This commit is contained in:
Sheen Capadngan
2024-12-13 14:02:32 +08:00
parent c35657ed49
commit 8713643bc1
2 changed files with 6 additions and 2 deletions

View File

@@ -1,9 +1,13 @@
import picomatch from "picomatch";
export const doesFieldValueMatchJwtPolicy = (fieldValue: string | boolean, policyValue: string) => {
export const doesFieldValueMatchJwtPolicy = (fieldValue: string | boolean | number, policyValue: string) => {
if (typeof fieldValue === "boolean") {
return fieldValue === (policyValue === "true");
}
if (typeof fieldValue === "number") {
return fieldValue === parseInt(policyValue, 10);
}
return policyValue === fieldValue || picomatch.isMatch(fieldValue, policyValue);
};

View File

@@ -75,7 +75,7 @@ export const identityJwtAuthServiceFactory = ({
});
}
let tokenData: Record<string, string | boolean> = {};
let tokenData: Record<string, string | boolean | number> = {};
if (identityJwtAuth.configurationType === JwtConfigurationType.JWKS) {
const decryptedJwksCaCert = orgDataKeyDecryptor({