mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
New OpenID and OAuth2 drivers (#8660)
* Moved over oauth impl to new interface * Fixed most build issues and started addind schema to auth drivers * Finished up OAuth2 and OpenID drivers * Removed unused migration and utils * Fixed minor todos * Removed old oauth flow * Changed oauth flow to re-use refresh token * Added new oauth frontend * Added font awesome social icons * Updated authentication documentation * Update api/src/auth/drivers/oauth2.ts * Tested implementation and fixed incorrect validation * Updated docs * Improved OAuth error handling and re-enabled creating users with provider/identifier * Removed Session config from docs * Update app/src/components/v-icon/v-icon.vue * Removed oauth need to define default roleID * Added FormatTitle to SSO links * Prevent local auth without password * Store OAuth access token in session data * Update docs/guides/api-config.md * Fixed copy and removed fontawesome-vue dependency * More docs fixes * Crucialy importend type fiks * Update package-lock * Remove is-email-allowed check In favor of more advanced version based on filtering coming later * Fix JSON type casting * Delete unused util * Update type signature to include name * Add warning when code isn't found in oauth url and remove obsolete imports * Auto-continue on successful SSO login * Tweak type signature * More type casting shenanigans * Please the TS gods * Check for missing token before crashing Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
import { Knex } from 'knex';
|
||||
import { SchemaOverview } from './schema';
|
||||
|
||||
export interface AuthDriverOptions {
|
||||
knex: Knex;
|
||||
schema: SchemaOverview;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
first_name: string | null;
|
||||
@@ -8,12 +16,15 @@ export interface User {
|
||||
role: string | null;
|
||||
provider: string;
|
||||
external_identifier: string | null;
|
||||
auth_data: string | Record<string, unknown> | null;
|
||||
}
|
||||
|
||||
export type SessionData = Record<string, any> | null;
|
||||
export type AuthData = Record<string, any> | null;
|
||||
|
||||
export interface Session {
|
||||
token: string;
|
||||
expires: Date;
|
||||
data: SessionData;
|
||||
data: string | null;
|
||||
}
|
||||
|
||||
export type SessionData = Record<string, any> | null;
|
||||
|
||||
10
api/src/types/express-session.d.ts
vendored
10
api/src/types/express-session.d.ts
vendored
@@ -1,10 +0,0 @@
|
||||
import { SessionData } from 'express-session';
|
||||
|
||||
export = SessionData;
|
||||
|
||||
declare module 'express-session' {
|
||||
interface SessionData {
|
||||
redirect: string;
|
||||
grant: any;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user