major: Migration from better-auth to keycloak
This commit is contained in:
20
legalconsenthub/types/auth.d.ts
vendored
Normal file
20
legalconsenthub/types/auth.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
declare module '#auth-utils' {
|
||||
interface User {
|
||||
keycloakId: string
|
||||
name: string
|
||||
organizations: Organization[]
|
||||
}
|
||||
|
||||
interface UserSession {
|
||||
name: string
|
||||
organizations: Organization[]
|
||||
loggedInAt: number
|
||||
jwt: {
|
||||
accessToken: string
|
||||
refreshToken: string
|
||||
expiresIn: number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {}
|
||||
@@ -1,27 +0,0 @@
|
||||
import type { RouteLocationRaw } from '#vue-router'
|
||||
import type { useAuthClient } from '~/composables/auth/useAuthClient'
|
||||
|
||||
export interface RuntimeAuthConfig {
|
||||
redirectUserTo: RouteLocationRaw | string
|
||||
redirectGuestTo: RouteLocationRaw | string
|
||||
}
|
||||
|
||||
// Types can be found here: https://github.com/better-auth/better-auth/blob/3f574ec70bb15c155a78673d42c5e25f7376ced3/packages/better-auth/src/plugins/organization/routes/crud-invites.ts#L531
|
||||
type Client = ReturnType<typeof useAuthClient>['client']
|
||||
export type Session = Client['$Infer']['Session']
|
||||
export type User = Session['user']
|
||||
export type ActiveOrganization = Client['$Infer']['ActiveOrganization']
|
||||
export type Organization = Client['$Infer']['Organization']
|
||||
export type Invitation = Client['$Infer']['Invitation']
|
||||
export type Member = Client['$Infer']['Member']
|
||||
export type ListMembersOptions = Parameters<Client['organization']['listMembers']>[0]
|
||||
export type ListMembersResponse = Awaited<ReturnType<Client['organization']['listMembers']>>['data']
|
||||
export type ListMembersQuery = NonNullable<ListMembersOptions>['query']
|
||||
// Extended invitation type with additional organization and inviter details
|
||||
export type CustomInvitation =
|
||||
| (Invitation & {
|
||||
organizationName: string
|
||||
organizationSlug: string
|
||||
inviterEmail: string
|
||||
})
|
||||
| null
|
||||
13
legalconsenthub/types/keycloak.ts
Normal file
13
legalconsenthub/types/keycloak.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export interface KeycloakTokenPayload {
|
||||
name?: string
|
||||
preferred_username?: string
|
||||
given_name?: string
|
||||
family_name?: string
|
||||
email?: string
|
||||
organization?: Record<string, { id?: string }>
|
||||
}
|
||||
|
||||
export interface Organization {
|
||||
name: string
|
||||
id: string
|
||||
}
|
||||
7
legalconsenthub/types/oAuth.ts
Normal file
7
legalconsenthub/types/oAuth.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export interface OAuthTokenResponse {
|
||||
access_token: string
|
||||
refresh_token: string
|
||||
token_type: string
|
||||
expires_in: number
|
||||
scope: string
|
||||
}
|
||||
Reference in New Issue
Block a user