Skip to content

Commit be24dd8

Browse files
author
Nicolas Heist
committed
TASK: Add info on how to integrate to README
1 parent 2f2ad18 commit be24dd8

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ that let you implement Two-Factor-Authentication easily.
55

66
It depends on the Google2FA package https://github.com/antonioribeiro/google2fa
77

8-
## Installation & configuration
8+
## Installation
99

1010
Just add "yeebase/twofactorauthentication" as dependency to your composer.json and run a "composer update" in your project's root folder
1111
or simply execute:
@@ -14,4 +14,28 @@ composer require yeebase/twofactorauthentication
1414
```
1515
from your project's root.
1616

17-
TODO: Description of integration (abstract two-factor-auth controller, templates) and settings
17+
## Configuration
18+
The following part describes the integration of the Two-Factor-Authentication package into an existing Flow Application.
19+
The package can be integrated into a working application without applying any data migrations to the existing user base.
20+
Existing users will simply be treated as if Two-Factor-Authentication is disabled for them.
21+
22+
### Provider
23+
Instead of using the default UsernamePasswordProvider, adapt your settings to use the following provider instead: `Yeebase\TwoFactorAuthentication\Security\Authentication\Provider\TwoFactorAuthenticationProvider`
24+
25+
### Controllers and Templates
26+
This package brings two abstract controllers that contain all the methods necessary for login with and management of Two-Factor-Authentication.
27+
28+
Instead of inheriting from the basic `AbstractAuthenticationController`, you should now inherit from `AbstractTwoFactorAuthenticationController` in your LoginController.
29+
The template of your login action should be adapted as described in the `TwoFactorUsernamePasswordToken` class.
30+
Additionally, you need to add a template for the `insertSecretAction` where the user can insert a secret.
31+
32+
For the management of Two-Factor-Authentication you can inherit from the `AbstractAuthenticationManagementController`.
33+
Using this controller, it is necessary to provide exactly one template for the `configureAction`.
34+
When 2FA is disabled, it passes an `activationQrCode`-parameter to the template that holds the QR-Code which can be scanned by a GoogleAuthenticator.
35+
When 2FA is enabled, it does not pass any parameters to the template. From this point on, either the `enableAction` or the `disableAction` should be called
36+
with a `secret`-parameter given by the user to enable/disable 2FA.
37+
38+
### Settings
39+
For the application to run, you should at least provide an `applicationName` which will be displayed in the Authenticator-App of the user.
40+
Furthermore, the `authenticationEntryPoint` should be specified. It configures where the user is redirected to, when he or she has to insert the secret for 2FA.
41+
This should usually be the LoginController of your package (if you inherited from `AbstractTwoFactorAuthenticationController` as described above).

0 commit comments

Comments
 (0)