AuthenticationTokenSimple
in package
implements
AuthenticationInterface
Table of Contents
Interfaces
Constants
- ERROR_INVALID_SESSION_KEY = 'INVALID_SESSION_KEY'
Properties
Methods
- __construct() : mixed
- Constructor
- createSession() : Session
- Create session key
- getTokenData() : array<string|int, mixed>
- Get Token Data
- isAuthenticated() : bool
- Check Key
- login() : array<string|int, mixed>
- Login with username and password
- logout() : void
- Logout
- refresh() : array<string|int, mixed>
- Refresh token
Constants
ERROR_INVALID_SESSION_KEY
public
mixed
ERROR_INVALID_SESSION_KEY
= 'INVALID_SESSION_KEY'
Properties
$formatterDateTimeToJson
protected
FormatterDateTimeToJson
$formatterDateTimeToJson
$sessionUtil
protected
SessionUtil
$sessionUtil
Methods
__construct()
Constructor
public
__construct(SessionUtil $sessionUtil, FormatterDateTimeToJson $formatterDateTimeToJson) : mixed
Parameters
- $sessionUtil : SessionUtil
- $formatterDateTimeToJson : FormatterDateTimeToJson
createSession()
Create session key
public
createSession(string $username) : Session
Parameters
- $username : string
-
The username
Return values
SessiongetTokenData()
Get Token Data
public
getTokenData(Session $session, string|int $userId) : array<string|int, mixed>
Parameters
- $session : Session
- $userId : string|int
Return values
array<string|int, mixed>isAuthenticated()
Check Key
public
isAuthenticated(string $token) : bool
Check if the session key is valid. If yes returns true, otherwise false and sends an error message with error code 1
Parameters
- $token : string
Return values
boollogin()
Login with username and password
public
login(string $username, string $password) : array<string|int, mixed>
Parameters
- $username : string
- $password : string
Return values
array<string|int, mixed>logout()
Logout
public
logout(string $token) : void
Parameters
- $token : string
refresh()
Refresh token
public
refresh(string $token) : array<string|int, mixed>
Parameters
- $token : string