Pickles Framework Documentation

SessionAuthenticator
in package
implements Authenticator

Class SessionAuthenticator

This class implements the Authenticator interface and provides authentication functionality using session-based mechanisms.

Table of Contents

Interfaces

Authenticator
Interface Authenticator

Methods

isAuthenticated()  : bool
Checks if the given authenticatable entity is authenticated.
login()  : void
Logs in the given authenticatable user by storing their information in the session under a predefined key.
logout()  : void
Logs out the given authenticatable user by removing their authentication session.
resolve()  : Authenticatable|null
Resolves and retrieves the authenticated user from the session.

Methods

isAuthenticated()

Checks if the given authenticatable entity is authenticated.

public isAuthenticated(Authenticatable $authenticatable) : bool

This method compares the ID of the current session's authenticated user with the ID of the provided authenticatable entity to determine if they match.

Parameters
$authenticatable : Authenticatable

The entity to check authentication for.

Return values
bool

True if the entity is authenticated, false otherwise.

login()

Logs in the given authenticatable user by storing their information in the session under a predefined key.

public login(Authenticatable $authenticatable) : void
Parameters
$authenticatable : Authenticatable

The user instance to be logged in.

resolve()

Resolves and retrieves the authenticated user from the session.

public resolve() : Authenticatable|null
Return values
Authenticatable|null

Returns an instance of the authenticated user if found in the session, or null if no user is authenticated.


        
On this page

Search results