chore: seminarhof customer project
This commit is contained in:
20
apps/app/src/auth/providers/_types.ts
Normal file
20
apps/app/src/auth/providers/_types.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { ComponentType } from 'react'
|
||||
|
||||
/**
|
||||
* Shape every auth provider file exports.
|
||||
*
|
||||
* Providers are shadcn-style: copy from `providers/*.ts.inactive` into an
|
||||
* active `.ts` file and register in `auth.config.ts`. Backend OAuth routes
|
||||
* live in `@project/functions/src/auth/*`.
|
||||
*/
|
||||
export interface AuthProvider {
|
||||
id: 'auth0' | 'email' | 'github' | 'google' | 'microsoft' | 'passwordless'
|
||||
labelKey: string
|
||||
Icon: ComponentType<{ size?: number | string }>
|
||||
/** Variant tone used for provider button treatment. */
|
||||
tone: 'primary' | 'secondary' | 'default'
|
||||
/** Required env var names — surfaced by the console's auth browser. */
|
||||
envVars: string[]
|
||||
/** Kicks off the login flow. May redirect (OAuth) or open a modal (email). */
|
||||
login(): Promise<void> | void
|
||||
}
|
||||
22
apps/app/src/auth/providers/auth0.ts
Normal file
22
apps/app/src/auth/providers/auth0.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Lock } from 'lucide-react'
|
||||
import type { AuthProvider } from './_types'
|
||||
|
||||
/**
|
||||
* Auth0 — default provider. Universal login gives email + password out of
|
||||
* the box; social providers (GitHub / Google / etc.) configured on the
|
||||
* Auth0 tenant side, not in this file.
|
||||
*
|
||||
* Secrets (`AUTH0_DOMAIN`, `AUTH0_CLIENT_ID`, `AUTH0_CLIENT_SECRET`) are
|
||||
* read by the backend via `secrets.getSecret()`. This client file never
|
||||
* sees them.
|
||||
*/
|
||||
export const auth0: AuthProvider = {
|
||||
id: 'auth0',
|
||||
labelKey: 'auth:providers.auth0',
|
||||
Icon: Lock,
|
||||
tone: 'primary',
|
||||
envVars: ['AUTH0_DOMAIN', 'AUTH0_CLIENT_ID', 'AUTH0_CLIENT_SECRET'],
|
||||
login: () => {
|
||||
window.location.href = '/auth/auth0/login'
|
||||
},
|
||||
}
|
||||
13
apps/app/src/auth/providers/github.ts.inactive
Normal file
13
apps/app/src/auth/providers/github.ts.inactive
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Github } from 'lucide-react'
|
||||
import type { AuthProvider } from './_types'
|
||||
|
||||
export const github: AuthProvider = {
|
||||
id: 'github',
|
||||
labelKey: 'auth:providers.github',
|
||||
Icon: Github,
|
||||
tone: 'default',
|
||||
envVars: ['GITHUB_CLIENT_ID', 'GITHUB_CLIENT_SECRET'],
|
||||
login: () => {
|
||||
window.location.href = '/auth/github/login'
|
||||
},
|
||||
}
|
||||
13
apps/app/src/auth/providers/google.ts.inactive
Normal file
13
apps/app/src/auth/providers/google.ts.inactive
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Chrome } from 'lucide-react'
|
||||
import type { AuthProvider } from './_types'
|
||||
|
||||
export const google: AuthProvider = {
|
||||
id: 'google',
|
||||
labelKey: 'auth:providers.google',
|
||||
Icon: Chrome,
|
||||
tone: 'default',
|
||||
envVars: ['GOOGLE_CLIENT_ID', 'GOOGLE_CLIENT_SECRET'],
|
||||
login: () => {
|
||||
window.location.href = '/auth/google/login'
|
||||
},
|
||||
}
|
||||
13
apps/app/src/auth/providers/microsoft.ts.inactive
Normal file
13
apps/app/src/auth/providers/microsoft.ts.inactive
Normal file
@@ -0,0 +1,13 @@
|
||||
import { KeyRound } from 'lucide-react'
|
||||
import type { AuthProvider } from './_types'
|
||||
|
||||
export const microsoft: AuthProvider = {
|
||||
id: 'microsoft',
|
||||
labelKey: 'auth:providers.microsoft',
|
||||
Icon: KeyRound,
|
||||
tone: 'default',
|
||||
envVars: ['MS_CLIENT_ID', 'MS_CLIENT_SECRET', 'MS_TENANT_ID'],
|
||||
login: () => {
|
||||
window.location.href = '/auth/microsoft/login'
|
||||
},
|
||||
}
|
||||
13
apps/app/src/auth/providers/passwordless.ts.inactive
Normal file
13
apps/app/src/auth/providers/passwordless.ts.inactive
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Fingerprint } from 'lucide-react'
|
||||
import type { AuthProvider } from './_types'
|
||||
|
||||
export const passwordless: AuthProvider = {
|
||||
id: 'passwordless',
|
||||
labelKey: 'auth:providers.passwordless',
|
||||
Icon: Fingerprint,
|
||||
tone: 'default',
|
||||
envVars: ['SMTP_HOST', 'SMTP_USER', 'SMTP_PASS'],
|
||||
login: () => {
|
||||
window.location.href = '/auth/passwordless/request'
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user