Package org.opencms.security.twofactor
Class CmsTwoFactorAuthenticationUserPolicy
java.lang.Object
org.opencms.security.twofactor.CmsTwoFactorAuthenticationUserPolicy
A policy that determines which users should use two-factor authentication.
A policy consists of two lists of rules: an include list, and an exclude list. A user should use two-factor authentification if they match at least one rule in the include list, and no rule in the exclude list. However, if the include list does not contain any rules, only the exclude list is checked.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The rule type.static class
Represents a single rule configured for a policy.protected static class
A context object used to keep user-related data around which may be needed by multiple rules, so we only need read it once (e.g. -
Constructor Summary
ConstructorDescriptionCmsTwoFactorAuthenticationUserPolicy
(List<CmsTwoFactorAuthenticationUserPolicy.Rule> include, List<CmsTwoFactorAuthenticationUserPolicy.Rule> exclude) Creates a new policy object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
shouldUseTwoFactorAuthentication
(CmsObject cms, CmsUser user) Checks whether the given user should use two-factor-authentication according to this policy.
-
Constructor Details
-
CmsTwoFactorAuthenticationUserPolicy
public CmsTwoFactorAuthenticationUserPolicy(List<CmsTwoFactorAuthenticationUserPolicy.Rule> include, List<CmsTwoFactorAuthenticationUserPolicy.Rule> exclude) Creates a new policy object.- Parameters:
include
- the list of include rulesexclude
- the list of exclude rules
-
-
Method Details
-
shouldUseTwoFactorAuthentication
Checks whether the given user should use two-factor-authentication according to this policy.- Parameters:
cms
- the current CMS contextuser
- the user to check- Returns:
- true if the user should use two-factor authentication
-