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

This commit is contained in:
John Livingston
2024-04-15 18:29:09 +02:00
parent c1e877cb44
commit 514cc1d159
14 changed files with 388 additions and 12 deletions

View File

@ -0,0 +1,39 @@
import type { RegisterServerOptions } from '@peertube/peertube-types'
import { newResult, TestResult } from './utils'
import { ExternalAuthOIDC } from '../external-auth/oidc'
export async function diagExternalAuthCustomOIDC (test: string, _options: RegisterServerOptions): Promise<TestResult> {
const result = newResult(test)
result.label = 'Test External Auth Custom OIDC'
result.next = 'everything-ok'
try {
const oidc = ExternalAuthOIDC.singleton()
if (oidc.isDisabledBySettings()) {
result.ok = true
result.messages.push('Feature disabled in plugins settings.')
return result
}
const errors = await oidc.check()
if (errors.length) {
result.messages.push({
level: 'error',
message: 'The ExternalAuthOIDC singleton got some errors:'
})
result.messages.push(...errors)
return result
}
} catch (err) {
result.messages.push({
level: 'error',
message: 'Error while retrieving the ExternalAuthOIDC singleton:' + (err as string)
})
return result
}
result.ok = true
result.messages.push('Configuration OK.')
return result
}