Skip to content

Commit 6c58073

Browse files
authored
Merge pull request #220 from mutec/2faenforce
add section for enforcing Multi-factor Authentication
2 parents ac904ee + 3afafc6 commit 6c58073

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/migration/wsc53/session.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,18 @@ Please check [the version history](https://github.com/WoltLab/WCF/commits/master
142142

143143
!!! warning "Multi-factor authentication is security sensitive. Make sure to carefully read the remarks in `IMultifactorMethod` for possible issues. Also make sure to carefully test your implementation against all sorts of incorrect input and consider attack vectors such as race conditions. It is strongly recommended to generously check the current state by leveraging assertions and exceptions."
144144

145+
#### Enforcing Multi-factor Authentication
146+
147+
To enforce Multi-factor Authentication within your controller you need to:
148+
149+
1. Use the `wcf\system\user\multifactor\TMultifactorRequirementEnforcer` trait.
150+
2. Call: `$this->enforceMultifactorAuthentication();`
151+
152+
`enforceMultifactorAuthentication()` will check if the user is in a group that requires multi-factor authentication, but does not yet have multi-factor authentication enabled.
153+
If they did, the request proceeds as usual.
154+
Otherwise, a `NamedUserException` is thrown.
155+
156+
145157
## Deprecations and Removals
146158

147159
### SessionHandler

0 commit comments

Comments
 (0)