Class SignInPolicies

java.lang.Object
com.iizix.server.user.mfa.SignInPolicies

public final class SignInPolicies extends Object
The sign-in policy of the applications of this server (SignIn L-6; section 5 of the SignIn flow design, its decision D-11): the settings of the server, $signIn.* in the server settings, with what the application overrides, signIn.* in its moduleApp settings. The policy is resolved when it is asked for, from the settings as they are then: a changed setting needs no restart of anything that reads it here.

Development mode (the owner's ruling DEV-2FA-1 of 2026-10-18, CC-FIX-SIGNIN-V5-UX item 7): on a server run from Eclipse, not built into jars (SystemConfig.isDevelopmentMode, the gate of the seed-password rule of 2026-10-08, SeedPasswordCheck), the administrators' second factor is NOT required by default - a debug server asked the owner for a code at every check, and nothing can type one for a scripted check. A secondFactorAdministrators that the server settings ($signIn.secondFactorAdministrators) or the application (signIn.secondFactorAdministrators) set still decides; a built server keeps the default of SignInPolicy, required (D-11).

The strong authentication policy (CC-SIGNIN-STRONG-POLICY, section 2.3 of the design of order 475) is resolved by strong(AppFactory) from five sources, the strictest winning field by field (SA-D-5 (a)): S1 the server settings ($signIn.strong.*), S2 the server environment's custom application settings (signIn.strong.*, as the passkey keys are read), S3 the application's definition in config.iiziServer (strongCount, ..., ServerAppConfig.getStrongSource()) combined with what the command line's -strong* options set for the application (AppDefinition.getStrongSource(), CC-SERVERADMIN-STRONG-AUTH, SA-D-6 (a): the two are one source, the strictest winning, and the file's definition is never changed by the command line), S4 the application's moduleApp settings (signIn.strong.*, beside v5's signIn.*), S5 what the application's code raised. Resolved at ask time, as the v5 policy is: a changed setting needs no restart. Development mode waives nothing of it: the strong policy has no default but off, so it applies on a debug server exactly as configured.

Where a value is refused (CC-FIX-SIGNIN-STRONG-SUPPORTED-MAX, the owner's rule of 2026-11-07): every source is checked where it is set, against its range, the supported maximum (StrongAuthSupport: the factors passkey and totp, a count of at most 2 today) and the consistency rules of its own six keys - S1, S2 and S3 at the server's start (ServerSettings.checkStrongAuthentication: the server does not start with such a value, and iiziGo's verification of config.iiziServer marks it), S2 again in ServerAdmin's environment page, S4 when the application is loaded (the application is refused), S5 by the answer of raise(AppFactory, StrongAuthPolicy.Source). No application is capped: ServerAdmin's policy is what the sources say, since none of them can ask for what a Browser cannot do. What remains for the resolver is the combination: sources that are each consistent alone can combine into a policy that breaks a rule (a floor at one level above the count of another), and that fails the application closed - every sign-in is refused, and SEVERE is logged once with the sources that clashed. The same path refuses, as a defense in depth, a value that reached the live settings by a route without the check.

Author:
Christopher Mindus
  • Method Details

    • of

      public static SignInPolicy of(AppFactory app)
      Gets the sign-in policy of an application as the settings have it.
      Parameters:
      app - The application, null for the policy of the server alone.
      Returns:
      The policy, never null; the default policy when the server is not started.
    • offered

      public static SignInPolicy offered(AppFactory app)
      Gets the sign-in policy of an application with its methods of a second factor narrowed to the ones this server can do: what is offered to a user. A passkey is one where the application offers passkeys (CC-FIX-SIGNIN-2FA-CHOICE): it is the passkey service's, the codes are UserMFA's.
      Parameters:
      app - The application, null for the policy of the server alone.
      Returns:
      The policy, never null.
    • strong

      public static SignInPolicies.Strong strong(AppFactory app)
      Gets the strong authentication policy of an application as its five sources resolve it now, the strictest winning field by field. A combination that breaks a rule is logged SEVERE once with the sources, and answered as failed: the caller refuses the sign-in.
      Parameters:
      app - The application, null for the policy of the server settings alone.
      Returns:
      The resolution, never null.
    • strongCandidate

      public static SignInPolicies.Strong strongCandidate(AppFactory app, UnaryOperator<String> server, StrongAuthPolicy.Source definition)
      Resolves the strong authentication policy an application WOULD have with a candidate server level or a candidate definition in place of the live one (CC-SERVERADMIN-STRONG-AUTH, the guard SM-D-2 of ServerAdmin: before a save, every application's combination is resolved, and a save that makes one inconsistent is refused naming it). Nothing is logged and nothing is remembered: the live resolution is strong(AppFactory).
      Parameters:
      app - The application.
      server - The candidate server settings by key with its prefix ($signIn.strong.count), null for a key not set; null for the live server settings.
      definition - The candidate source of the application's definition (S3, the file's part), null for the live definition's. The command line's part is always the live one.
      Returns:
      The resolution.
    • raise

      public static String raise(AppFactory app, StrongAuthPolicy.Source raise)
      Raises the strong authentication policy of a loaded application from its code (source S5, SA-D-5 (a)): what is given combines with the other sources, the strictest winning, so the application never lowers what the operator set. A raise that asks for more than is supported today (CC-FIX-SIGNIN-STRONG-SUPPORTED-MAX) or makes the combination inconsistent is refused by the answer, logged WARNING, and nothing changes.
      Parameters:
      app - The application.
      raise - What to raise, StrongAuthPolicy.Source.NONE to drop an earlier raise.
      Returns:
      null when the raise is accepted and in force; otherwise the refusal, naming the value and what is supported, or the rule the combination would break.
      Throws:
      NullPointerException - If app or raise is null.
    • getRaised

      public static StrongAuthPolicy.Source getRaised(AppFactory app)
      Gets what an application's code raised.
      Parameters:
      app - The application, null for none.
      Returns:
      The raise, StrongAuthPolicy.Source.NONE when the application raised nothing.