class CookieAuthenticationHandler implements AuthenticationHandler (View source)

Authenticate a member passed on a session cookie

Methods

public
string
getDeviceCookieName()

Get the name of the cookie used to track this device

public
setDeviceCookieName(string $deviceCookieName)

Set the name of the cookie used to track this device

public
string
getTokenCookieName()

Get the name of the cookie used to store an login token

public
setTokenCookieName(string $tokenCookieName)

Set the name of the cookie used to store an login token

public
bool
getTokenCookieSecure()

Get whether the cookie used to store an login token is "secure" or not

public
setTokenCookieSecure(bool $tokenCookieSecure)

Set whether the cookie used to store an login token is "secure" or not

public
string
getTokenCookieSameSite()

Get the "SameSite" attribute of authentication token cookies.

public
setTokenCookieSameSite(string $tokenCookieSameSite)

Set the "SameSite" attribute of authentication token cookies.

public
getCascadeInTo()

Once a member is found by authenticateRequest() pass it to this identity store

public
$this
setCascadeInTo(IdentityStore $cascadeInTo)

Set the name of the cookie used to store an login token

public
Member|null
authenticateRequest(HTTPRequest $request)

No description

public
logIn(Member $member, bool $persistent = false, HTTPRequest|null $request = null)

No description

public
logOut(HTTPRequest|null $request = null)

No description

protected
clearCookies()

Clear the cookies set for the user

Details

string getDeviceCookieName()

Get the name of the cookie used to track this device

Return Value

string

CookieAuthenticationHandler setDeviceCookieName(string $deviceCookieName)

Set the name of the cookie used to track this device

Parameters

string $deviceCookieName

Return Value

CookieAuthenticationHandler

string getTokenCookieName()

Get the name of the cookie used to store an login token

Return Value

string

CookieAuthenticationHandler setTokenCookieName(string $tokenCookieName)

Set the name of the cookie used to store an login token

Parameters

string $tokenCookieName

Return Value

CookieAuthenticationHandler

bool getTokenCookieSecure()

Get whether the cookie used to store an login token is "secure" or not

Return Value

bool

CookieAuthenticationHandler setTokenCookieSecure(bool $tokenCookieSecure)

Set whether the cookie used to store an login token is "secure" or not

Parameters

bool $tokenCookieSecure

Return Value

CookieAuthenticationHandler

string getTokenCookieSameSite()

Get the "SameSite" attribute of authentication token cookies.

Empty string means the value from Cookie.default_samesite will be used.

Return Value

string

CookieAuthenticationHandler setTokenCookieSameSite(string $tokenCookieSameSite)

Set the "SameSite" attribute of authentication token cookies.

Setting to an empty string means the value from Cookie.default_samesite will be used.

Parameters

string $tokenCookieSameSite

Return Value

CookieAuthenticationHandler

IdentityStore getCascadeInTo()

Once a member is found by authenticateRequest() pass it to this identity store

Return Value

IdentityStore

$this setCascadeInTo(IdentityStore $cascadeInTo)

Set the name of the cookie used to store an login token

Parameters

IdentityStore $cascadeInTo

Return Value

$this

Member|null authenticateRequest(HTTPRequest $request)

No description

Parameters

HTTPRequest $request

The current HTTP request

Return Value

Member|null

The authenticated Member, or null if this auth mechanism isn't used.

logIn(Member $member, bool $persistent = false, HTTPRequest|null $request = null)

No description

Parameters

Member $member

The member to log in.

bool $persistent

boolean If set to true, the login may persist beyond the current session.

HTTPRequest|null $request

The request of the visitor that is logging in, to get, for example, cookies.

logOut(HTTPRequest|null $request = null)

No description

Parameters

HTTPRequest|null $request

The request of the visitor that is logging out, to get, for example, cookies.

protected clearCookies()

Clear the cookies set for the user