Possibility to configure an OpenID Connect provider on the instance level WIP (#128).

This commit is contained in:
John Livingston
2024-04-16 11:43:38 +02:00
parent 514cc1d159
commit e646ebfd69
8 changed files with 108 additions and 24 deletions

View File

@ -16,13 +16,20 @@ export async function diagExternalAuthCustomOIDC (test: string, _options: Regist
return result
}
const errors = await oidc.check()
if (errors.length) {
result.messages.push('Discovery URL: ' + (oidc.getDiscoveryUrl() ?? 'undefined'))
const oidcErrors = await oidc.check()
if (oidcErrors.length) {
result.messages.push({
level: 'error',
message: 'The ExternalAuthOIDC singleton got some errors:'
})
result.messages.push(...errors)
for (const oidcError of oidcErrors) {
result.messages.push({
level: 'error',
message: oidcError
})
}
return result
}
} catch (err) {
@ -33,6 +40,18 @@ export async function diagExternalAuthCustomOIDC (test: string, _options: Regist
return result
}
const oidc = ExternalAuthOIDC.singleton()
const issuer = await oidc.loadIssuer()
if (issuer) {
result.messages.push('Discovery URL loaded: ' + JSON.stringify(issuer.metadata))
} else {
result.messages.push({
level: 'error',
message: 'Failed to load the Discovery URL.'
})
return result
}
result.ok = true
result.messages.push('Configuration OK.')
return result