bump 0.5.32 — remove audience check from JWT verify
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ipwhitelist",
|
"name": "ipwhitelist",
|
||||||
"version": "0.5.31",
|
"version": "0.5.32",
|
||||||
"description": "IP WhiteList microservice for cloud provider",
|
"description": "IP WhiteList microservice for cloud provider",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+1
-2
@@ -241,9 +241,8 @@ function verifyOidcToken(token) {
|
|||||||
|
|
||||||
const pem = crypto.createPublicKey({ key, format: 'jwk' }).export({ type: 'spki', format: 'pem' });
|
const pem = crypto.createPublicKey({ key, format: 'jwk' }).export({ type: 'spki', format: 'pem' });
|
||||||
// Проверяем issuer — защита от токенов других realm.
|
// Проверяем issuer — защита от токенов других realm.
|
||||||
// audience проверяем только если задан KC_CLIENT_ID (для OIDC-режима).
|
// audience не проверяем — не все KC-клиенты корректно выставляют aud claim.
|
||||||
const opts = { algorithms: ['RS256'], issuer: KC_BASE_URL };
|
const opts = { algorithms: ['RS256'], issuer: KC_BASE_URL };
|
||||||
if (KC_CLIENT_ID) opts.audience = KC_CLIENT_ID;
|
|
||||||
return jwt.verify(token, pem, opts);
|
return jwt.verify(token, pem, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user