Record Class StrongAuthPolicy
- Record Components:
count- How many different strong factors one sign-in completes, 0 for off.factors- The factors that may count, in the order ofALL_FACTORS; unmodifiable.mandatory- The factors every sign-in must include, a subset offactors; unmodifiable.device- What a client that cannot do the factors gets.floor- The fewest strong factors a flexible sign-in may end with, 1 or more.who- The users the policy binds.
The factors. A factor counts only when the server verifies it: FACTOR_TOTP (a code of the user's authenticator app), FACTOR_PASSKEY (a WebAuthn assertion with user verification) and FACTOR_BIOMETRIC (a signature of a hardware-bound, biometric- only device key of the iiziRun app). Their order is fixed, strongest first (SA-D-4). A password, a device token, a recovery code, an e-mail or SMS code is never a strong factor. In a Browser a passkey counts once, as passkey, whatever unlocked it (SA-D-1).
The supported maximum (CC-FIX-SIGNIN-STRONG-SUPPORTED-MAX, the owner's rule of 2026-11-07): a setting may never ask for more than this build fully supports today, StrongAuthSupport. The factor biometric is known to the code and its flow is written, but no client can do it until the device-key orders: it is not supported, so factors and mandatory may not name it and count and floor may not exceed the number of supported factors, 2. The parser refuses such a value where it is set, naming the value and the supported set; resolve(StrongAuthPolicy.Source...) refuses a source an application's code built with one. A test or a rig widens the supported set with the lab override of StrongAuthSupport; nothing a customer reaches does.
The setting. The same six keys at every level, after the prefix of the level (PREFIX after SignInPolicy.SERVER_PREFIX or SignInPolicy.APP_PREFIX):
| Key | Values | Default | Meaning |
|---|---|---|---|
count | 0 to the supported maximum (StrongAuthSupport.maxCount(), 2 today; 3 is ALL THREE when the biometric device key is supported) | 0 | how many different strong factors one sign-in completes; 0 is off, v5's rules apply unchanged |
factors | a list from the supported factors (passkey,totp today) | every supported factor | the factors that may count |
mandatory | a list, a subset of factors | empty | the factors every sign-in must include: the device requirement |
device | flexible, strict | flexible | strict: a client that cannot complete count with every mandatory factor is refused before the password; flexible: such a client does what it can, never below floor |
floor | 1 to count | 1 | the fewest strong factors a flexible sign-in may end with; what the client reports never pushes below it |
who | all, administrators | all | the users the policy binds |
Consistency (check()): mandatory is a subset of factors; count is at least the size of mandatory; factors holds at least count factors; floor is at most count. A policy that breaks a rule is refused where it is typed (checkSource(String, UnaryOperator)); when several sources, each consistent alone, combine into one that does, the application fails closed (resolve(StrongAuthPolicy.Source...) throws, and the caller refuses every sign-in).
Sources combine, the strictest wins field by field (SA-D-5 (a), StrongAuthPolicy.Source.combine(StrongAuthPolicy.Source)): count the maximum, factors the intersection of the sources that set it, mandatory the union, device strict when any source says strict, floor the maximum, who the widest. An application raises, through its settings or its code, and never lowers what the server, the environment or its definition sets. v5's own signIn.* keys keep their v5 behavior, "the application overrides" (SA-D-5 (b)); for a user this policy binds, count of 1 or more replaces v5's second-factor rule.
- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhat a client that cannot do the factors of the policy gets.static enumThe presets of ServerAdmin's dialog (section 2.2 of the design): a count, a device rule and a floor, every supported factor allowed, none mandatory, every user bound.static final recordWhat one source sets of the policy: a key it does not set is null, and takes part in the combination as unset.static enumThe users a policy binds.Field Summary
FieldsModifier and TypeFieldDescriptionEvery factor the code knows, strongest first (SA-D-4): the order of every set this class makes.static final StringThe factors, named as the methods of a proof are (MFAProof.METHOD_TOTP,MFAProof.METHOD_PASSKEY).static final StringThe factors, named as the methods of a proof are (MFAProof.METHOD_TOTP,MFAProof.METHOD_PASSKEY).static final StringThe factors, named as the methods of a proof are (MFAProof.METHOD_TOTP,MFAProof.METHOD_PASSKEY).The keys in their order, without their prefixes.static final StrongAuthPolicyThe policy that is off: v5's rules apply unchanged.static final StringThe keys, without their prefixes.static final StringThe keys, without their prefixes.static final StringThe keys, without their prefixes.static final StringThe keys, without their prefixes.static final StringThe keys, without their prefixes.static final StringThe keys, without their prefixes.static final StringThe prefix of the keys after the prefix of the level: "strong.", so that the server setting is$signIn.strong.countand the application'ssignIn.strong.count.Constructor Summary
ConstructorsConstructorDescriptionStrongAuthPolicy(int count, Set<String> factors, Set<String> mandatory, StrongAuthPolicy.Device device, int floor, StrongAuthPolicy.Who who) Constructs the policy: the sets are copied, ordered and unmodifiable.Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if a proof meets the policy on this server, as a hub member checks the proof a session transfer carries against its own resolved policy (section 2.6 of the design): the proof is verified and its methods meet the policy's count with every mandatory factor.booleanChecks if a factor may count.asSource()Gets the policy as a source, every key set: what an application's code hands the server to raise its policy with.booleanbinds(boolean administrator) Checks if the policy binds a user.check()Checks the consistency rules of section 2.2 of the design.static StringcheckSource(String prefix, UnaryOperator<String> values) Checks the six keys of one level where they are set - the server settings, an environment's custom application settings, an application's module settings - for everything that can be known of that level alone: each value in its range and within the supported maximum (StrongAuthPolicy.Source.parse(String, UnaryOperator)), and the consistency rules among the six keys (check()).intcount()Returns the value of thecountrecord component.device()Returns the value of thedevicerecord component.final booleanIndicates whether some other object is "equal to" this one.factors()Returns the value of thefactorsrecord component.intfloor()Returns the value of thefloorrecord component.final inthashCode()Returns a hash code value for this object.booleanChecks if a set of verified factors meets a target: as many allowed factors as the target, every mandatory one among them.booleanisOff()Checks if the policy is off: v5's rules apply to everyone.booleanisRaisedBy(StrongAuthPolicy other) Checks if another policy is at least as strict as this one in every field: what an application may raise its policy to (SA-D-5 (a): raise, never lower).Gets the factors this client lacks for a sign-in to be possible at all, known from the policy and what the client can do alone - nothing about an account (section 2.5 of the design): every mandatory factor the client cannot do; and when the client cannot do as many allowed factors as it must end with -countunderStrongAuthPolicy.Device.STRICT,floorunderStrongAuthPolicy.Device.FLEXIBLE- the allowed factors it cannot do.Returns the value of themandatoryrecord component.intGets what is still missing of a set of verified factors to meet a target: every mandatory factor not verified, and as many more allowed factors as the target needs.preset()Gets the preset this policy is, for ServerAdmin's dialog and the applications table: the preset whose policy under the factors supported now (StrongAuthPolicy.Preset.policy()) is this one.static UnaryOperator<String> Makes the reader of the strong keys of a settings container: the text of a property of any type, as the settings editors may store a count as a number.Gets the allowed factors that are not verified yet, strongest first: what a sign-in asks next (SA-D-4), the mandatory ones first among them.static StrongAuthPolicyresolve(StrongAuthPolicy.Source... sources) Resolves the policy of the sources that set it, in the order of the design (S1 the server settings, S2 the environment, S3 the application definition, S4 the application's module settings, S5 the application's code), the strictest winning field by field, with the defaults for what no source sets.intGets the target of a sign-in on a client: how many different strong factors it completes (section 2.2 of the design, step 2).toString()Gets the policy as it is written in a log.static StrongAuthPolicyunchecked(StrongAuthPolicy.Source source) Makes the policy of a combined source with the defaults for what is unset, unchecked.who()Returns the value of thewhorecord component.
Field Details
PREFIX
The prefix of the keys after the prefix of the level: "strong.", so that the server setting is$signIn.strong.countand the application'ssignIn.strong.count.- See Also:
PN_COUNT
PN_FACTORS
PN_MANDATORY
PN_DEVICE
PN_FLOOR
PN_WHO
KEYS
FACTOR_BIOMETRIC
The factors, named as the methods of a proof are (MFAProof.METHOD_TOTP,MFAProof.METHOD_PASSKEY).- See Also:
FACTOR_PASSKEY
The factors, named as the methods of a proof are (MFAProof.METHOD_TOTP,MFAProof.METHOD_PASSKEY).- See Also:
FACTOR_TOTP
The factors, named as the methods of a proof are (MFAProof.METHOD_TOTP,MFAProof.METHOD_PASSKEY).- See Also:
ALL_FACTORS
Every factor the code knows, strongest first (SA-D-4): the order of every set this class makes. The ones a setting may name are the supported ones,StrongAuthSupport.factors().OFF
The policy that is off: v5's rules apply unchanged. Its other keys decide nothing (no factor is named); every source whose count is 0 resolves to this one.
Constructor Details
StrongAuthPolicy
public StrongAuthPolicy(int count, Set<String> factors, Set<String> mandatory, StrongAuthPolicy.Device device, int floor, StrongAuthPolicy.Who who) Constructs the policy: the sets are copied, ordered and unmodifiable. Nothing is checked here;check()tells the rules the policy breaks, andresolve(StrongAuthPolicy.Source...)refuses a policy that breaks one or asks for more than is supported.- Throws:
NullPointerException- Iffactors,mandatory,deviceorwhois null.
Method Details
reader
Makes the reader of the strong keys of a settings container: the text of a property of any type, as the settings editors may store a count as a number.- Parameters:
settings- The container, null for none.- Returns:
- The reader: null for a key the container has not.
checkSource
Checks the six keys of one level where they are set - the server settings, an environment's custom application settings, an application's module settings - for everything that can be known of that level alone: each value in its range and within the supported maximum (StrongAuthPolicy.Source.parse(String, UnaryOperator)), and the consistency rules among the six keys (check()). The rules of the level combined with the other levels are the resolver's.- Parameters:
prefix- The prefix of the level, e.g.$signIn.strong..values- The reader: the text of a key, null or blank for unset.- Returns:
- The problem in plain words - a refused value names its key with the prefix, a broken rule names the keys as
check()does; null when there is none.
resolve
Resolves the policy of the sources that set it, in the order of the design (S1 the server settings, S2 the environment, S3 the application definition, S4 the application's module settings, S5 the application's code), the strictest winning field by field, with the defaults for what no source sets. The combination is checked: one that asks for more than is supported today (StrongAuthPolicy.Source.unsupportedProblem(): only a source built by code can, the parser refused it in every setting) or breaks a consistency rule is refused, and the application fails closed.- Parameters:
sources- The sources, null entries for none.- Returns:
- The policy,
OFFwhen no source sets a count or the count is 0. - Throws:
IllegalArgumentException- If the combination asks for more than is supported or breaks a consistency rule; the message says which, andcheck()of the unchecked policy lists all.
unchecked
Makes the policy of a combined source with the defaults for what is unset, unchecked.- Parameters:
source- The source.- Returns:
- The policy;
OFFfor a count that is unset or 0.
check
isOff
public boolean isOff()Checks if the policy is off: v5's rules apply to everyone.- Returns:
- true for a count of 0.
binds
public boolean binds(boolean administrator) Checks if the policy binds a user.- Parameters:
administrator- Whether the user is a member of the administrators group.- Returns:
- true when the policy is on and binds the user: every user, or this administrator.
allows
Checks if a factor may count.- Parameters:
factor- The factor, null for none.- Returns:
- true when the policy allows it.
lacking
Gets the factors this client lacks for a sign-in to be possible at all, known from the policy and what the client can do alone - nothing about an account (section 2.5 of the design): every mandatory factor the client cannot do; and when the client cannot do as many allowed factors as it must end with -countunderStrongAuthPolicy.Device.STRICT,floorunderStrongAuthPolicy.Device.FLEXIBLE- the allowed factors it cannot do. A client that lacks one is answeredSTRONG_AUTH_CLIENT_REQUIREDbefore the password, with this set, so that SignIn names the client that works.- Parameters:
clientCan- The factors the client can do: enroll or use.- Returns:
- The factors lacking, in the order of
ALL_FACTORS; empty when the client can sign in.
target
Gets the target of a sign-in on a client: how many different strong factors it completes (section 2.2 of the design, step 2). UnderStrongAuthPolicy.Device.STRICTthe count. UnderStrongAuthPolicy.Device.FLEXIBLEthe larger of the floor and the number of allowed factors the client can do, at most the count: the client does what it can, never below the floor (SA-D-8), and the user enrolls what is missing.- Parameters:
clientCan- The factors the client can do.- Returns:
- The target, 0 when the policy is off.
missing
Gets what is still missing of a set of verified factors to meet a target: every mandatory factor not verified, and as many more allowed factors as the target needs. The factors that are verified count only when the policy allows them.- Parameters:
verified- The factors that were verified.target- The target, seetarget(Set).- Returns:
- The number of factors still to verify (the mandatory ones among them), 0 when the target is met.
isMet
accepts
Checks if a proof meets the policy on this server, as a hub member checks the proof a session transfer carries against its own resolved policy (section 2.6 of the design): the proof is verified and its methods meet the policy's count with every mandatory factor. A policy that is off is met by every proof.- Parameters:
proof- The proof, null for none.- Returns:
- true when the proof is enough for this policy; a proof that falls short is not accepted, and the user is asked the rest.
remaining
Gets the allowed factors that are not verified yet, strongest first: what a sign-in asks next (SA-D-4), the mandatory ones first among them.- Parameters:
verified- The factors that were verified.- Returns:
- The factors, ordered; empty when every allowed factor was verified.
isRaisedBy
Checks if another policy is at least as strict as this one in every field: what an application may raise its policy to (SA-D-5 (a): raise, never lower).- Parameters:
other- The other policy.- Returns:
- true when
otherlowers nothing: its count and floor are not less, its factors are within these, its mandatory factors include these, it is strict where this is, and it binds everyone this binds.
asSource
Gets the policy as a source, every key set: what an application's code hands the server to raise its policy with.- Returns:
- The source.
preset
Gets the preset this policy is, for ServerAdmin's dialog and the applications table: the preset whose policy under the factors supported now (StrongAuthPolicy.Preset.policy()) is this one.- Returns:
- The preset, null when the policy is none of them ("Custom").
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.count
factors
mandatory
device
floor
who