Skip to content

Commit 6a4dcac

Browse files
authored
πŸ› fix: use OpenID token signature algo as discovered from the server (danny-avila#5348)
* πŸ› fix: use OpenID token signature algo as discovered from the server. * πŸ“œ refactor: Keeping other props that uses alg. * πŸ”§ fix: handle missing property * πŸ“˜ refactor: add comment block
1 parent 22f580b commit 6a4dcac

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

β€Žapi/strategies/openidStrategy.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,21 @@ async function setupOpenId() {
114114
logger.info(`[openidStrategy] proxy agent added: ${process.env.PROXY}`);
115115
}
116116
const issuer = await Issuer.discover(process.env.OPENID_ISSUER);
117+
/* Supported Algorithms, openid-client v5 doesn't set it automatically as discovered from server.
118+
- id_token_signed_response_alg // defaults to 'RS256'
119+
- request_object_signing_alg // defaults to 'RS256'
120+
- userinfo_signed_response_alg // not in v5
121+
- introspection_signed_response_alg // not in v5
122+
- authorization_signed_response_alg // not in v5
123+
*/
124+
const supported_alg = {
125+
id_token_signed_response_alg: issuer.id_token_signing_alg_values_supported?.[0] || 'RS256',
126+
};
117127
const client = new issuer.Client({
118128
client_id: process.env.OPENID_CLIENT_ID,
119129
client_secret: process.env.OPENID_CLIENT_SECRET,
120130
redirect_uris: [process.env.DOMAIN_SERVER + process.env.OPENID_CALLBACK_URL],
131+
...supported_alg,
121132
});
122133
const requiredRole = process.env.OPENID_REQUIRED_ROLE;
123134
const requiredRoleParameterPath = process.env.OPENID_REQUIRED_ROLE_PARAMETER_PATH;

0 commit comments

Comments
Β (0)