layout | title | nav_order |
---|---|---|
default |
Security |
13 |
This skeleton uses sessions (cookies) to handle the logged-in user.
You could also use the OAuth 2.0 authentication standard in combination with a Bearer-Token or a JSON Web Token.
lcobucci/jwt is a good library to work with JSON Web Token (JWT) and JSON Web Signature based on RFC 7519.
Please note that a logout functionality with tokens is not feasible without giving up the stateless principle.
It's up to you how you configure the routes and their individual authentication.
Read more:
This section is under construction!
Determine the logged-in user ID:
$userId = $this->auth->getUserId();
Checking the user role (permission group):
$isAdmin = $this->auth->hasRole(UserRole::ROLE_ADMIN);