@cemiar/auth-sdk 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,14 +46,18 @@ export async function registerCemiarAuthHapi(server, options) {
|
|
|
46
46
|
const key = await getKey(decoded);
|
|
47
47
|
return { key };
|
|
48
48
|
},
|
|
49
|
-
validate: async (
|
|
50
|
-
const
|
|
51
|
-
const tokenAud = payload === null || payload === void 0 ? void 0 : payload.aud;
|
|
49
|
+
validate: async (payload, request, h) => {
|
|
50
|
+
const tokenAud = payload === null || payload === void 0 ? void 0 : payload.auds;
|
|
52
51
|
const tokenAuds = Array.isArray(tokenAud) ? tokenAud : tokenAud ? [tokenAud] : [];
|
|
53
52
|
const hasValidAud = tokenAuds.length > 0 && tokenAuds.every(aud => auds.includes(aud));
|
|
54
53
|
if (!hasValidAud) {
|
|
55
54
|
return { isValid: false };
|
|
56
55
|
}
|
|
56
|
+
// Wrap payload in JwtParts structure for the user's validate function
|
|
57
|
+
const decoded = {
|
|
58
|
+
header: {},
|
|
59
|
+
payload
|
|
60
|
+
};
|
|
57
61
|
return validate(decoded, request, h);
|
|
58
62
|
},
|
|
59
63
|
verifyOptions: {
|