import type { PRGLIOSocket } from "../DboBuilder/DboBuilder"; import type { DBOFullyTyped } from "../DBSchemaBuilder/DBSchemaBuilder"; import type { Prostgles } from "../Prostgles"; import type { AuthClientRequest, AuthConfig, BasicSession } from "./AuthTypes"; import { getClientRequestIPsInfo } from "./utils/getClientRequestIPsInfo"; import { type GetUserOrRedirected } from "./utils/handleGetUser"; import { removeExpressRoute, removeExpressRoutesTest } from "./utils/removeExpressRoute"; export { getClientRequestIPsInfo, removeExpressRoute, removeExpressRoutesTest }; export declare const HTTP_FAIL_CODES: { readonly UNAUTHORIZED: 401; readonly NOT_FOUND: 404; readonly BAD_REQUEST: 400; readonly INTERNAL_SERVER_ERROR: 500; readonly CONFLICT: 409; readonly TOO_MANY_REQUESTS: 429; }; export declare const HTTP_SUCCESS_CODES: { readonly OK: 200; readonly CREATED: 201; }; export declare const EXPRESS_CATCH_ALL_ROUTE = "*splat"; export declare const AUTH_RETURN_URL_PARAM_NAME = "returnURL"; export declare const AUTH_ROUTES: { readonly login: "/login"; readonly loginWithProvider: "/oauth"; readonly emailRegistration: "/register"; readonly logout: "/logout"; readonly magicLinks: "/magic-link"; readonly magicLinkWithId: "/magic-link/:id"; }; export declare const GET_AUTH_ROUTE: (conf: AuthConfig["loginSignupConfig"], route: keyof typeof AUTH_ROUTES) => string; export declare const GET_ALL_AUTH_ROUTES: (conf: AuthConfig["loginSignupConfig"]) => { [K in keyof typeof AUTH_ROUTES]: string; }; export declare class AuthHandler { protected readonly prostgles: Prostgles; protected readonly opts: Omit & { getUser?: undefined | AuthConfig["getUser"]; }; get dbHandles(): { dbo: DBOFullyTyped; db: import("../Prostgles").DB; }; constructor(prostgles: Prostgles); get sidKeyName(): string; get authRoutes(): { readonly login: string; readonly loginWithProvider: string; readonly emailRegistration: string; readonly logout: string; readonly magicLinks: string; readonly magicLinkWithId: string; }; init: () => void; validateSid: (sid: string | undefined) => string | undefined; isUserRoute: (pathname: string) => boolean; setCookieAndGoToReturnURLIFSet: (cookie: { sid: string; expires: number; }, requestHandler: { req: import("./AuthTypes").ExpressReq; res: import("./endpoints/setLoginRequestHandler").LoginResponseHandler; }) => void; validateSessionAndSetCookie: (cookie: { sid: string; expires: number; }, requestHandler: { req: import("./AuthTypes").ExpressReq; res: import("./endpoints/setLoginRequestHandler").LoginResponseHandler; }) => void | import("./endpoints/setLoginRequestHandler").LoginResponseHandler; handleGetUser: (clientReq: AuthClientRequest) => Promise; /** * Used by: * - setCatchAllRequestHandler * - loginSignupConfig.use */ getUserOrError: (clientReq: AuthClientRequest) => Promise; destroy: () => void; login: (req: import("./AuthTypes").ExpressReq, res: import("./endpoints/setLoginRequestHandler").LoginResponseHandler, loginParams: import("./AuthTypes").LoginParams) => Promise; /** * Will return first sid value found in: * - Bearer header * - http cookie * - query params * Based on sidKeyName from auth */ getValidatedSid(maybeClientReq: AuthClientRequest | undefined): string | undefined; /** * Used for logging */ getSIDNoError: (clientReq: AuthClientRequest | undefined) => string | undefined; getSidAndUserFromRequest: (clientReq: AuthClientRequest) => Promise; isNonExpiredSocketSession: (socket: PRGLIOSocket, session: BasicSession | undefined) => boolean; getClientAuth: (clientReq: AuthClientRequest) => Promise<{ auth: import("prostgles-types").AuthSocketSchema; userData: import("./AuthTypes").AuthResultWithSID; } | "new-session-redirect">; } //# sourceMappingURL=AuthHandler.d.ts.map