The Authentication Provider handles a authentication for a user.
The easiest way to use the Auth Manager is access to it through the container
Otherwise just add the following parameter to the construct method of your Controller
Tomahawk\Authentication\AuthenticationProviderInterface and it will get injected in through the Service Container.
Tomahawk ships with 2 Authentication Providers:
- Memory - A simple provider that uses a username and password from the security config
- Doctrine - A proider that uses the Doctrine ORM
The config for Authentication Provider can be found in the
and will look like the following.
Creating a User model
Your User class needs to implement the
You should have a model which looks something like the following:
To authenticate a user to pass the username and password to the
Manual Authentication With Extra Checks
You might want to also check other parts of the account:
Checking If User Is Logged In
Checking If User Is Guest
Logout A User
Getting The Logged In User
Logging Out The User
Automatically Logging In A Users
If you already have the user model you can pass this the the auth manager to log them in: