Class SignInSettingsRules
The levels. SignInSettingsRules.Level.SERVER: a property of the server settings ($signIn.*, SignInPolicy.SERVER_PREFIX and ServerSettings). SignInSettingsRules.Level.ADMIN_POLICY and SignInSettingsRules.Level.USER_POLICY: a property of the two password policy containers $admin and $user (PolicyProps). SignInSettingsRules.Level.ENVIRONMENT: an entry of a server environment's custom application settings (customApp, the passkey keys of PasskeySettings), chosen per environment. An application's own values (signIn.* in its module project, in its jar) are not edited here: they are shown read only with their source.
Values. Every value crosses this class as a text: the text written to the configuration, or null for a setting that is absent (its default applies; writing null removes the key). A choice is its number ("0", "1", "2"), a flag is "true" or "false", a number is its digits, the methods are the names separated by commas, in the order of SignInPolicy.ALL_METHODS.
What a change does to sessions already signed in: nothing. Every setting here is read where it is used (SignInPolicies, PasskeySettings, ServerSettings), so a change applies at the next sign-in or the next check without a restart; the password policies are cached in ServerSettings and the page drops the caches when it saves (ServerSettings.dropPasswordPolicies()).
The strong authentication policy (CC-SERVERADMIN-STRONG-AUTH, order 551): the six server-level keys $signIn.strong.* are settings of SignInSettingsRules.Kind.STRONG - each value is checked by the policy's own parser (StrongAuthPolicy.Source.of(String, String, String, String, String, String, String): a value outside its range or above the supported maximum is refused where it is typed, naming what is supported), count and floor are written as integers and the rest as texts (the classes iiziGo's catalog names), and the six are read and written together as one source (strongSource(ServerSettings), writeStrong(ServerSettings, StrongAuthPolicy.Source)). The guards of the strong keys are StrongAuthGuards'; a change that lowers the strength (strongLowers(StrongAuthPolicy.Source, StrongAuthPolicy.Source)) is a G2 change.
No setting here is a secret today. SignInSettingsRules.Setting.secret exists for the keys to come (the sign-in providers' secrets): the audit line of a secret says that it changed, never its value.
- Author:
- Christopher Mindus
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe consequence of a change that a dialog states before the change is made (guard G3).static final recordThe effective value of a policy setting for an application, and where it comes from.static enumWhat kind of value a setting takes.static enumWhere a setting lives.static enumThe settings of the page, each with its key in its container, its level, its kind and its range.Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name a text says when a setting is absent (the default applies): "(default)".static final List<SignInSettingsRules.Setting> The settings of the administrators' password policy, in the page's order.static final List<SignInSettingsRules.Setting> The passkey settings of an environment, in the page's order.static final intThe most characters of a domain name: 253.static final intThe most passwords a history keeps: 100.static final intThe least and the most minimum length of a password: 4 (below itPolicyProps.getPasswordMinLength()answers the default) and 128.static final intThe most characters of a relying party name: 64 (WebAuthn truncates longer ones).static final intThe most characters of the support contact: 200.static final intThe most days an e-mail address may stay unverified: 3650 (iiziGo's catalog range).static final intThe least and the most minimum length of a password: 4 (below itPolicyProps.getPasswordMinLength()answers the default) and 128.static final List<SignInSettingsRules.Setting> The settings of the server level, in the page's order.static final StringThe source of an application's effective value, as the Applications card states it.static final StringThe source of an application's effective value, as the Applications card states it.static final StringThe source of an application's effective value, as the Applications card states it.static final StringThe source of an application's effective value, as the Applications card states it.static final StringThe prefix of the strong keys at the server level:$signIn.strong..static final List<SignInSettingsRules.Setting> The six keys of the strong authentication policy, in the order ofStrongAuthPolicy.KEYS.static final List<SignInSettingsRules.Setting> The settings of the users' password policy, in the page's order.Method Summary
Modifier and TypeMethodDescriptionstatic SignInPolicy.SecondFactoradminFactor(String secondFactor, String administrators) Gets the administrators' effective second step from the two written choices.static Stringaudit(SignInSettingsRules.Setting setting, String environment, String oldValue, String newValue, String administrator, boolean lowers) Logs the audit line: INFO, WARNING when the change lowers the administrators' protection.static StringauditLine(SignInSettingsRules.Setting setting, String environment, String oldValue, String newValue, String administrator, boolean lowers) Builds the audit line of a changed key: "Sign-in setting $signIn.trustDeviceDays changed from 30 to 7 by iiziAdmin (ServerAdmin)", with "(default)" for an absent value, the environment named for an environment entry, and never the value of a secret.static Stringcheck(SignInSettingsRules.Setting setting, String value) Checks a value of a setting that is no passkey entry: its range as the readers clamp it and as iiziGo's catalog states it, the method names, the form of a link.consequence(SignInSettingsRules.Setting setting, String oldEffective, String newEffective) Gets the consequence a dialog states before a change is made, where there is one: the relying party ID changes (the old passkeys stop working), staying signed in is turned off (every device that stays signed in is signed out at its next use), the trust days become 0 (no device is trusted any more).static Stringcurrent(ServerSettings settings, ServerConfigEnvProps env, SignInSettingsRules.Setting setting) Gets the value of a setting as it is written, as a text.static StringdefaultOf(SignInSettingsRules.Setting setting) Gets the default of a setting as a text: what applies when the setting is absent.static Stringeffective(SignInSettingsRules.Setting setting, String value) Gets the value that applies: the written one, or the default when it is absent.effectiveOf(SignInSettingsRules.Setting setting, ServerSettings settings, AppFactory app) Gets the effective value of a server-level setting for an application and its source, asSignInPolicy.resolve(PropCnr, PropCnr)decides it: the application's own value when it sets one, the server's when it sets one, the default otherwise.effectiveRpId(AppFactory app) Gets the effective relying party ID of an application and its source: the application's own entry, the environment's, or the default (the host of the server's external URL); the source isSOURCE_DEFAULTas well when the resolved settings offer no passkeys.static booleanChecks if the server runs in development mode, asSignInPoliciesdecides the default of the administrators' second step (DEV-2FA-1): run from Eclipse, not built into jars.static StringlockOut(UnaryOperator<String> server, UnaryOperator<String> environment, UnaryOperator<String> application, String externalURL, String defaultName) Checks if candidate settings would lock the administrators out: a second step required of them (for every user, or for the administrators) while ServerAdmin's own application offers no method a user without one can set up - neither an authenticator app nor a passkey with passkeys on and a relying party ID for the environment ServerAdmin runs in.static booleanlowersProtection(SignInSettingsRules.Setting setting, String oldValue, String newValue, String secondFactor, String administrators) Checks if a change lowers the administrators' protection (SAS-D-6): their second step goes from required to not required (the administrators' choice set to "as every user" while every user's is lower, or every user's lowered while the administrators follow it); more days a device is trusted; staying signed in turned on or kept for more days; the administrators' password policy weakened.static StringpasskeyDefault(SignInSettingsRules.Setting setting, UnaryOperator<String> environment, UnaryOperator<String> application, String externalURL, String defaultName) Gets the default of a passkey entry of an environment: whatPasskeySettings.resolve(UnaryOperator, UnaryOperator, String, String)gives the application when the environment does not set it, computed from the current values with the entry left out.passkeyProblems(UnaryOperator<String> environment, UnaryOperator<String> application, String externalURL, String defaultName) Checks the passkey entries of an environment as the sign-in resolves them: every problemPasskeySettings.resolve(UnaryOperator, UnaryOperator, String, String)reports, by the key it is about, so the page shows each on its field and refuses the save - the page cannot accept what the server would drop.static booleanstrongLowers(StrongAuthPolicy.Source before, StrongAuthPolicy.Source after) Checks if a change of the server's strong policy lowers the administrators' protection (guard G2): the new policy does not raise the old one in every field (StrongAuthPolicy.isRaisedBy(StrongAuthPolicy): a smaller count or floor, a factor allowed anew, a mandatory factor dropped, strict made flexible, everyone narrowed to the administrators).static StrongAuthPolicy.SourcestrongSource(ServerSettings settings) Gets the strong authentication policy the server settings set, as one source: what the six keys say.static UnaryOperator<String> strongValues(StrongAuthPolicy.Source source) Gets the texts of a strong source by key with its prefix, as the candidate values of a guard read them.static Stringwrite(ServerSettings settings, ServerConfigEnvProps env, SignInSettingsRules.Setting setting, String value) Writes a setting to its container: an integer as anIntProp, a flag as aBoolProp, a text as aStringProp- the classes iiziGo's catalog names, so the file keeps the form iiziGo reads - and a passkey entry into the environment's map.static Map<SignInSettingsRules.Setting, String> writeStrong(ServerSettings settings, StrongAuthPolicy.Source source) Writes the server's strong policy: the six keys from a source, each set key with the class iiziGo's catalog names (countandflooras integers, the rest as texts), each unset key removed.
Field Details
MAX_VERIFICATION_DAYS
public static final int MAX_VERIFICATION_DAYSThe most days an e-mail address may stay unverified: 3650 (iiziGo's catalog range).- See Also:
MAX_SUPPORT_LENGTH
public static final int MAX_SUPPORT_LENGTHThe most characters of the support contact: 200.- See Also:
MIN_PASSWORD_LENGTH
public static final int MIN_PASSWORD_LENGTHThe least and the most minimum length of a password: 4 (below itPolicyProps.getPasswordMinLength()answers the default) and 128.- See Also:
MAX_PASSWORD_LENGTH
public static final int MAX_PASSWORD_LENGTHThe least and the most minimum length of a password: 4 (below itPolicyProps.getPasswordMinLength()answers the default) and 128.- See Also:
MAX_HISTORY
public static final int MAX_HISTORYThe most passwords a history keeps: 100.- See Also:
MAX_DOMAIN_LENGTH
public static final int MAX_DOMAIN_LENGTHThe most characters of a domain name: 253.- See Also:
MAX_RP_NAME_LENGTH
public static final int MAX_RP_NAME_LENGTHThe most characters of a relying party name: 64 (WebAuthn truncates longer ones).- See Also:
SERVER_SETTINGS
The settings of the server level, in the page's order.ADMIN_POLICY_SETTINGS
The settings of the administrators' password policy, in the page's order.USER_POLICY_SETTINGS
The settings of the users' password policy, in the page's order.ENVIRONMENT_SETTINGS
The passkey settings of an environment, in the page's order.STRONG_SETTINGS
The six keys of the strong authentication policy, in the order ofStrongAuthPolicy.KEYS.STRONG_PREFIX
The prefix of the strong keys at the server level:$signIn.strong..- See Also:
ABSENT
The name a text says when a setting is absent (the default applies): "(default)".- See Also:
SOURCE_DEFAULT
The source of an application's effective value, as the Applications card states it.- See Also:
SOURCE_SERVER
The source of an application's effective value, as the Applications card states it.- See Also:
SOURCE_ENVIRONMENT
The source of an application's effective value, as the Applications card states it.- See Also:
SOURCE_APPLICATION
The source of an application's effective value, as the Applications card states it.- See Also:
Method Details
isDevelopmentMode
public static boolean isDevelopmentMode()Checks if the server runs in development mode, asSignInPoliciesdecides the default of the administrators' second step (DEV-2FA-1): run from Eclipse, not built into jars.- Returns:
- true in development mode.
current
public static String current(ServerSettings settings, ServerConfigEnvProps env, SignInSettingsRules.Setting setting) Gets the value of a setting as it is written, as a text.- Parameters:
settings- The server settings.env- The environment, for an environment setting; null otherwise.setting- The setting.- Returns:
- The text of the written value, null when the setting is absent.
defaultOf
Gets the default of a setting as a text: what applies when the setting is absent. The default of the administrators' second step depends on the mode of this server (DEV-2FA-1). The defaults of the passkey entries depend on the server's external URL and on the application they are resolved for;passkeyDefault(SignInSettingsRules.Setting, UnaryOperator, UnaryOperator, String, String)gives them.- Parameters:
setting- The setting, not a passkey entry.- Returns:
- The default as a text, never null (empty for a text that defaults to none).
effective
Gets the value that applies: the written one, or the default when it is absent.- Parameters:
setting- The setting, not a passkey entry.value- The written value, null for absent.- Returns:
- The effective value as a text.
passkeyDefault
public static String passkeyDefault(SignInSettingsRules.Setting setting, UnaryOperator<String> environment, UnaryOperator<String> application, String externalURL, String defaultName) Gets the default of a passkey entry of an environment: whatPasskeySettings.resolve(UnaryOperator, UnaryOperator, String, String)gives the application when the environment does not set it, computed from the current values with the entry left out.- Parameters:
setting- The passkey entry.environment- The environment's values by key, null for a key it does not set.application- The application's values by key, null likewise;k->nullfor the environment alone.externalURL- The server's external URL, null for none.defaultName- The relying party name when none is configured (the application's description).- Returns:
- The default as a text, empty for none.
check
Checks a value of a setting that is no passkey entry: its range as the readers clamp it and as iiziGo's catalog states it, the method names, the form of a link. A passkey entry is checked bypasskeyProblems(UnaryOperator, UnaryOperator, String, String), through the same code the sign-in runs.- Parameters:
setting- The setting.value- The value typed, null or blank for "absent, the default applies".- Returns:
- null when the value is accepted; otherwise why it is refused.
strongSource
Gets the strong authentication policy the server settings set, as one source: what the six keys say.- Parameters:
settings- The server settings.- Returns:
- The source,
StrongAuthPolicy.Source.NONEwhen no key is set. - Throws:
IllegalArgumentException- If a key holds a value the parser refuses (a file of a later version read by this one: the start refuses such a file, so a running server has none).
strongValues
Gets the texts of a strong source by key with its prefix, as the candidate values of a guard read them.- Parameters:
source- The source, null for none.- Returns:
- The reader: the text of a key the source sets (
$signIn.strong.countto its number, the factors comma-separated, an empty mandatory list as a dash), null for a key it does not set.
strongLowers
Checks if a change of the server's strong policy lowers the administrators' protection (guard G2): the new policy does not raise the old one in every field (StrongAuthPolicy.isRaisedBy(StrongAuthPolicy): a smaller count or floor, a factor allowed anew, a mandatory factor dropped, strict made flexible, everyone narrowed to the administrators). Turning the policy off from on lowers it; turning it on lowers nothing.- Parameters:
before- What the server settings set before,StrongAuthPolicy.Source.NONEfor nothing.after- What they set after.- Returns:
- true when the change lowers the administrators' protection.
writeStrong
public static Map<SignInSettingsRules.Setting, String> writeStrong(ServerSettings settings, StrongAuthPolicy.Source source) throws PropException Writes the server's strong policy: the six keys from a source, each set key with the class iiziGo's catalog names (countandflooras integers, the rest as texts), each unset key removed. Nothing is saved to the file here: the caller saves through the server.- Parameters:
settings- The server settings.source- The source, null orStrongAuthPolicy.Source.NONEto remove every key.- Returns:
- What the six keys were before, by key with its prefix (null for absent), in the order of
STRONG_SETTINGS. - Throws:
PropException- If the container refuses a property.
passkeyProblems
public static Map<String,String> passkeyProblems(UnaryOperator<String> environment, UnaryOperator<String> application, String externalURL, String defaultName) Checks the passkey entries of an environment as the sign-in resolves them: every problemPasskeySettings.resolve(UnaryOperator, UnaryOperator, String, String)reports, by the key it is about, so the page shows each on its field and refuses the save - the page cannot accept what the server would drop.- Parameters:
environment- The candidate values of the environment by key, null for a key it does not set.application- The application's values by key, null likewise;k->nullfor the environment alone.externalURL- The server's external URL, null for none.defaultName- The relying party name when none is configured.- Returns:
- The problems by key (a problem about the external URL under
PasskeySettings.KEY_RP_ID), empty when the values are accepted; unmodifiable.
lockOut
public static String lockOut(UnaryOperator<String> server, UnaryOperator<String> environment, UnaryOperator<String> application, String externalURL, String defaultName) Checks if candidate settings would lock the administrators out: a second step required of them (for every user, or for the administrators) while ServerAdmin's own application offers no method a user without one can set up - neither an authenticator app nor a passkey with passkeys on and a relying party ID for the environment ServerAdmin runs in. The server would then refuse every administrator's sign-in with SEVERE (UserAuthenticationUIImpl: "requires a second factor and has no method this server can enroll"), and only a file edit could undo it. The policy is resolved as the sign-in resolves it (SignInPolicies, the development default included) and narrowed to what this server can do (UserMFA.METHODS, a passkey where the passkey settings resolve enabled).- Parameters:
server- The candidate server values by key ($signIn.*), null for absent.environment- The candidate values of ServerAdmin's environment by key, null for absent.application- ServerAdmin's own values by key (signIn.*of its module project andsignIn.passkey.*of its custom settings), null for absent;k->nullwhen it sets nothing.externalURL- The server's external URL, null for none.defaultName- The relying party name when none is configured.- Returns:
- null when the administrators can still sign in; otherwise why the change is refused.
lowersProtection
public static boolean lowersProtection(SignInSettingsRules.Setting setting, String oldValue, String newValue, String secondFactor, String administrators) Checks if a change lowers the administrators' protection (SAS-D-6): their second step goes from required to not required (the administrators' choice set to "as every user" while every user's is lower, or every user's lowered while the administrators follow it); more days a device is trusted; staying signed in turned on or kept for more days; the administrators' password policy weakened. Raising protection is never guarded. The values compared are the effective ones (an absent value is its default, the administrators' default by the mode of this server).- Parameters:
setting- The setting that changes.oldValue- Its written value before, null for absent.newValue- Its written value after, null for absent.secondFactor- The written value ofSignInSettingsRules.Setting.SECOND_FACTORas it is (the one of the two that does not change), null for absent; for the two second-step settings.administrators- The written value ofSignInSettingsRules.Setting.SECOND_FACTOR_ADMINISTRATORSas it is, null for absent; for the two second-step settings.- Returns:
- true when the change lowers the administrators' protection.
adminFactor
Gets the administrators' effective second step from the two written choices.- Parameters:
secondFactor- The written$signIn.secondFactor, null for absent.administrators- The written$signIn.secondFactorAdministrators, null for absent.- Returns:
- What the policy would say for an administrator.
consequence
public static SignInSettingsRules.Consequence consequence(SignInSettingsRules.Setting setting, String oldEffective, String newEffective) Gets the consequence a dialog states before a change is made, where there is one: the relying party ID changes (the old passkeys stop working), staying signed in is turned off (every device that stays signed in is signed out at its next use), the trust days become 0 (no device is trusted any more).- Parameters:
setting- The setting that changes.oldEffective- Its effective value before (the default applied, for a passkey entrypasskeyDefault(SignInSettingsRules.Setting, UnaryOperator, UnaryOperator, String, String)applied).newEffective- Its effective value after, likewise.- Returns:
- The consequence, null for none.
write
public static String write(ServerSettings settings, ServerConfigEnvProps env, SignInSettingsRules.Setting setting, String value) throws PropException Writes a setting to its container: an integer as anIntProp, a flag as aBoolProp, a text as aStringProp- the classes iiziGo's catalog names, so the file keeps the form iiziGo reads - and a passkey entry into the environment's map. A null or blank value removes the key, so the default applies. The methods are written normalized: the names in the order ofSignInPolicy.ALL_METHODS, separated by ", ". Nothing is saved to the file here: the caller saves through the server, and drops the password policy caches when a policy changed.- Parameters:
settings- The server settings.env- The environment, for an environment setting; null otherwise.setting- The setting.value- The value as a text, null or blank to remove the key.- Returns:
- The written value before the change as a text, null when it was absent.
- Throws:
PropException- If the container refuses the property.IllegalArgumentException- If the value does not passcheck(SignInSettingsRules.Setting, String), or an environment setting has no environment.
auditLine
public static String auditLine(SignInSettingsRules.Setting setting, String environment, String oldValue, String newValue, String administrator, boolean lowers) Builds the audit line of a changed key: "Sign-in setting $signIn.trustDeviceDays changed from 30 to 7 by iiziAdmin (ServerAdmin)", with "(default)" for an absent value, the environment named for an environment entry, and never the value of a secret.- Parameters:
setting- The setting.environment- The environment's name for an environment entry, null otherwise.oldValue- The written value before, null for absent.newValue- The written value after, null for absent.administrator- The administrator's user ID.lowers- Whether the change lowers the administrators' protection (said in the line).- Returns:
- The line.
audit
public static String audit(SignInSettingsRules.Setting setting, String environment, String oldValue, String newValue, String administrator, boolean lowers) Logs the audit line: INFO, WARNING when the change lowers the administrators' protection.- Parameters:
setting- The setting.environment- The environment's name for an environment entry, null otherwise.oldValue- The written value before, null for absent.newValue- The written value after, null for absent.administrator- The administrator's user ID.lowers- Whether the change lowers the administrators' protection.- Returns:
- The line logged.
effectiveOf
public static SignInSettingsRules.Effective effectiveOf(SignInSettingsRules.Setting setting, ServerSettings settings, AppFactory app) Gets the effective value of a server-level setting for an application and its source, asSignInPolicy.resolve(PropCnr, PropCnr)decides it: the application's own value when it sets one, the server's when it sets one, the default otherwise.- Parameters:
setting- A server-level setting of the policy (the second step, the methods, the trust days, account creation, the verification days, the links).settings- The server settings.app- The application.- Returns:
- The effective value and its source.
effectiveRpId
Gets the effective relying party ID of an application and its source: the application's own entry, the environment's, or the default (the host of the server's external URL); the source isSOURCE_DEFAULTas well when the resolved settings offer no passkeys.- Parameters:
app- The application.- Returns:
- The effective relying party ID (empty when passkeys are not offered) and its source.