NextDom\Rest\Authenticator
Synopsis
class Authenticator
{
- // members
- private static Authenticator $instance;
- private Request $request;
- private bool $authenticated = false;
- private User $connectedUser = NULL;
- private $secret;
- // methods
- private void __construct()
- public static Authenticator init()
- public static Authenticator getInstance()
- public bool supportAuthentication()
- public bool isAuthenticated()
- public User|false checkCredentials()
- public string createTokenForUser()
- public bool checkSendedToken()
- private User|null getUserFromToken()
- public bool checkApiKey()
- public User getConnectedUser()
Members
private
- $authenticated — NextDom\Rest\bool
- $connectedUser — NextDom\Model\Entity\User
- $instance — NextDom\Rest\Authenticator
- $request — Symfony\Component\HttpFoundation\Request
- $secret — string
Methods
private
- __construct() — Private authenticator constructor with request for singleton
- getUserFromToken() — Get the user from the token
public
- checkApiKey() — Check API Key sended in URL (?apikey=MY_KEY)\n Consider connected like the first admin in database
- checkCredentials() — Check user credentials
- checkSendedToken() — Check if sended token is valid
- createTokenForUser() — Create user token for next request
- getConnectedUser() — Get current connected user
- getInstance() — Get instance of the singleton
- init() — Init authenticator instance
- isAuthenticated() — Authentication state of the request
- supportAuthentication() — Test if query use authentication