mirror of
https://github.com/thelounge/thelounge.git
synced 2026-03-14 14:35:50 +01:00
feat: AuthProvider and supporting types
This commit is contained in:
parent
b2e3112806
commit
f6ef500d79
1 changed files with 50 additions and 0 deletions
50
server/plugins/auth/types.ts
Normal file
50
server/plugins/auth/types.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import type ClientManager from "../../clientManager";
|
||||
import type Client from "../../client";
|
||||
|
||||
export interface GetValidUsersParams {
|
||||
users: string[];
|
||||
}
|
||||
|
||||
export interface AuthStartParams {
|
||||
socketId: string;
|
||||
}
|
||||
|
||||
export interface AuthenticateParams {
|
||||
manager: ClientManager;
|
||||
client: Client | null;
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface LogoutParams {
|
||||
sessionData?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface DisconnectParams {
|
||||
socketId: string;
|
||||
}
|
||||
|
||||
export interface AuthStartInfo {
|
||||
authUrl?: string;
|
||||
}
|
||||
|
||||
export type AuthResult =
|
||||
| {success: false}
|
||||
| {success: true; username: string; sessionData?: Record<string, unknown>};
|
||||
|
||||
export interface LogoutInfo {
|
||||
logoutUrl?: string;
|
||||
}
|
||||
|
||||
export interface AuthProvider {
|
||||
name: string;
|
||||
canChangePassword: boolean;
|
||||
|
||||
init(): Promise<void>;
|
||||
getValidUsers(params: GetValidUsersParams): Promise<string[]>;
|
||||
|
||||
authStart(params: AuthStartParams): AuthStartInfo;
|
||||
authenticate(params: AuthenticateParams): Promise<AuthResult>;
|
||||
logout(params: LogoutParams): LogoutInfo;
|
||||
disconnect(params: DisconnectParams): void;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue