class CreateFreshApiToken

Methods

__construct(ApiTokenCookieFactory $cookieFactory)

Create a new middleware instance.

static string
using(string|null $guard = null)

Specify the guard for the middleware.

Response
handle(Request $request, Closure $next, string|null $guard = null)

Handle an incoming request.

bool
shouldReceiveFreshToken(Request $request, Response $response, string|null $guard)

Determine if the given request should receive a fresh token.

bool
requestShouldReceiveFreshToken(Request $request, string|null $guard)

Determine if the request should receive a fresh token.

bool
responseShouldReceiveFreshToken(Response $response)

Determine if the response should receive a fresh token.

bool
alreadyContainsToken(Response $response)

Determine if the given response already contains an API token.

Details

at line 20
__construct(ApiTokenCookieFactory $cookieFactory)

Create a new middleware instance.

Parameters

ApiTokenCookieFactory $cookieFactory

at line 28
static string using(string|null $guard = null)

Specify the guard for the middleware.

Parameters

string|null $guard

Return Value

string

at line 40
Response handle(Request $request, Closure $next, string|null $guard = null)

Handle an incoming request.

Parameters

Request $request
Closure $next
string|null $guard

Return Value

Response

at line 59
protected bool shouldReceiveFreshToken(Request $request, Response $response, string|null $guard)

Determine if the given request should receive a fresh token.

Parameters

Request $request
Response $response
string|null $guard

Return Value

bool

at line 68
protected bool requestShouldReceiveFreshToken(Request $request, string|null $guard)

Determine if the request should receive a fresh token.

Parameters

Request $request
string|null $guard

Return Value

bool

at line 76
protected bool responseShouldReceiveFreshToken(Response $response)

Determine if the response should receive a fresh token.

Parameters

Response $response

Return Value

bool

at line 88
protected bool alreadyContainsToken(Response $response)

Determine if the given response already contains an API token.

This avoids us overwriting a just "refreshed" token.

Parameters

Response $response

Return Value

bool