Authenticator
in
Interface Authenticator
This interface defines the contract for authentication mechanisms. Implementing classes should provide the necessary methods to handle authentication logic, such as verifying credentials and managing user sessions.
Table of Contents
Methods
- isAuthenticated() : bool
- Determines if the given user is authenticated.
- login() : void
- Logs in the given user.
- logout() : void
- Logs out the given user.
- resolve() : Authenticatable|null
- Resolves and returns an instance of an object implementing the Authenticatable interface.
Methods
isAuthenticated()
Determines if the given user is authenticated.
public
isAuthenticated(Authenticatable $user) : bool
Parameters
- $user : Authenticatable
-
The user instance to check authentication for.
Return values
bool —True if the user is authenticated, false otherwise.
login()
Logs in the given user.
public
login(Authenticatable $user) : void
Parameters
- $user : Authenticatable
-
The user instance to log in.
logout()
Logs out the given user.
public
logout(Authenticatable $user) : void
Parameters
- $user : Authenticatable
-
The user instance to be logged out.
resolve()
Resolves and returns an instance of an object implementing the Authenticatable interface.
public
resolve() : Authenticatable|null
Return values
Authenticatable|null —Returns an instance of Authenticatable if resolution is successful, or null if no authenticatable entity could be resolved.