import type { Request } from "../Http/Request"; import type { Authenticatable, Credentials } from "../Contracts/Auth/Authenticatable"; import type { StatefulGuard } from "../Contracts/Auth/StatefulGuard"; import type { UserProvider } from "../Contracts/Auth/UserProvider"; import type SessionManager from "../Session/SessionManager"; import GuardHelper from "./GuardHelpers"; import Recaller from "./Recaller"; declare class SessionGuard extends GuardHelper implements StatefulGuard { name: string; provider: UserProvider; session: SessionManager; request: Request; lastAttempted: Authenticatable | undefined; /** * The number of minutes that the "remember me" cookie should be valid for. */ protected rememberDuration: number; protected loggedOut: boolean; /** * Indicates if a token user retrieval has been attempted. */ protected recallAttempted: boolean; /** * Indicates if the user was authenticated via a recaller cookie. */ protected viaRemember: boolean; constructor(name: string, provider: UserProvider, session: SessionManager, request: Request); validate(credentials: Credentials): Promise; once(credentials: Credentials): Promise; attempt(credentials?: Credentials, remember?: boolean): Promise; protected hasValidCredentials(user: Authenticatable | undefined, credentials: Credentials): boolean; login(user: Authenticatable, remember?: boolean): Promise; /** * Queue the recaller cookie into the cookie jar. */ protected queueRecallerCookie(user: Authenticatable): void; /** * Create a "remember me" cookie for a given ID. */ protected createRecaller(value: string): import("../Foundation/Http/Cookie").default; /** * Get the number of minutes the remember me cookie should be valid for. */ protected getRememberDuration(): number; /** * Set the number of minutes the remember me cookie should be valid for. */ setRememberDuration(minutes: number): this; /** * Create a new "remember me" token for the user if one doesn't already exist. */ protected ensureRememberTokenIsSet(user: Authenticatable): Promise; /** * Refresh the "remember me" token for the user. */ protected cycleRememberToken(user: Authenticatable): Promise; logout(): Promise; setUser(user: Authenticatable): this; getName(): string; protected updateSession(id: string): Promise; user(): Promise; /** * Pull a user from the repository by its "remember me" cookie token. */ protected userFromRecaller(recaller: Recaller): Promise; /** * Get the decrypted recaller cookie for the request. */ protected recaller(): Recaller | undefined; /** * Get the name of the cookie used to store the "recaller". */ protected getRecallerName(): string; /** * Remove the user data from the session and cookies. */ protected clearUserDataFromStorage(): void; } export default SessionGuard;