diff --git a/client/pages/config/authentication.vue b/client/pages/config/authentication.vue index 260093b5..5159c039 100644 --- a/client/pages/config/authentication.vue +++ b/client/pages/config/authentication.vue @@ -58,7 +58,8 @@ - + +

@@ -140,6 +141,7 @@ export default { enableOpenIDAuth: false, showCustomLoginMessage: false, savingSettings: false, + openIdSigningAlgorithmsSupportedByIssuer: [], newAuthSettings: {} } }, @@ -162,6 +164,9 @@ export default { value: 'username' } ] + }, + hasSupportedSigningAlgorithms() { + return this.openIdSigningAlgorithmsSupportedByIssuer.length > 0 } }, methods: { @@ -180,6 +185,19 @@ export default { this.newAuthSettings.authOpenIDIssuerURL = this.newAuthSettings.authOpenIDIssuerURL.replace('/.well-known/openid-configuration', '') } + const setSupportedSigningAlgorithms = (algorithms) => { + this.openIdSigningAlgorithmsSupportedByIssuer = algorithms + + if(!algorithms || algorithms.length === 0) return + + // If a signing algorithm is already selected, then keep it, when it is still supported. + // But if it is not supported, then select one of the supported ones. + let currentAlgorithm = this.newAuthSettings.authOpenIDTokenSigningAlgorithm + if(!algorithms.includes(currentAlgorithm)) { + this.newAuthSettings.authOpenIDTokenSigningAlgorithm = algorithms[0] + } + } + this.$axios .$get(`/auth/openid/config?issuer=${issuerUrl}`) .then((data) => { @@ -189,7 +207,7 @@ export default { if (data.userinfo_endpoint) this.newAuthSettings.authOpenIDUserInfoURL = data.userinfo_endpoint if (data.end_session_endpoint) this.newAuthSettings.authOpenIDLogoutURL = data.end_session_endpoint if (data.jwks_uri) this.newAuthSettings.authOpenIDJwksURL = data.jwks_uri - if (data.id_token_signing_algorithm) this.newAuthSettings.authOpenIDTokenSigningAlgorithm = data.id_token_signing_algorithm + if (data.id_token_signing_alg_values_supported) setSupportedSigningAlgorithms(data.id_token_signing_alg_values_supported) }) .catch((error) => { console.error('Failed to receive data', error) diff --git a/server/Auth.js b/server/Auth.js index 5d376fd6..827870b0 100644 --- a/server/Auth.js +++ b/server/Auth.js @@ -652,7 +652,7 @@ class Auth { userinfo_endpoint: data.userinfo_endpoint, end_session_endpoint: data.end_session_endpoint, jwks_uri: data.jwks_uri, - id_token_signing_algorithm: data.id_token_signing_alg_values_supported?.[0] + id_token_signing_alg_values_supported: data.id_token_signing_alg_values_supported }) }).catch((error) => { Logger.error(`[Auth] Failed to get openid configuration at "${configUrl}"`, error)