Class StrongAuthGuards
java.lang.Object
com.iizix.server.user.mfa.StrongAuthGuards
The guards of a strong authentication policy an administrator sets in ServerAdmin (CC-SERVERADMIN-STRONG-AUTH; section 6 of the design of order 475, SA-D-11; the rows SM-D-2, SM-D-3 and SM-D-4 of order 542): what ServerAdmin's Add/Edit application dialog and its Sign-in page refuse before anything is written, so that no setting locks the administrators out of the server they administer. The dialog and the page bind to these and hold no rule of their own; the command line and the configuration file are not guarded here (the operator's shell is the root of trust, section 3.4 of the design), only what is set from a signed-in session.
- Guard 1 (
browserSatisfiable(String, StrongAuthPolicy.Source), SA-D-11): ServerAdmin's own policy stays Browser-satisfiable. A policy ofcom.iizix.serveradminthat a Browser can never meet -mandatory=biometric,count=3,factors=biometric- is REFUSED at set time, never capped: ServerAdmin is a Browser application, and no iiziRun build is made for it. Today the parser refuses these values before this guard sees them (CC-FIX-SIGNIN-STRONG-SUPPORTED-MAX: the factorbiometricis not supported); the guard is dormant and bites the day the biometric device key is supported, which is why it exists now. - SM-D-3 (
lockOut(StrongAuthPolicy, boolean)): the page's G1 extended to the strong keys - a lock-out is always refused. A policy that binds the administrators and needs a factor ServerAdmin's environment does not offer (a passkey while passkeys are off there, or have no relying party ID) refuses every administrator before the password, and only a file edit could undo it (count=2 strict,mandatory=passkey,factors=passkeywith passkeys off). - The save guard (
cannotMeet(StrongAuthPolicy, Set),othersLacking(StrongAuthPolicy, List), section 6.2 of the design): ServerAdmin refuses to save, for its own entry or a server-level key, a policy that the administrator saving it cannot meet with the factors enrolled now ("You would not be able to sign in: enroll a passkey first"), and warns when another administrator in scope lacks a factor - that administrator is not locked out: the next sign-in enrolls what is missing (the enrollment loop of the strong flow), unless the policy is strict. - SM-D-2 (
inconsistentApplications(Iterable, UnaryOperator, String, StrongAuthPolicy.Source)): before any level is saved, every application's combined policy is resolved asSignInPolicies.resolveStrongwould, and a save that makes any application's combination inconsistent (the resolver's fail-closed case: serverfloor=2over a module'scount=1) is refused naming the application and the rule.
Nothing here writes, logs or reads a setting: the callers hand in the candidate values and what the server offers, and get back the refusal or the warning in plain words, null when there is none. The enrolled factors of an administrator are read from the stores (enrolledFactors(long, String)); a test hands cannotMeet(StrongAuthPolicy, Set) its own set.
- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordWhat is known of an administrator for the save guard: the name and the factors enrolled now.Field Summary
FieldsModifier and TypeFieldDescriptionThe factors a Browser can do at most (SA-D-1): a passkey and an authenticator app; the biometric device key is the iiziRun app's alone.static final StringThe application ID of ServerAdmin, the one application whose policy must stay Browser-satisfiable (SA-D-11): "com.iizix.serveradmin".Method Summary
Modifier and TypeMethodDescriptionstatic StringbrowserSatisfiable(String appID, StrongAuthPolicy.Source source) Refuses, for ServerAdmin's own application, a policy that a Browser can never meet: every factor it needs fromBROWSER_FACTORSalone (StrongAuthPolicy.lacking(Set)) - a mandatorybiometric, a count above two, allowed factors without a Browser one.static StringcannotMeet(StrongAuthPolicy policy, Set<String> enrolled) Refuses a policy the administrator saving it cannot meet with the factors enrolled now: a mandatory factor not enrolled, or fewer enrolled allowed factors than the policy asks of this client (StrongAuthPolicy.lacking(Set): the count under strict, the floor under flexible).static List<StrongAuthGuards.Enrolled> enrolledAdministrators(String rpId) Reads the strong factors every member of the administrators group has enrolled now, from the stores: a passkey registered for the relying party ID of ServerAdmin, an authenticator app set up.enrolledFactors(long uid, String rpId) Reads the strong factors a user has enrolled now, from the stores.inconsistentApplications(Iterable<AppFactory> apps, UnaryOperator<String> server, String definitionOf, StrongAuthPolicy.Source definition) Resolves every application's strong policy as it would be with a candidate level in place of the live one, and names the applications whose combination then fails (the resolver's fail-closed case: every sign-in of such an application would be refused).static StringlockOut(StrongAuthPolicy policy, boolean passkeysOffered) Refuses a policy that binds the administrators and needs a factor ServerAdmin's environment does not offer: every administrator would be refused before the password, and only a file edit could undo it.static StringNames a set of factors in plain words: "a passkey and an authenticator app".static StringothersLacking(StrongAuthPolicy policy, List<StrongAuthGuards.Enrolled> others) Warns of the other administrators in scope who lack a factor the policy needs: each of them is asked to enroll it at the next sign-in, which needs the password alone; under a strict policy a client that cannot do the factor is refused instead.
Field Details
SERVER_ADMIN_APP_ID
The application ID of ServerAdmin, the one application whose policy must stay Browser-satisfiable (SA-D-11): "com.iizix.serveradmin".- See Also:
BROWSER_FACTORS
Method Details
browserSatisfiable
Refuses, for ServerAdmin's own application, a policy that a Browser can never meet: every factor it needs fromBROWSER_FACTORSalone (StrongAuthPolicy.lacking(Set)) - a mandatorybiometric, a count above two, allowed factors without a Browser one. Any other application is free to ask for the iiziRun app.- Parameters:
appID- The application ID the policy is set for, null for the server level (which binds ServerAdmin too, so it is checked as ServerAdmin's).source- What is set, at this level alone.- Returns:
- null when accepted; otherwise why it is refused, naming the factors a Browser lacks.
lockOut
Refuses a policy that binds the administrators and needs a factor ServerAdmin's environment does not offer: every administrator would be refused before the password, and only a file edit could undo it. What is offered is an authenticator app always, and a passkey where ServerAdmin's passkey settings resolve enabled.- Parameters:
policy- The policy of ServerAdmin as it would resolve with the change (every level combined), null or off for no policy.passkeysOffered- Whether ServerAdmin's environment offers passkeys.- Returns:
- null when the administrators can still sign in; otherwise why the change is refused.
cannotMeet
Refuses a policy the administrator saving it cannot meet with the factors enrolled now: a mandatory factor not enrolled, or fewer enrolled allowed factors than the policy asks of this client (StrongAuthPolicy.lacking(Set): the count under strict, the floor under flexible).- Parameters:
policy- The policy as it would resolve for ServerAdmin with the change, null or off for no policy.enrolled- The strong factors the saving administrator has enrolled.- Returns:
- null when the administrator could sign in; otherwise the refusal: "You would not be able to sign in: enroll a passkey first".
othersLacking
Warns of the other administrators in scope who lack a factor the policy needs: each of them is asked to enroll it at the next sign-in, which needs the password alone; under a strict policy a client that cannot do the factor is refused instead.- Parameters:
policy- The policy as it would resolve for ServerAdmin with the change, null or off for no policy.others- The other administrators with their enrolled factors.- Returns:
- null when every other administrator meets the policy; otherwise the warning, naming each administrator and what they lack.
enrolledAdministrators
public static List<StrongAuthGuards.Enrolled> enrolledAdministrators(String rpId) throws SQLException Reads the strong factors every member of the administrators group has enrolled now, from the stores: a passkey registered for the relying party ID of ServerAdmin, an authenticator app set up.- Parameters:
rpId- The relying party ID ServerAdmin's passkeys are registered under, null when passkeys are not offered (then nobody has the passkey factor).- Returns:
- The administrators with their factors, in the order of their names; empty when the group has no member.
- Throws:
SQLException- For database errors.
enrolledFactors
Reads the strong factors a user has enrolled now, from the stores.- Parameters:
uid- The user ID.rpId- The relying party ID the passkeys are registered under, null when passkeys are not offered.- Returns:
- The factors, in the order of
StrongAuthPolicy.ALL_FACTORS; unmodifiable. - Throws:
SQLException- For database errors.
inconsistentApplications
public static List<String> inconsistentApplications(Iterable<AppFactory> apps, UnaryOperator<String> server, String definitionOf, StrongAuthPolicy.Source definition) Resolves every application's strong policy as it would be with a candidate level in place of the live one, and names the applications whose combination then fails (the resolver's fail-closed case: every sign-in of such an application would be refused).- Parameters:
apps- The loaded applications.server- The candidate server settings by key with its prefix, null for a key not set; null for the live server settings.definitionOf- The application ID whose definition is the candidate, null for none.definition- The candidate definition's source for that application, null for the live one.- Returns:
- The problems, one per failing application ("application \"x\": floor 2 is more than count 1"); empty when every application resolves.
names