mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-04-11 01:17:50 +02:00
Add ui and settings for OpenID Signing Algorithm
This commit is contained in:
parent
8e46181ba0
commit
6c9a811472
@ -58,6 +58,8 @@
|
|||||||
|
|
||||||
<ui-text-input-with-label ref="openidClientSecret" v-model="newAuthSettings.authOpenIDClientSecret" :disabled="savingSettings" :label="'Client Secret'" class="mb-2" />
|
<ui-text-input-with-label ref="openidClientSecret" v-model="newAuthSettings.authOpenIDClientSecret" :disabled="savingSettings" :label="'Client Secret'" class="mb-2" />
|
||||||
|
|
||||||
|
<ui-text-input-with-label ref="openidTokenSigningAlgorithm" v-model="newAuthSettings.authOpenIDTokenSigningAlgorithm" :disabled="savingSettings" :label="'Signing Algorithm'" class="mb-2" />
|
||||||
|
|
||||||
<ui-multi-select ref="redirectUris" v-model="newAuthSettings.authOpenIDMobileRedirectURIs" :items="newAuthSettings.authOpenIDMobileRedirectURIs" :label="$strings.LabelMobileRedirectURIs" class="mb-2" :menuDisabled="true" :disabled="savingSettings" />
|
<ui-multi-select ref="redirectUris" v-model="newAuthSettings.authOpenIDMobileRedirectURIs" :items="newAuthSettings.authOpenIDMobileRedirectURIs" :label="$strings.LabelMobileRedirectURIs" class="mb-2" :menuDisabled="true" :disabled="savingSettings" />
|
||||||
<p class="sm:pl-4 text-sm text-gray-300 mb-2" v-html="$strings.LabelMobileRedirectURIsDescription" />
|
<p class="sm:pl-4 text-sm text-gray-300 mb-2" v-html="$strings.LabelMobileRedirectURIsDescription" />
|
||||||
|
|
||||||
@ -187,6 +189,7 @@ export default {
|
|||||||
if (data.userinfo_endpoint) this.newAuthSettings.authOpenIDUserInfoURL = data.userinfo_endpoint
|
if (data.userinfo_endpoint) this.newAuthSettings.authOpenIDUserInfoURL = data.userinfo_endpoint
|
||||||
if (data.end_session_endpoint) this.newAuthSettings.authOpenIDLogoutURL = data.end_session_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.jwks_uri) this.newAuthSettings.authOpenIDJwksURL = data.jwks_uri
|
||||||
|
if (data.id_token_signing_algorithm) this.newAuthSettings.authOpenIDTokenSigningAlgorithm = data.id_token_signing_algorithm
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Failed to receive data', error)
|
console.error('Failed to receive data', error)
|
||||||
@ -225,6 +228,11 @@ export default {
|
|||||||
isValid = false
|
isValid = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.newAuthSettings.authOpenIDTokenSigningAlgorithm) {
|
||||||
|
this.$toast.error('Signing Algorithm required')
|
||||||
|
isValid = false
|
||||||
|
}
|
||||||
|
|
||||||
function isValidRedirectURI(uri) {
|
function isValidRedirectURI(uri) {
|
||||||
// Check for somestring://someother/string
|
// Check for somestring://someother/string
|
||||||
const pattern = new RegExp('^\\w+://[\\w\\.-]+(/[\\w\\./-]*)*$', 'i')
|
const pattern = new RegExp('^\\w+://[\\w\\.-]+(/[\\w\\./-]*)*$', 'i')
|
||||||
|
@ -85,7 +85,8 @@ class Auth {
|
|||||||
token_endpoint: global.ServerSettings.authOpenIDTokenURL,
|
token_endpoint: global.ServerSettings.authOpenIDTokenURL,
|
||||||
userinfo_endpoint: global.ServerSettings.authOpenIDUserInfoURL,
|
userinfo_endpoint: global.ServerSettings.authOpenIDUserInfoURL,
|
||||||
jwks_uri: global.ServerSettings.authOpenIDJwksURL,
|
jwks_uri: global.ServerSettings.authOpenIDJwksURL,
|
||||||
end_session_endpoint: global.ServerSettings.authOpenIDLogoutURL
|
end_session_endpoint: global.ServerSettings.authOpenIDLogoutURL,
|
||||||
|
id_token_signed_response_alg: global.ServerSettings.authOpenIDTokenSigningAlgorithm
|
||||||
}).Client
|
}).Client
|
||||||
const openIdClient = new openIdIssuerClient({
|
const openIdClient = new openIdIssuerClient({
|
||||||
client_id: global.ServerSettings.authOpenIDClientID,
|
client_id: global.ServerSettings.authOpenIDClientID,
|
||||||
@ -650,7 +651,8 @@ class Auth {
|
|||||||
token_endpoint: data.token_endpoint,
|
token_endpoint: data.token_endpoint,
|
||||||
userinfo_endpoint: data.userinfo_endpoint,
|
userinfo_endpoint: data.userinfo_endpoint,
|
||||||
end_session_endpoint: data.end_session_endpoint,
|
end_session_endpoint: data.end_session_endpoint,
|
||||||
jwks_uri: data.jwks_uri
|
jwks_uri: data.jwks_uri,
|
||||||
|
id_token_signing_algorithm: data.id_token_signing_alg_values_supported?.[0]
|
||||||
})
|
})
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
Logger.error(`[Auth] Failed to get openid configuration at "${configUrl}"`, error)
|
Logger.error(`[Auth] Failed to get openid configuration at "${configUrl}"`, error)
|
||||||
|
@ -68,13 +68,14 @@ class ServerSettings {
|
|||||||
this.authOpenIDLogoutURL = null
|
this.authOpenIDLogoutURL = null
|
||||||
this.authOpenIDClientID = null
|
this.authOpenIDClientID = null
|
||||||
this.authOpenIDClientSecret = null
|
this.authOpenIDClientSecret = null
|
||||||
|
this.authOpenIDTokenSigningAlgorithm = 'RS256'
|
||||||
this.authOpenIDButtonText = 'Login with OpenId'
|
this.authOpenIDButtonText = 'Login with OpenId'
|
||||||
this.authOpenIDAutoLaunch = false
|
this.authOpenIDAutoLaunch = false
|
||||||
this.authOpenIDAutoRegister = false
|
this.authOpenIDAutoRegister = false
|
||||||
this.authOpenIDMatchExistingBy = null
|
this.authOpenIDMatchExistingBy = null
|
||||||
this.authOpenIDMobileRedirectURIs = ['audiobookshelf://oauth']
|
this.authOpenIDMobileRedirectURIs = ['audiobookshelf://oauth']
|
||||||
this.authOpenIDGroupClaim = ''
|
this.authOpenIDGroupClaim = ''
|
||||||
this.authOpenIDAdvancedPermsClaim = ''
|
this.authOpenIDAdvancedPermsClaim = ''
|
||||||
|
|
||||||
if (settings) {
|
if (settings) {
|
||||||
this.construct(settings)
|
this.construct(settings)
|
||||||
@ -127,6 +128,7 @@ class ServerSettings {
|
|||||||
this.authOpenIDLogoutURL = settings.authOpenIDLogoutURL || null
|
this.authOpenIDLogoutURL = settings.authOpenIDLogoutURL || null
|
||||||
this.authOpenIDClientID = settings.authOpenIDClientID || null
|
this.authOpenIDClientID = settings.authOpenIDClientID || null
|
||||||
this.authOpenIDClientSecret = settings.authOpenIDClientSecret || null
|
this.authOpenIDClientSecret = settings.authOpenIDClientSecret || null
|
||||||
|
this.authOpenIDTokenSigningAlgorithm = settings.authOpenIDTokenSigningAlgorithm || 'RS256'
|
||||||
this.authOpenIDButtonText = settings.authOpenIDButtonText || 'Login with OpenId'
|
this.authOpenIDButtonText = settings.authOpenIDButtonText || 'Login with OpenId'
|
||||||
this.authOpenIDAutoLaunch = !!settings.authOpenIDAutoLaunch
|
this.authOpenIDAutoLaunch = !!settings.authOpenIDAutoLaunch
|
||||||
this.authOpenIDAutoRegister = !!settings.authOpenIDAutoRegister
|
this.authOpenIDAutoRegister = !!settings.authOpenIDAutoRegister
|
||||||
@ -217,6 +219,7 @@ class ServerSettings {
|
|||||||
authOpenIDLogoutURL: this.authOpenIDLogoutURL,
|
authOpenIDLogoutURL: this.authOpenIDLogoutURL,
|
||||||
authOpenIDClientID: this.authOpenIDClientID, // Do not return to client
|
authOpenIDClientID: this.authOpenIDClientID, // Do not return to client
|
||||||
authOpenIDClientSecret: this.authOpenIDClientSecret, // Do not return to client
|
authOpenIDClientSecret: this.authOpenIDClientSecret, // Do not return to client
|
||||||
|
authOpenIDTokenSigningAlgorithm: this.authOpenIDTokenSigningAlgorithm,
|
||||||
authOpenIDButtonText: this.authOpenIDButtonText,
|
authOpenIDButtonText: this.authOpenIDButtonText,
|
||||||
authOpenIDAutoLaunch: this.authOpenIDAutoLaunch,
|
authOpenIDAutoLaunch: this.authOpenIDAutoLaunch,
|
||||||
authOpenIDAutoRegister: this.authOpenIDAutoRegister,
|
authOpenIDAutoRegister: this.authOpenIDAutoRegister,
|
||||||
@ -252,7 +255,8 @@ class ServerSettings {
|
|||||||
this.authOpenIDUserInfoURL &&
|
this.authOpenIDUserInfoURL &&
|
||||||
this.authOpenIDJwksURL &&
|
this.authOpenIDJwksURL &&
|
||||||
this.authOpenIDClientID &&
|
this.authOpenIDClientID &&
|
||||||
this.authOpenIDClientSecret
|
this.authOpenIDClientSecret &&
|
||||||
|
this.authOpenIDTokenSigningAlgorithm
|
||||||
}
|
}
|
||||||
|
|
||||||
get authenticationSettings() {
|
get authenticationSettings() {
|
||||||
@ -267,6 +271,7 @@ class ServerSettings {
|
|||||||
authOpenIDLogoutURL: this.authOpenIDLogoutURL,
|
authOpenIDLogoutURL: this.authOpenIDLogoutURL,
|
||||||
authOpenIDClientID: this.authOpenIDClientID, // Do not return to client
|
authOpenIDClientID: this.authOpenIDClientID, // Do not return to client
|
||||||
authOpenIDClientSecret: this.authOpenIDClientSecret, // Do not return to client
|
authOpenIDClientSecret: this.authOpenIDClientSecret, // Do not return to client
|
||||||
|
authOpenIDTokenSigningAlgorithm: this.authOpenIDTokenSigningAlgorithm,
|
||||||
authOpenIDButtonText: this.authOpenIDButtonText,
|
authOpenIDButtonText: this.authOpenIDButtonText,
|
||||||
authOpenIDAutoLaunch: this.authOpenIDAutoLaunch,
|
authOpenIDAutoLaunch: this.authOpenIDAutoLaunch,
|
||||||
authOpenIDAutoRegister: this.authOpenIDAutoRegister,
|
authOpenIDAutoRegister: this.authOpenIDAutoRegister,
|
||||||
|
Loading…
Reference in New Issue
Block a user