Polish AllRequiredFactorsAuthorizationManager.anyOf
- Add validation - Extract to static inner class - Uniqueness determined by Set rather than requiredFactor This is important for the failure with the same RequiredFactor, but a different reason - Add documentation Signed-off-by: Robert Winch <362503+rwinch@users.noreply.github.com>
This commit is contained in:
@@ -125,6 +125,23 @@ include-code::./ValidDurationConfiguration[tag=httpSecurity,indent=0]
|
||||
<5> Otherwise, authentication is required, but it does not care if it is a password or how long ago authentication occurred
|
||||
<6> Set up the authentication mechanisms that can provide the required factors.
|
||||
|
||||
[[all-factors-anyof]]
|
||||
== AllRequiredFactorsAuthorizationManager.anyOf
|
||||
|
||||
In the previous examples, access requires satisfying that the user has authenticated with all factors.
|
||||
There are times when an application wants to allow users to satisfy one of several different combinations of factors.
|
||||
javadoc:org.springframework.security.authorization.AllRequiredFactorsAuthorizationManager#anyOf(AllRequiredFactorsAuthorizationManager...)[AllRequiredFactorsAuthorizationManager.anyOf] grants access if at least one of the provided combinations of factors is satisfied.
|
||||
|
||||
Consider a scenario where a user can authenticate with WebAuthn alone, or with both a password and a one-time token.
|
||||
|
||||
include-code::./AnyOfRequiredFactorsConfiguration[tag=httpSecurity,indent=0]
|
||||
<1> Require WebAuthn
|
||||
<2> Require both a password and a one-time token
|
||||
<3> Combine the combinations of factors with `anyOf`, granting access if either is satisfied
|
||||
<4> URLs that begin with `/protected/**` require the user to satisfy either combination of factors
|
||||
<5> All other requests require only authentication
|
||||
<6> Set up the authentication mechanisms that can provide the required factors
|
||||
|
||||
[[programmatic-mfa]]
|
||||
== Programmatic MFA
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
== Core
|
||||
|
||||
* https://github.com/spring-projects/spring-security/pull/18634[gh-18634] - Added javadoc:org.springframework.security.util.matcher.InetAddressMatcher[]
|
||||
* https://github.com/spring-projects/spring-security/issues/18960[gh-18960] - Added xref:servlet/authentication/mfa.adoc#all-factors-anyof[AllRequiredFactorsAuthorizationManager.anyOf]
|
||||
|
||||
== Web
|
||||
* https://github.com/spring-projects/spring-security/issues/18755[gh-18755] - Include `charset` in `WWW-Authenticate` header
|
||||
|
||||
Reference in New Issue
Block a user