Record Class StrongAuthState
java.lang.Object
java.lang.Record
com.iizix.user.StrongAuthState
- Record Components:
policy- The effective policy of the application,StrongAuthPolicy.OFFwhen none.bound- Whether the policy binds the user of this session - the one held, the one signed in, or every user before a sign-in.held- Whether a sign-in of this session is held under the policy, for its factors.stepUp- Whether what is held is a step-up of a signed-in session, not a sign-in.target- How many different factors the sign-in completes on this client, 0 when not bound.verified- The factors verified so far, strongest first; unmodifiable.lacking- The factors this client lacks for a sign-in to be possible, empty when none; unmodifiable.elsewhere- The allowed factors the user of the held sign-in has enrolled and this client cannot do (a passkey on a client without WebAuthn; the device key of another phone once device keys exist), empty when none or when nothing is held; unmodifiable (CC-SIGNIN-STRONG-UI). The sign-in waits for such a factor, on a client that can do it, or for a recovery code - never for an enrollment in its place: the password alone enrolls nothing for a user who has a factor the policy allows (CC-FIX-STRONG-HELD-PASSKEY).recovery- Whether a recovery code was used in the held sign-in: it counts as no factor, and the sign-in waits for the enrollment of a replacement.
public record StrongAuthState(StrongAuthPolicy policy, boolean bound, boolean held, boolean stepUp, int target, Set<String> verified, Set<String> lacking, Set<String> elsewhere, boolean recovery) extends Record
Where a client session stands under the strong authentication policy of its application (CC-SIGNIN-STRONG-POLICY): what
IUserAuthenticationStrong.getStrongAuthState answers, for the SignIn module to show the right screen. Nothing in it is a secret.- Before a sign-in: the policy, the target this client reaches and the factors this client
lacksfor a sign-in to be possible at all (section 2.5 of the design: when the set is not empty and the policy binds every user, S01 does not offer the sign-in and S32 names the client that works);verifiedis empty, nothing isheld. - While a sign-in is held under the policy:
held, thetarget, the factorsverifiedso far, theremaining()count, what to asknext()(strongest first, the mandatory ones first), the factors the user has enrolled that this client cannot do (elsewhere: S16 says "on another device"), and whether a recovery code was used (recovery): the sign-in then completes only by enrolling a replacement factor (SA-D-10). - For a signed-in session: the policy, and the factors its sign-in
verified. - For a session the policy does not bind, or an application whose policy is off:
boundfalse, and the rest says nothing.
The state names the factors of the POLICY alone. A held sign-in whose user has enrolled none of them, and has another second factor (an authenticator app, under a policy whose factors are narrowed to the passkey), first asks for THAT one, as a sign-in without the policy asks it: getSignInMethods lists it and verifySecondFactor takes it. It counts as no factor; the sign-in then waits for the enrollment of an allowed one, as it does after a recovery code (CC-FIX-STRONG-FACTORS-NARROWED). So a sign-in page asks for what getSignInMethods lists, and enrolls when it says enrolmentRequired.
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StrongAuthStateThe state of a session under no policy: the policy is off, nothing binds it.Constructor Summary
ConstructorsConstructorDescriptionStrongAuthState(StrongAuthPolicy policy, boolean bound, boolean held, boolean stepUp, int target, Set<String> verified, Set<String> lacking, Set<String> elsewhere, boolean recovery) Constructs the state: the sets are copied and unmodifiable.Method Summary
Modifier and TypeMethodDescriptionbooleanbound()Returns the value of theboundrecord component.Returns the value of theelsewhererecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanheld()Returns the value of theheldrecord component.booleanisMet()Checks if the held sign-in has met its target.lacking()Returns the value of thelackingrecord component.next()Gets the allowed factors not verified yet, in the order a sign-in asks them (SA-D-4): the mandatory ones first, then the strongest first.policy()Returns the value of thepolicyrecord component.booleanrecovery()Returns the value of therecoveryrecord component.intGets how many factors the held sign-in still verifies to reach its target, the mandatory ones among them.booleanstepUp()Returns the value of thestepUprecord component.inttarget()Returns the value of thetargetrecord component.final StringtoString()Returns a string representation of this record class.verified()Returns the value of theverifiedrecord component.
Field Details
NONE
The state of a session under no policy: the policy is off, nothing binds it.
Constructor Details
StrongAuthState
public StrongAuthState(StrongAuthPolicy policy, boolean bound, boolean held, boolean stepUp, int target, Set<String> verified, Set<String> lacking, Set<String> elsewhere, boolean recovery) Constructs the state: the sets are copied and unmodifiable.- Throws:
NullPointerException- Ifpolicy,verified,lackingorelsewhereis null.
Method Details
remaining
public int remaining()Gets how many factors the held sign-in still verifies to reach its target, the mandatory ones among them.- Returns:
- The count, 0 when the target is met or nothing is held.
next
isMet
public boolean isMet()Checks if the held sign-in has met its target.- Returns:
- true when nothing remains.
toString
hashCode
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes.policy
bound
held
stepUp
target
verified
lacking
elsewhere
recovery