This repository was archived by the owner on Dec 2, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,6 +104,32 @@ a different page from your application.
104104 - Additional data for the authentication method is returned, e.g. for Google Authenticator to work the
105105 ` getGoogleAuthenticatorSecret() ` method must return a secret code.
106106
107+ ** Is there something special about your security setup?**
108+
109+ Often issues originate from a customization in the application's security setup, which is usually related to how roles
110+ are granted. Examples of such issue are:
111+
112+ - [ Roles are dynamically granted by a voter, which isn't aware of the intermediate 2fa state] ( https://github.com/scheb/2fa/issues/23 )
113+ - [ Roles are loaded by replacing the security token after login, effectively skipping 2fa] ( https://github.com/scheb/two-factor-bundle/issues/289 )
114+ - [ An exception thrown in a voter] ( https://github.com/scheb/two-factor-bundle/issues/291 )
115+
116+ For 2fa to work properly, there must be two things fulfilled: A ` TwoFactorToken ` must be present after login and within
117+ that intermediate "2fa incomplete" state no roles must be granted. That later one is achieved by ` TwoFactorToken ` not
118+ returning any roles on the ` getRoleNames() ` call. But if you grant roles differently other than through the token,
119+ things will break.
120+
121+ The solution to this problem is usually to skip any customization for a security token of type
122+ ` TwoFactorTokenInterface ` .
123+
124+ ``` php
125+ <?php
126+ use Scheb\TwoFactorBundle\Security\Authentication\Token\TwoFactorTokenInterface;
127+
128+ if (!($token instanceof TwoFactorTokenInterface)) {
129+ // Your customization here
130+ }
131+ ```
132+
107133### Troubleshooting
108134
1091351 ) Is a ` TwoFactorToken ` present after the login?
You can’t perform that action at this time.
0 commit comments