import { Container } from "inversify"; import { WorkflowBase, StatusResponse, FluentScenarioConfigurator } from "@mfreydl/toyhauler-api-framework/apiCore/scenario-based-workflow"; import { TenantUser } from "toyhauler-common/security"; /** The ultimate target state for the authentication process. * The workflow will utilize a partial of this class until it is able to fully populate it. */ export declare class AuthenticationContext { token: string; login: string; password: string; passwordConfirmation: string; tenantCode: string; registerUser: boolean; registerTenant: boolean; constructor(token: string, login: string, password: string, passwordConfirmation: string, tenantCode: string, registerUser?: boolean, registerTenant?: boolean); } /** The entities and values produced by the authentication workflow. */ export declare class AuthenticationOutput { token?: string | undefined; user?: TenantUser | undefined; /** * @param token The JWT token provided if authentication was successful. May or may not be a tenant context token. */ constructor(token?: string | undefined, user?: TenantUser | undefined); } export declare enum LoginStage { missingUsername = "missingUsername", missingPassword = "missingPassword", loginException = "loginException", InvalidCreds = "InvalidCreds", userNotRegisteredWithGivenTenant = "userNotRegisteredWithGivenTenant", /** User with tenant profiles is successfully authenticated * as a principal without an active tenant profile. * The user will need to authenticate under one of its tenants * to gain access to the tenant scope of the app. */ principalLoggedInWithoutTenant = "principalLoggedInWithoutTenant", /** User with ZERO tenant profiles is successfully authenticated * as a principal without an active tenant profile. * The user will need to register under (or be invited into) a tenant * to gain access to any tenant scope of the app. */ principalLoggedInButHasNoTenants = "principalLoggedInButHasNoTenants", complete = "complete", /** No tenant was specified, but the user is only registered under a single tenant, * so the system successfully authenticated the user under that tenant profile. */ completedWithTheUsersOnlyTenant = "completedWithTheUsersOnlyTenant" } /** For issuing a JWT token for a single user under a single tenant. */ export declare class AuthenticationWorkflow extends WorkflowBase { private ioc; constructor(ioc: Container); respondTo(...scenarioIds: LoginStage[]): FluentScenarioConfigurator; protected attemptProcess(context: Partial): Promise>; }