Class AuthenticationFactorRegistry
java.lang.Object
com.irurueta.authserver.authorization.api.web.mfa.AuthenticationFactorRegistry
Registry of the authentication factors this server knows. Every
AuthenticationFactor bean is registered, so
a new login method adds its factor by declaring a bean, without editing shared files. The class is final because its
constructor validates (and may throw), which would otherwise leave a partially built subclass instance observable.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, AuthenticationFactor> Registered factors by the authority that proves them, in registration order. -
Constructor Summary
ConstructorsConstructorDescriptionCreates the registry. -
Method Summary
Modifier and TypeMethodDescriptionall()Lists every registered factor.factorsOf(org.springframework.security.core.Authentication authentication) Tells which registered factors an authentication has presented.findByAuthority(String authority) Finds the factor proved by an authority.withStrength(FactorStrength strength) Lists the registered factors that have a strength.
-
Field Details
-
byAuthority
Registered factors by the authority that proves them, in registration order.
-
-
Constructor Details
-
AuthenticationFactorRegistry
Creates the registry.- Parameters:
factors- the factors to register.- Throws:
IllegalArgumentException- if two factors share an authority.
-
-
Method Details
-
all
Lists every registered factor.- Returns:
- the factors, in registration order.
-
findByAuthority
Finds the factor proved by an authority.- Parameters:
authority- the authority, for exampleFACTOR_PASSWORD.- Returns:
- the factor, or an empty optional when none is registered for it.
-
withStrength
Lists the registered factors that have a strength.- Parameters:
strength- the strength to look for.- Returns:
- the factors, in registration order.
-
factorsOf
public Set<AuthenticationFactor> factorsOf(org.springframework.security.core.Authentication authentication) Tells which registered factors an authentication has presented.- Parameters:
authentication- the authentication; its authorities that match a registered factor count.- Returns:
- the factors used, empty when none.
-