Class UserMFA.StrongProgress

java.lang.Object
com.iizix.server.user.mfa.UserMFA.StrongProgress
Enclosing class:
UserMFA

public static final class UserMFA.StrongProgress extends Object
The progress of a sign-in held under a strong authentication policy (CC-SIGNIN-STRONG-POLICY, section 2.2 of the design of order 475): the policy, the target this client reaches, the factors verified so far, each at most once, and whether a recovery code was used - which counts as no factor and lets the user re-enroll a replacement (SA-D-10). And the second factors of the user OUTSIDE the policy's factors (CC-FIX-STRONG-FACTORS-NARROWED): the ones the sign-in is held for, when the user has enrolled none the policy allows, and whether one was proven - which counts as no factor either, and opens the enrollment of an allowed one. One instance lives with the held sign-in from the first factor to the completion, through every re-hold.
Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The policy the sign-in is held under.
    final boolean
    Whether this is the step-up of a signed-in session, not a sign-in.
    final int
    The target: how many different factors the sign-in completes on this client.
  • Constructor Summary

    Constructors
    Constructor
    Description
    StrongProgress(StrongAuthPolicy policy, int target, boolean stepUp, Set<String> verified)
    Constructs the progress.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(String factor)
    Counts a verified factor, once: a factor the policy does not allow counts nothing - it is remembered as proven (otherProven), what is no factor at all (a recovery code, null) is not.
    void
    askOther(Set<String> factors)
    Tells the second factors outside the policy's factors the sign-in is held for (CC-FIX-STRONG-FACTORS-NARROWED): the user has enrolled none of the factors the policy allows and has these, and proves one of them - asked as v5's rules ask it - before anything is enrolled.
    boolean
    Checks if the target is met: as many allowed factors as the target, every mandatory one among them.
    void
    Marks that a recovery code was used: no factor, the sign-in waits for the enrollment of a replacement, which clears the mark when it counts.
    Gets the second factors outside the policy's factors the sign-in is held for.
    boolean
    Checks if a second factor outside the policy's factors was proven in this sign-in - or by its first factor, or by the recent sign-in of a session that steps up: no factor of the policy, it opens the enrollment of an allowed one.
    boolean
    Checks if a recovery code was used.
    int
    Gets how many factors are still to verify, the mandatory ones among them.
    Gets the progress as it is written in a log.
    Gets the factors verified so far.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • policy

      public final StrongAuthPolicy policy
      The policy the sign-in is held under.
    • target

      public final int target
      The target: how many different factors the sign-in completes on this client.
    • stepUp

      public final boolean stepUp
      Whether this is the step-up of a signed-in session, not a sign-in.
  • Constructor Details

    • StrongProgress

      public StrongProgress(StrongAuthPolicy policy, int target, boolean stepUp, Set<String> verified)
      Constructs the progress.
      Parameters:
      policy - The policy.
      target - The target, 1 or more.
      stepUp - Whether this is a step-up of a signed-in session.
      verified - The factors verified before the hold (a passkey that was the first factor; what a recent sign-in verified, for a step-up), null for none.
      Throws:
      NullPointerException - If policy is null.
  • Method Details

    • add

      public boolean add(String factor)
      Counts a verified factor, once: a factor the policy does not allow counts nothing - it is remembered as proven (otherProven), what is no factor at all (a recovery code, null) is not. A factor that counts after a recovery code is the replacement the code led to: the recovery mark is done with.
      Parameters:
      factor - The factor, null for none.
      Returns:
      true when it counted now.
    • markRecovery

      public void markRecovery()
      Marks that a recovery code was used: no factor, the sign-in waits for the enrollment of a replacement, which clears the mark when it counts.
    • recovery

      public boolean recovery()
      Checks if a recovery code was used.
      Returns:
      true when it was.
    • askOther

      public void askOther(Set<String> factors)
      Tells the second factors outside the policy's factors the sign-in is held for (CC-FIX-STRONG-FACTORS-NARROWED): the user has enrolled none of the factors the policy allows and has these, and proves one of them - asked as v5's rules ask it - before anything is enrolled.
      Parameters:
      factors - The factors, null or empty when the sign-in is held for none of them.
    • otherAsked

      public Set<String> otherAsked()
      Gets the second factors outside the policy's factors the sign-in is held for.
      Returns:
      The factors, unmodifiable; empty when it is held for none of them.
    • otherProven

      public boolean otherProven()
      Checks if a second factor outside the policy's factors was proven in this sign-in - or by its first factor, or by the recent sign-in of a session that steps up: no factor of the policy, it opens the enrollment of an allowed one.
      Returns:
      true when one was.
    • verified

      public Set<String> verified()
      Gets the factors verified so far.
      Returns:
      A copy, in the order of StrongAuthPolicy.ALL_FACTORS; unmodifiable.
    • remaining

      public int remaining()
      Gets how many factors are still to verify, the mandatory ones among them.
      Returns:
      The count, 0 when the target is met.
    • isMet

      public boolean isMet()
      Checks if the target is met: as many allowed factors as the target, every mandatory one among them.
      Returns:
      true when met.
    • toString

      public String toString()
      Gets the progress as it is written in a log. Nothing in it is a secret.
      Overrides:
      toString in class Object
      Returns:
      E.g. {target=2,verified=[passkey],remaining=1}; ,other when a second factor outside the policy's factors was proven.