2025-06-07 17:28:15 +00:00
|
|
|
import * as plugins from '../plugins.js';
|
|
|
|
|
import * as authInterfaces from '../data/auth.js';
|
|
|
|
|
|
2026-05-14 00:30:09 +00:00
|
|
|
export type TAdminLoginAuthSource = 'auto' | 'local' | 'idp.global';
|
|
|
|
|
|
|
|
|
|
export interface IAdminUserProjection {
|
|
|
|
|
id: string;
|
|
|
|
|
username: string;
|
|
|
|
|
email?: string;
|
|
|
|
|
name?: string;
|
|
|
|
|
role: string;
|
|
|
|
|
status?: 'active' | 'disabled';
|
|
|
|
|
authSources?: Array<'local' | 'idp.global'>;
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-07 17:28:15 +00:00
|
|
|
// Admin Login
|
|
|
|
|
export interface IReq_AdminLoginWithUsernameAndPassword extends plugins.typedrequestInterfaces.implementsTR<
|
|
|
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
|
|
|
IReq_AdminLoginWithUsernameAndPassword
|
|
|
|
|
> {
|
|
|
|
|
method: 'adminLoginWithUsernameAndPassword';
|
|
|
|
|
request: {
|
|
|
|
|
username: string;
|
|
|
|
|
password: string;
|
2026-05-14 00:30:09 +00:00
|
|
|
authSource?: TAdminLoginAuthSource;
|
|
|
|
|
};
|
|
|
|
|
response: {
|
|
|
|
|
identity?: authInterfaces.IIdentity;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Admin bootstrap status
|
|
|
|
|
export interface IReq_GetAdminBootstrapStatus extends plugins.typedrequestInterfaces.implementsTR<
|
|
|
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
|
|
|
IReq_GetAdminBootstrapStatus
|
|
|
|
|
> {
|
|
|
|
|
method: 'getAdminBootstrapStatus';
|
|
|
|
|
request: {};
|
|
|
|
|
response: {
|
|
|
|
|
dbEnabled: boolean;
|
|
|
|
|
dbReady: boolean;
|
|
|
|
|
hasPersistentAdmin: boolean;
|
|
|
|
|
needsBootstrap: boolean;
|
|
|
|
|
ephemeralAdminAvailable: boolean;
|
|
|
|
|
idpGlobalConfigured: boolean;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create the first persisted admin account. Requires the bootstrap/ephemeral admin identity.
|
|
|
|
|
export interface IReq_CreateInitialAdminUser extends plugins.typedrequestInterfaces.implementsTR<
|
|
|
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
|
|
|
IReq_CreateInitialAdminUser
|
|
|
|
|
> {
|
|
|
|
|
method: 'createInitialAdminUser';
|
|
|
|
|
request: {
|
|
|
|
|
identity: authInterfaces.IIdentity;
|
|
|
|
|
email: string;
|
|
|
|
|
name?: string;
|
|
|
|
|
password: string;
|
|
|
|
|
enableIdpGlobalAuth?: boolean;
|
2025-06-07 17:28:15 +00:00
|
|
|
};
|
|
|
|
|
response: {
|
2026-05-14 00:30:09 +00:00
|
|
|
success: boolean;
|
2025-06-07 17:28:15 +00:00
|
|
|
identity?: authInterfaces.IIdentity;
|
2026-05-14 00:30:09 +00:00
|
|
|
user?: IAdminUserProjection;
|
2025-06-07 17:28:15 +00:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Admin Logout
|
|
|
|
|
export interface IReq_AdminLogout extends plugins.typedrequestInterfaces.implementsTR<
|
|
|
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
|
|
|
IReq_AdminLogout
|
|
|
|
|
> {
|
|
|
|
|
method: 'adminLogout';
|
|
|
|
|
request: {
|
|
|
|
|
identity: authInterfaces.IIdentity;
|
|
|
|
|
};
|
|
|
|
|
response: {
|
|
|
|
|
success: boolean;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Verify Identity
|
|
|
|
|
export interface IReq_VerifyIdentity extends plugins.typedrequestInterfaces.implementsTR<
|
|
|
|
|
plugins.typedrequestInterfaces.ITypedRequest,
|
|
|
|
|
IReq_VerifyIdentity
|
|
|
|
|
> {
|
|
|
|
|
method: 'verifyIdentity';
|
|
|
|
|
request: {
|
|
|
|
|
identity: authInterfaces.IIdentity;
|
|
|
|
|
};
|
|
|
|
|
response: {
|
|
|
|
|
valid: boolean;
|
|
|
|
|
identity?: authInterfaces.IIdentity;
|
|
|
|
|
};
|
2026-05-14 00:30:09 +00:00
|
|
|
}
|