class AuthenticateSession implements AuthenticatesSessions

Properties

static protected null|callable $redirectToCallback

The callback that should be used to generate the authentication redirect path.

Methods

__construct(Factory $auth)

Create a new middleware instance.

mixed
handle(Request $request, Closure $next)

Handle an incoming request.

void
storePasswordHashInSession(Request $request)

Store the user's current password hash in the session.

bool
validatePasswordHash(string $passwordHash, mixed $storedValue)

Validate the password hash against the stored value.

void
logout(Request $request)

Log the user out of the application.

guard()

Get the guard instance that should be used by the middleware.

string|null
redirectTo(Request $request)

Get the path the user should be redirected to when their session is not authenticated.

static void
redirectUsing(callable $redirectToCallback)

Specify the callback that should be used to generate the redirect path.

static void
flushState()

Flush all static state.

Details

at line 26
__construct(Factory $auth)

Create a new middleware instance.

Parameters

Factory $auth

at line 34
mixed handle(Request $request, Closure $next)

Handle an incoming request.

Parameters

Request $request
Closure $next

Return Value

mixed

at line 69
protected void storePasswordHashInSession(Request $request)

Store the user's current password hash in the session.

Parameters

Request $request

Return Value

void

at line 91
protected bool validatePasswordHash(string $passwordHash, mixed $storedValue)

Validate the password hash against the stored value.

Only HMAC artifacts are valid. Custom guards must provide hashPasswordForCookie(); the raw-hash and missing-method fallbacks are intentionally omitted.

Parameters

string $passwordHash
mixed $storedValue

Return Value

bool

at line 102
protected void logout(Request $request)

Log the user out of the application.

Parameters

Request $request

Return Value

void

Exceptions

AuthenticationException

at line 118
protected Factory|Guard guard()

Get the guard instance that should be used by the middleware.

Return Value

Factory|Guard

at line 126
protected string|null redirectTo(Request $request)

Get the path the user should be redirected to when their session is not authenticated.

Parameters

Request $request

Return Value

string|null

at line 141
static void redirectUsing(callable $redirectToCallback)

Specify the callback that should be used to generate the redirect path.

Boot-only. The callback persists in a static property for the worker lifetime and runs on every subsequent session-mismatch.

Parameters

callable $redirectToCallback

Return Value

void

at line 149
static void flushState()

Flush all static state.

Return Value

void