Adding some standard OpenID Connect providers (Google, Facebook) (WIP):
* frontend
This commit is contained in:
@ -85,14 +85,18 @@ async function getConverseJSParams (
|
||||
)
|
||||
} else {
|
||||
try {
|
||||
const customOidc = ExternalAuthOIDC.singleton('custom')
|
||||
if (await customOidc.isOk()) {
|
||||
const authUrl = customOidc.getConnectUrl()
|
||||
const buttonLabel = customOidc.getButtonLabel()
|
||||
if (authUrl && buttonLabel) {
|
||||
externalAuthOIDC = {
|
||||
buttonLabel: buttonLabel,
|
||||
url: authUrl
|
||||
const oidcs = ExternalAuthOIDC.allSingletons()
|
||||
for (const oidc of oidcs) {
|
||||
if (await oidc.isOk()) {
|
||||
const authUrl = oidc.getConnectUrl()
|
||||
const buttonLabel = oidc.getButtonLabel()
|
||||
if (authUrl && buttonLabel) {
|
||||
externalAuthOIDC ??= []
|
||||
externalAuthOIDC.push({
|
||||
type: oidc.type,
|
||||
buttonLabel: buttonLabel,
|
||||
url: authUrl
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { RegisterServerOptions } from '@peertube/peertube-types'
|
||||
import type { Request, Response, CookieOptions } from 'express'
|
||||
import type { ExternalAccountInfos, AcceptableAvatarMimeType } from './types'
|
||||
import type { ExternalAuthOIDCType } from '../../../shared/lib/types'
|
||||
import { ExternalAuthenticationError } from './error'
|
||||
import { getBaseRouterRoute } from '../helpers'
|
||||
import { canonicalizePluginUri } from '../uri/canonicalize'
|
||||
@ -68,8 +69,6 @@ async function getRandomBytes (size: number): Promise<Buffer> {
|
||||
})
|
||||
}
|
||||
|
||||
type ExternalAuthOIDCType = 'custom' | 'google' | 'facebook'
|
||||
|
||||
/**
|
||||
* This class handles the external OpenId Connect provider, if defined.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user