fix issues in core
This commit is contained in:
@@ -1,8 +1,27 @@
|
||||
import type { AuthenticatedUserDTO } from '../dto/AuthenticatedUserDTO';
|
||||
import type { AuthCallbackCommandDTO } from '../dto/AuthCallbackCommandDTO';
|
||||
import type { StartAuthCommandDTO } from '../dto/StartAuthCommandDTO';
|
||||
export type AuthProvider = 'IRACING_DEMO';
|
||||
|
||||
export interface StartAuthCommand {
|
||||
provider: AuthProvider;
|
||||
returnTo?: string;
|
||||
}
|
||||
|
||||
export interface AuthCallbackCommand {
|
||||
provider: AuthProvider;
|
||||
code: string;
|
||||
state: string;
|
||||
returnTo?: string;
|
||||
}
|
||||
|
||||
export interface AuthenticatedUser {
|
||||
id: string;
|
||||
displayName: string;
|
||||
email?: string;
|
||||
iracingCustomerId?: string;
|
||||
primaryDriverId?: string;
|
||||
avatarUrl?: string;
|
||||
}
|
||||
|
||||
export interface IdentityProviderPort {
|
||||
startAuth(command: StartAuthCommandDTO): Promise<{ redirectUrl: string; state: string }>;
|
||||
completeAuth(command: AuthCallbackCommandDTO): Promise<AuthenticatedUserDTO>;
|
||||
startAuth(command: StartAuthCommand): Promise<{ redirectUrl: string; state: string }>;
|
||||
completeAuth(command: AuthCallbackCommand): Promise<AuthenticatedUser>;
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
import type { AuthenticatedUserDTO } from '../dto/AuthenticatedUserDTO';
|
||||
import type { AuthSessionDTO } from '../dto/AuthSessionDTO';
|
||||
import type { AuthenticatedUser } from './IdentityProviderPort';
|
||||
|
||||
// TODO not so sure if this here is proper clean architecture
|
||||
export interface AuthSession {
|
||||
user: AuthenticatedUser;
|
||||
issuedAt: number;
|
||||
expiresAt: number;
|
||||
token: string;
|
||||
}
|
||||
|
||||
// Application port for session access/persistence (implemented by adapters).
|
||||
export interface IdentitySessionPort {
|
||||
getCurrentSession(): Promise<AuthSessionDTO | null>;
|
||||
createSession(user: AuthenticatedUserDTO): Promise<AuthSessionDTO>;
|
||||
getCurrentSession(): Promise<AuthSession | null>;
|
||||
createSession(user: AuthenticatedUser): Promise<AuthSession>;
|
||||
clearSession(): Promise<void>;
|
||||
}
|
||||
Reference in New Issue
Block a user