Browse Source

reformat whitespace and brackets

Jason Rivard 7 years ago
parent
commit
4967b10186
100 changed files with 4571 additions and 2956 deletions
  1. 1 1
      server/pom.xml
  2. 35 43
      server/src/build/checkstyle.xml
  3. 17 17
      server/src/main/java/password/pwm/Permission.java
  4. 173 150
      server/src/main/java/password/pwm/PwmAboutProperty.java
  5. 15 7
      server/src/main/java/password/pwm/PwmApplicationMode.java
  6. 81 61
      server/src/main/java/password/pwm/PwmConstants.java
  7. 316 204
      server/src/main/java/password/pwm/PwmEnvironment.java
  8. 4 3
      server/src/main/java/password/pwm/PwmHttpFilterAuthenticationProvider.java
  9. 25 20
      server/src/main/java/password/pwm/VerificationMethodSystem.java
  10. 5 5
      server/src/main/java/password/pwm/bean/EmailItemBean.java
  11. 6 5
      server/src/main/java/password/pwm/bean/FormNonce.java
  12. 11 6
      server/src/main/java/password/pwm/bean/LocalSessionStateBean.java
  13. 79 56
      server/src/main/java/password/pwm/bean/LoginInfoBean.java
  14. 7 4
      server/src/main/java/password/pwm/bean/PasswordStatus.java
  15. 10 6
      server/src/main/java/password/pwm/bean/PrivateKeyCertificate.java
  16. 14 7
      server/src/main/java/password/pwm/bean/RemoteVerificationRequestBean.java
  17. 18 9
      server/src/main/java/password/pwm/bean/RemoteVerificationResponseBean.java
  18. 24 15
      server/src/main/java/password/pwm/bean/ResponseInfoBean.java
  19. 16 13
      server/src/main/java/password/pwm/bean/SessionLabel.java
  20. 5 3
      server/src/main/java/password/pwm/bean/SmsItemBean.java
  21. 19 15
      server/src/main/java/password/pwm/bean/TokenDestinationItem.java
  22. 16 8
      server/src/main/java/password/pwm/bean/TokenVerificationProgress.java
  23. 118 76
      server/src/main/java/password/pwm/bean/UserIdentity.java
  24. 12 9
      server/src/main/java/password/pwm/bean/pub/PublicUserInfoBean.java
  25. 2 1
      server/src/main/java/password/pwm/bean/pub/PublishedBean.java
  26. 2 1
      server/src/main/java/password/pwm/bean/pub/SessionStateInfoBean.java
  27. 504 331
      server/src/main/java/password/pwm/config/Configuration.java
  28. 19 12
      server/src/main/java/password/pwm/config/CustomLinkConfiguration.java
  29. 19 13
      server/src/main/java/password/pwm/config/LDAPPermissionInfo.java
  30. 243 188
      server/src/main/java/password/pwm/config/PwmSettingCategory.java
  31. 2 1
      server/src/main/java/password/pwm/config/PwmSettingFlag.java
  32. 2 1
      server/src/main/java/password/pwm/config/PwmSettingProperty.java
  33. 31 30
      server/src/main/java/password/pwm/config/PwmSettingSyntax.java
  34. 40 34
      server/src/main/java/password/pwm/config/PwmSettingTemplate.java
  35. 25 15
      server/src/main/java/password/pwm/config/PwmSettingTemplateSet.java
  36. 64 43
      server/src/main/java/password/pwm/config/PwmSettingXml.java
  37. 13 12
      server/src/main/java/password/pwm/config/SettingReader.java
  38. 3 2
      server/src/main/java/password/pwm/config/SettingUIFunction.java
  39. 14 12
      server/src/main/java/password/pwm/config/StoredValue.java
  40. 23 17
      server/src/main/java/password/pwm/config/function/AbstractUriCertImportFunction.java
  41. 41 25
      server/src/main/java/password/pwm/config/function/ActionCertImportFunction.java
  42. 27 18
      server/src/main/java/password/pwm/config/function/LdapCertImportFunction.java
  43. 23 16
      server/src/main/java/password/pwm/config/function/OAuthCertImportFunction.java
  44. 48 26
      server/src/main/java/password/pwm/config/function/RemoteWebServiceCertImportFunction.java
  45. 36 22
      server/src/main/java/password/pwm/config/function/SyslogCertImportFunction.java
  46. 76 49
      server/src/main/java/password/pwm/config/function/UserMatchViewerFunction.java
  47. 2 1
      server/src/main/java/password/pwm/config/option/ADPolicyComplexity.java
  48. 2 1
      server/src/main/java/password/pwm/config/option/ApplicationPage.java
  49. 2 1
      server/src/main/java/password/pwm/config/option/ConfigurationOption.java
  50. 2 1
      server/src/main/java/password/pwm/config/option/DataStorageMethod.java
  51. 2 1
      server/src/main/java/password/pwm/config/option/DuplicateMode.java
  52. 2 1
      server/src/main/java/password/pwm/config/option/ForceSetupPolicy.java
  53. 2 1
      server/src/main/java/password/pwm/config/option/HelpdeskClearResponseMode.java
  54. 2 1
      server/src/main/java/password/pwm/config/option/HelpdeskUIMode.java
  55. 23 19
      server/src/main/java/password/pwm/config/option/IdentityVerificationMethod.java
  56. 2 1
      server/src/main/java/password/pwm/config/option/IntruderStorageMethod.java
  57. 16 12
      server/src/main/java/password/pwm/config/option/MessageSendMethod.java
  58. 20 22
      server/src/main/java/password/pwm/config/option/OTPStorageFormat.java
  59. 2 1
      server/src/main/java/password/pwm/config/option/PasswordSyncCheckMode.java
  60. 2 1
      server/src/main/java/password/pwm/config/option/RecoveryAction.java
  61. 2 1
      server/src/main/java/password/pwm/config/option/RequireCurrentPasswordMode.java
  62. 2 1
      server/src/main/java/password/pwm/config/option/SelectableContextMode.java
  63. 2 1
      server/src/main/java/password/pwm/config/option/SessionBeanMode.java
  64. 2 1
      server/src/main/java/password/pwm/config/option/SessionVerificationMode.java
  65. 2 1
      server/src/main/java/password/pwm/config/option/StrengthMeterType.java
  66. 11 10
      server/src/main/java/password/pwm/config/option/TLSVersion.java
  67. 2 1
      server/src/main/java/password/pwm/config/option/TokenStorageMethod.java
  68. 2 1
      server/src/main/java/password/pwm/config/option/UserEventStorageMethod.java
  69. 2 1
      server/src/main/java/password/pwm/config/option/ViewStatusFields.java
  70. 2 1
      server/src/main/java/password/pwm/config/option/WebServiceUsage.java
  71. 81 55
      server/src/main/java/password/pwm/config/profile/AbstractProfile.java
  72. 98 62
      server/src/main/java/password/pwm/config/profile/ChallengeProfile.java
  73. 12 8
      server/src/main/java/password/pwm/config/profile/DeleteAccountProfile.java
  74. 32 21
      server/src/main/java/password/pwm/config/profile/ForgottenPasswordProfile.java
  75. 20 14
      server/src/main/java/password/pwm/config/profile/HelpdeskProfile.java
  76. 64 47
      server/src/main/java/password/pwm/config/profile/LdapProfile.java
  77. 82 52
      server/src/main/java/password/pwm/config/profile/NewUserProfile.java
  78. 6 5
      server/src/main/java/password/pwm/config/profile/Profile.java
  79. 16 12
      server/src/main/java/password/pwm/config/profile/ProfileType.java
  80. 13 9
      server/src/main/java/password/pwm/config/profile/ProfileUtility.java
  81. 249 164
      server/src/main/java/password/pwm/config/profile/PwmPasswordPolicy.java
  82. 403 83
      server/src/main/java/password/pwm/config/profile/PwmPasswordRule.java
  83. 28 20
      server/src/main/java/password/pwm/config/profile/UpdateAttributesProfile.java
  84. 7 6
      server/src/main/java/password/pwm/config/stored/ConfigChangeLog.java
  85. 64 43
      server/src/main/java/password/pwm/config/stored/ConfigChangeLogImpl.java
  86. 11 12
      server/src/main/java/password/pwm/config/stored/ConfigurationProperty.java
  87. 143 83
      server/src/main/java/password/pwm/config/stored/ConfigurationReader.java
  88. 62 38
      server/src/main/java/password/pwm/config/stored/NGStorageEngineImpl.java
  89. 59 39
      server/src/main/java/password/pwm/config/stored/NGStoredConfiguration.java
  90. 88 62
      server/src/main/java/password/pwm/config/stored/NGStoredConfigurationFactory.java
  91. 9 8
      server/src/main/java/password/pwm/config/stored/StorageEngine.java
  92. 7 5
      server/src/main/java/password/pwm/config/stored/StoredConfigReference.java
  93. 27 16
      server/src/main/java/password/pwm/config/stored/StoredConfigReferenceBean.java
  94. 14 13
      server/src/main/java/password/pwm/config/stored/StoredConfiguration.java
  95. 4 3
      server/src/main/java/password/pwm/config/stored/StoredConfigurationFactory.java
  96. 492 322
      server/src/main/java/password/pwm/config/stored/StoredConfigurationImpl.java
  97. 4 3
      server/src/main/java/password/pwm/config/stored/StoredConfigurationProvider.java
  98. 60 41
      server/src/main/java/password/pwm/config/stored/StoredConfigurationUtil.java
  99. 6 4
      server/src/main/java/password/pwm/config/stored/ValueMetaData.java
  100. 16 11
      server/src/main/java/password/pwm/config/value/AbstractValue.java

+ 1 - 1
server/pom.xml

@@ -542,7 +542,7 @@
             <plugin>
                 <groupId>com.github.spotbugs</groupId>
                 <artifactId>spotbugs-maven-plugin</artifactId>
-                <version>3.1.0-RC8</version>
+                <version>3.1.1</version>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

+ 35 - 43
server/src/build/checkstyle.xml

@@ -56,7 +56,6 @@
     </module>
 
     <module name="TreeWalker">
-
         <property name="cacheFile" value="target/checkstyle.cache"/>
 
         <!-- required for SuppressWarningsFilter (and other Suppress* rules not used here) -->
@@ -75,41 +74,24 @@
             <property name="allowNonPrintableEscapes" value="true"/>
         </module>
 
-        <!--
         <module name="LineLength">
-            <property name="max" value="200" />
+            <property name="max" value="180" />
             <property name="ignorePattern" value="@version|@see|@todo|TODO"/>
         </module>
-        -->
-        <!-- required for SuppressionCommentFilter -->
-        <!-- see http://checkstyle.sourceforge.net/config.html#SuppressionCommentFilter -->
-        <!--
-        <module name="FileContentsHolder"/>
-
-
-        -->
 
         <module name="EmptyBlock">
             <property name="option" value="TEXT"/>
             <property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
         </module>
-        <!--
+
         <module name="LeftCurly">
             <property name="option" value="nl"/>
-            <property name="maxLineLength" value="100"/>
         </module>
-        -->
 
-        <module name="RightCurly"/>
         <module name="RightCurly">
             <property name="option" value="alone"/>
-            <property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
         </module>
 
-        <!--
-        <module name="MemberName" />
-        -->
-
         <!-- Checks for Javadoc comments.                     -->
         <!-- See http://checkstyle.sf.net/config_javadoc.html -->
         <!--
@@ -135,11 +117,11 @@
         <!-- Checks for Naming Conventions.                  -->
         <!-- See http://checkstyle.sf.net/config_naming.html -->
         <!--
+        -->
         <module name="MemberName">
             <property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
         </module>
-        <module name="TypeName">
-        -->
+        <module name="TypeName"/>
         <module name="ConstantName"/>
         <module name="PackageName">
             <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
@@ -160,15 +142,13 @@
         <module name="InterfaceTypeParameterName">
             <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
         </module>
-        <!--
         <module name="LocalFinalVariableName"/>
-        <module name="LocalVariableName"/>
+
         <module name="MethodName"/>
-        <module name="PackageName"/>
         <module name="ParameterName"/>
-        <module name="StaticVariableName"/>
-        <module name="TypeName"/>
+        <!--
         -->
+        <module name="StaticVariableName"/>
 
         <!-- Checks for imports                              -->
         <!-- See http://checkstyle.sf.net/config_import.html -->
@@ -184,11 +164,8 @@
 
         <!-- Checks for Size Violations.                    -->
         <!-- See http://checkstyle.sf.net/config_sizes.html -->
-        <!--
         <module name="MethodLength"/>
         <module name="ParameterNumber"/>
-        -->
-
 
         <!-- Checks for whitespace                               -->
         <!-- See http://checkstyle.sf.net/config_whitespace.html -->
@@ -197,18 +174,16 @@
         </module>
         <module name="EmptyForInitializerPad"/>
         <module name="NeedBraces"/>
-        <!--
-        -->
-        <!-- module name="NoWhitespaceAfter"/ -->
-        <!-- module name="NoWhitespaceBefore"/ -->
-        <!--
+        <module name="NoWhitespaceAfter"/>
+        <module name="NoWhitespaceBefore"/>
+
         <module name="OperatorWrap"/>
         <module name="ParenPad">
             <property name="option" value="space" />
         </module>
+
         <module name="WhitespaceAfter"/>
         <module name="WhitespaceAround"/>
-        -->
         <!-- module name="MethodParamPad"/ -->
         <module name="GenericWhitespace"/>
         <module name="EmptyLineSeparator">
@@ -230,21 +205,26 @@
         <!--
         <module name="AvoidNestedBlocks"/>
         -->
+        <module name="EmptyBlock">
+            <property name="option" value="TEXT"/>
+            <property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
+        </module>
+
+
 
+        <module name="IllegalInstantiation"/>
 
         <!-- Checks for common coding problems               -->
         <!-- See http://checkstyle.sf.net/config_coding.html -->
         <!-- module name="AvoidInlineConditionals"/ -->
         <!--
         <module name="EmptyStatement"/>
-        <module name="EqualsHashCode"/>
         <module name="HiddenField">
             <property name="severity" value="warning"/>
             <property name="ignoreSetter" value="true"/>
             <property name="ignoreConstructorParameter" value="true"/>
         </module>
         <module name="IllegalInstantiation"/>
-        <module name="InnerAssignment"/>
         -->
         <!--
         <module name="MagicNumber">
@@ -268,17 +248,20 @@
 
         <!-- future enabled checks -->
         <!--
-        <module name="TrailingComment"/>
-        <module name="NPathComplexity"/>
-        <module name="EnumTrailingCommaCheck"/> //doesnt yet exist as of checkstyle 2.17
+        <module name="EnumTrailingCommaCheck"/>         //doesnt yet exist as of checkstyle 2.17
         <module name="MultipleStringLiterals"/>
-        <module name="InnerAssignment"/>
+        <module name="NPathComplexity"/>
         <module name="MagicNumber">
             <property name="ignoreNumbers" value="-4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 31, 32, 37, 64, 100, 128, 256, 512, 1000, 1024"/>
         </module>
-        <module name="SimplifyBooleanExpression"/>
+
         -->
 
+        <module name="InnerAssignment"/>
+        <module name="SimplifyBooleanExpression"/>
+        <module name="TrailingComment"/>
+
+
         <!-- coding -->
         <module name="FallThrough"/>
         <module name="EqualsHashCode"/>
@@ -299,6 +282,7 @@
         <module name="EqualsAvoidNull"/>
 
         <module name="MutableException"/>
+        <module name="OuterTypeFilename"/>
         <module name="TodoComment"/>
         <module name="NoLineWrap"/>
         <module name="OneTopLevelClass"/>
@@ -307,6 +291,14 @@
         <module name="UpperEll"/>
         <module name="PackageDeclaration"/>
         <module name="NoClone"/>
+
+        <!-- javadoc -->
+        <module name="JavadocParagraph"/>
+        <module name="AtclauseOrder"/>
+        <module name="JavadocStyle"/>
+        <module name="JavadocTagContinuationIndentation"/>
+        <module name="NonEmptyAtclauseDescription"/>
+        <module name="SingleLineJavadoc"/>
     </module>
 
     <!-- Support @SuppressWarnings (added in Checkstyle 5.7) -->

+ 17 - 17
server/src/main/java/password/pwm/Permission.java

@@ -28,36 +28,36 @@ import password.pwm.util.logging.PwmLogger;
 /**
  * @author Jason D. Rivard
  */
-public enum Permission {
-    PWMADMIN(PwmSetting.QUERY_MATCH_PWM_ADMIN),
-    CHANGE_PASSWORD(PwmSetting.QUERY_MATCH_CHANGE_PASSWORD),
-    ACTIVATE_USER(PwmSetting.ACTIVATE_USER_QUERY_MATCH),
-    SETUP_RESPONSE(PwmSetting.QUERY_MATCH_SETUP_RESPONSE),
-    SETUP_OTP_SECRET(PwmSetting.OTP_SETUP_USER_PERMISSION),
-    GUEST_REGISTRATION(PwmSetting.GUEST_ADMIN_GROUP),
-    PEOPLE_SEARCH(PwmSetting.PEOPLE_SEARCH_QUERY_MATCH),
-    PROFILE_UPDATE(PwmSetting.UPDATE_PROFILE_QUERY_MATCH),
-    WEBSERVICE(PwmSetting.WEBSERVICES_QUERY_MATCH),
-    WEBSERVICE_THIRDPARTY(PwmSetting.WEBSERVICES_THIRDPARTY_QUERY_MATCH),
+public enum Permission
+{
+    PWMADMIN( PwmSetting.QUERY_MATCH_PWM_ADMIN ),
+    CHANGE_PASSWORD( PwmSetting.QUERY_MATCH_CHANGE_PASSWORD ),
+    ACTIVATE_USER( PwmSetting.ACTIVATE_USER_QUERY_MATCH ),
+    SETUP_RESPONSE( PwmSetting.QUERY_MATCH_SETUP_RESPONSE ),
+    SETUP_OTP_SECRET( PwmSetting.OTP_SETUP_USER_PERMISSION ),
+    GUEST_REGISTRATION( PwmSetting.GUEST_ADMIN_GROUP ),
+    PEOPLE_SEARCH( PwmSetting.PEOPLE_SEARCH_QUERY_MATCH ),
+    PROFILE_UPDATE( PwmSetting.UPDATE_PROFILE_QUERY_MATCH ),
+    WEBSERVICE( PwmSetting.WEBSERVICES_QUERY_MATCH ),
+    WEBSERVICE_THIRDPARTY( PwmSetting.WEBSERVICES_THIRDPARTY_QUERY_MATCH ),;
 
-    ;
 
-
-    private static final PwmLogger LOGGER = PwmLogger.forClass(Permission.class);
+    private static final PwmLogger LOGGER = PwmLogger.forClass( Permission.class );
 
     private PwmSetting pwmSetting;
 
-    Permission(final PwmSetting pwmSetting)
+    Permission( final PwmSetting pwmSetting )
     {
         this.pwmSetting = pwmSetting;
     }
 
-    public PwmSetting getPwmSetting()
+    public PwmSetting getPwmSetting( )
     {
         return pwmSetting;
     }
 
-    public enum PermissionStatus {
+    public enum PermissionStatus
+    {
         UNCHECKED,
         GRANTED,
         DENIED

+ 173 - 150
server/src/main/java/password/pwm/PwmAboutProperty.java

@@ -38,209 +38,232 @@ import java.util.Date;
 import java.util.Map;
 import java.util.TreeMap;
 
-public enum PwmAboutProperty {
-
-    app_version(null),
-    app_chaiApiVersion(null),
-    app_currentTime(null),
-    app_startTime(null),
-    app_installTime(null),
-    app_currentPublishedVersion(null),
-    app_currentPublishedVersionCheckTime(null),
-    app_siteUrl(null),
-    app_instanceID(null),
-    app_trialMode(null),
-    app_mode_appliance(null),
-    app_mode_docker(null),
-    app_mode_manageHttps(null),
-    app_applicationPath(null),
-    app_environmentFlags(null),
-    app_wordlistSize(null),
-    app_seedlistSize(null),
-    app_sharedHistorySize(null),
-    app_sharedHistoryOldestTime(null),
-    app_emailQueueSize(null),
-    app_emailQueueOldestTime(null),
-    app_smsQueueSize(null),
-    app_smsQueueOldestTime(null),
-    app_syslogQueueSize(null),
-    app_localDbLogSize(null),
-    app_localDbLogOldestTime(null),
-    app_localDbStorageSize(null),
-    app_localDbFreeSpace(null),
-    app_configurationRestartCounter(null),
-    app_secureBlockAlgorithm(null),
-    app_secureHashAlgorithm(null),
-    app_ldapProfileCount(null),
-
-    build_Time(null),
-    build_Number(null),
-    build_Type(null),
-    build_User(null),
-    build_Revision(null),
-    build_JavaVendor(null),
-    build_JavaVersion(null),
-    build_Version(null),
-
-    java_memoryFree("Java Memory Free"),
-    java_memoryAllocated("Java Memory Allocated"),
-    java_memoryMax("Java Memory Max"),
-    java_threadCount("Java Thread Count"),
-    java_vmVendor("Java Vendor"),
-    java_vmLocation("Java VM Location"),
-    java_vmVersion("Java VM Version"),
-    java_runtimeVersion("Java Runtime Version"),
-    java_vmName("Java VM Name"),
-    java_osName("Java OS Name"),
-    java_osVersion("Java OS Version"),
-    java_osArch("Java OS Architecture"),
-    java_randomAlgorithm(null),
-    java_defaultCharset(null),
-    java_appServerInfo("Java AppServer Info"),
-
-    database_driverName(null),
-    database_driverVersion(null),
-    database_databaseProductName(null),
-    database_databaseProductVersion(null),
-
-    ;
+public enum PwmAboutProperty
+{
+
+    app_version( null ),
+    app_chaiApiVersion( null ),
+    app_currentTime( null ),
+    app_startTime( null ),
+    app_installTime( null ),
+    app_currentPublishedVersion( null ),
+    app_currentPublishedVersionCheckTime( null ),
+    app_siteUrl( null ),
+    app_instanceID( null ),
+    app_trialMode( null ),
+    app_mode_appliance( null ),
+    app_mode_docker( null ),
+    app_mode_manageHttps( null ),
+    app_applicationPath( null ),
+    app_environmentFlags( null ),
+    app_wordlistSize( null ),
+    app_seedlistSize( null ),
+    app_sharedHistorySize( null ),
+    app_sharedHistoryOldestTime( null ),
+    app_emailQueueSize( null ),
+    app_emailQueueOldestTime( null ),
+    app_smsQueueSize( null ),
+    app_smsQueueOldestTime( null ),
+    app_syslogQueueSize( null ),
+    app_localDbLogSize( null ),
+    app_localDbLogOldestTime( null ),
+    app_localDbStorageSize( null ),
+    app_localDbFreeSpace( null ),
+    app_configurationRestartCounter( null ),
+    app_secureBlockAlgorithm( null ),
+    app_secureHashAlgorithm( null ),
+    app_ldapProfileCount( null ),
+
+    build_Time( null ),
+    build_Number( null ),
+    build_Type( null ),
+    build_User( null ),
+    build_Revision( null ),
+    build_JavaVendor( null ),
+    build_JavaVersion( null ),
+    build_Version( null ),
+
+    java_memoryFree( "Java Memory Free" ),
+    java_memoryAllocated( "Java Memory Allocated" ),
+    java_memoryMax( "Java Memory Max" ),
+    java_threadCount( "Java Thread Count" ),
+    java_vmVendor( "Java Vendor" ),
+    java_vmLocation( "Java VM Location" ),
+    java_vmVersion( "Java VM Version" ),
+    java_runtimeVersion( "Java Runtime Version" ),
+    java_vmName( "Java VM Name" ),
+    java_osName( "Java OS Name" ),
+    java_osVersion( "Java OS Version" ),
+    java_osArch( "Java OS Architecture" ),
+    java_randomAlgorithm( null ),
+    java_defaultCharset( null ),
+    java_appServerInfo( "Java AppServer Info" ),
+
+    database_driverName( null ),
+    database_driverVersion( null ),
+    database_databaseProductName( null ),
+    database_databaseProductVersion( null ),;
 
     private final String label;
 
-    PwmAboutProperty(final String label) {
+    PwmAboutProperty( final String label )
+    {
         this.label = label;
     }
 
-    private static final PwmLogger LOGGER = PwmLogger.forClass(PwmAboutProperty.class);
+    private static final PwmLogger LOGGER = PwmLogger.forClass( PwmAboutProperty.class );
 
-    public static Map<PwmAboutProperty,String> makeInfoBean(
+    public static Map<PwmAboutProperty, String> makeInfoBean(
             final PwmApplication pwmApplication
-    ) {
-        final Map<PwmAboutProperty,String> aboutMap = new TreeMap<>();
+    )
+    {
+        final Map<PwmAboutProperty, String> aboutMap = new TreeMap<>();
 
         // about page
-        aboutMap.put(app_version,                  PwmConstants.SERVLET_VERSION);
-        aboutMap.put(app_currentTime,              dateFormatForInfoBean(new Date()));
-        aboutMap.put(app_startTime,                dateFormatForInfoBean(pwmApplication.getStartupTime()));
-        aboutMap.put(app_installTime,              dateFormatForInfoBean(pwmApplication.getInstallTime()));
-        aboutMap.put(app_siteUrl,                  pwmApplication.getConfig().readSettingAsString(PwmSetting.PWM_SITE_URL));
-        aboutMap.put(app_ldapProfileCount,         Integer.toString(pwmApplication.getConfig().getLdapProfiles().size()));
-        aboutMap.put(app_instanceID,               pwmApplication.getInstanceID());
-        aboutMap.put(app_trialMode,                Boolean.toString(PwmConstants.TRIAL_MODE));
-        if (pwmApplication.getPwmEnvironment() != null) {
-            aboutMap.put(app_mode_appliance,            Boolean.toString(pwmApplication.getPwmEnvironment().getFlags().contains(PwmEnvironment.ApplicationFlag.Appliance)));
-            aboutMap.put(app_mode_docker,               Boolean.toString(pwmApplication.getPwmEnvironment().getFlags().contains(PwmEnvironment.ApplicationFlag.Docker)));
-            aboutMap.put(app_mode_manageHttps,          Boolean.toString(pwmApplication.getPwmEnvironment().getFlags().contains(PwmEnvironment.ApplicationFlag.ManageHttps)));
-            aboutMap.put(app_applicationPath,           pwmApplication.getPwmEnvironment().getApplicationPath().getAbsolutePath());
-            aboutMap.put(app_environmentFlags,          StringUtil.collectionToString(pwmApplication.getPwmEnvironment().getFlags(),","));
+        aboutMap.put( app_version, PwmConstants.SERVLET_VERSION );
+        aboutMap.put( app_currentTime, dateFormatForInfoBean( new Date() ) );
+        aboutMap.put( app_startTime, dateFormatForInfoBean( pwmApplication.getStartupTime() ) );
+        aboutMap.put( app_installTime, dateFormatForInfoBean( pwmApplication.getInstallTime() ) );
+        aboutMap.put( app_siteUrl, pwmApplication.getConfig().readSettingAsString( PwmSetting.PWM_SITE_URL ) );
+        aboutMap.put( app_ldapProfileCount, Integer.toString( pwmApplication.getConfig().getLdapProfiles().size() ) );
+        aboutMap.put( app_instanceID, pwmApplication.getInstanceID() );
+        aboutMap.put( app_trialMode, Boolean.toString( PwmConstants.TRIAL_MODE ) );
+        if ( pwmApplication.getPwmEnvironment() != null )
+        {
+            aboutMap.put( app_mode_appliance, Boolean.toString( pwmApplication.getPwmEnvironment().getFlags().contains( PwmEnvironment.ApplicationFlag.Appliance ) ) );
+            aboutMap.put( app_mode_docker, Boolean.toString( pwmApplication.getPwmEnvironment().getFlags().contains( PwmEnvironment.ApplicationFlag.Docker ) ) );
+            aboutMap.put( app_mode_manageHttps, Boolean.toString( pwmApplication.getPwmEnvironment().getFlags().contains( PwmEnvironment.ApplicationFlag.ManageHttps ) ) );
+            aboutMap.put( app_applicationPath, pwmApplication.getPwmEnvironment().getApplicationPath().getAbsolutePath() );
+            aboutMap.put( app_environmentFlags, StringUtil.collectionToString( pwmApplication.getPwmEnvironment().getFlags(), "," ) );
         }
-        aboutMap.put(app_chaiApiVersion,           PwmConstants.CHAI_API_VERSION);
+        aboutMap.put( app_chaiApiVersion, PwmConstants.CHAI_API_VERSION );
 
-        aboutMap.put(app_secureBlockAlgorithm,     pwmApplication.getSecureService().getDefaultBlockAlgorithm().getLabel());
-        aboutMap.put(app_secureHashAlgorithm,      pwmApplication.getSecureService().getDefaultHashAlgorithm().toString());
+        aboutMap.put( app_secureBlockAlgorithm, pwmApplication.getSecureService().getDefaultBlockAlgorithm().getLabel() );
+        aboutMap.put( app_secureHashAlgorithm, pwmApplication.getSecureService().getDefaultHashAlgorithm().toString() );
 
-        aboutMap.put(app_wordlistSize,             Integer.toString(pwmApplication.getWordlistManager().size()));
-        aboutMap.put(app_seedlistSize,             Integer.toString(pwmApplication.getSeedlistManager().size()));
-        if (pwmApplication.getSharedHistoryManager() != null) {
-            aboutMap.put(app_sharedHistorySize,    Integer.toString(pwmApplication.getSharedHistoryManager().size()));
-            aboutMap.put(app_sharedHistoryOldestTime, dateFormatForInfoBean(pwmApplication.getSharedHistoryManager().getOldestEntryTime()));
+        aboutMap.put( app_wordlistSize, Integer.toString( pwmApplication.getWordlistManager().size() ) );
+        aboutMap.put( app_seedlistSize, Integer.toString( pwmApplication.getSeedlistManager().size() ) );
+        if ( pwmApplication.getSharedHistoryManager() != null )
+        {
+            aboutMap.put( app_sharedHistorySize, Integer.toString( pwmApplication.getSharedHistoryManager().size() ) );
+            aboutMap.put( app_sharedHistoryOldestTime, dateFormatForInfoBean( pwmApplication.getSharedHistoryManager().getOldestEntryTime() ) );
         }
 
 
-        if (pwmApplication.getEmailQueue() != null) {
-            aboutMap.put(app_emailQueueSize,       Integer.toString(pwmApplication.getEmailQueue().queueSize()));
-            if (pwmApplication.getEmailQueue().eldestItem() != null) {
-                aboutMap.put(app_emailQueueOldestTime, dateFormatForInfoBean(Date.from(pwmApplication.getEmailQueue().eldestItem())));
+        if ( pwmApplication.getEmailQueue() != null )
+        {
+            aboutMap.put( app_emailQueueSize, Integer.toString( pwmApplication.getEmailQueue().queueSize() ) );
+            if ( pwmApplication.getEmailQueue().eldestItem() != null )
+            {
+                aboutMap.put( app_emailQueueOldestTime, dateFormatForInfoBean( Date.from( pwmApplication.getEmailQueue().eldestItem() ) ) );
             }
         }
 
-        if (pwmApplication.getSmsQueue() != null) {
-            aboutMap.put(app_smsQueueSize,         Integer.toString(pwmApplication.getSmsQueue().queueSize()));
-            if (pwmApplication.getSmsQueue().eldestItem() != null) {
-                aboutMap.put(app_smsQueueOldestTime, dateFormatForInfoBean(Date.from(pwmApplication.getSmsQueue().eldestItem())));
+        if ( pwmApplication.getSmsQueue() != null )
+        {
+            aboutMap.put( app_smsQueueSize, Integer.toString( pwmApplication.getSmsQueue().queueSize() ) );
+            if ( pwmApplication.getSmsQueue().eldestItem() != null )
+            {
+                aboutMap.put( app_smsQueueOldestTime, dateFormatForInfoBean( Date.from( pwmApplication.getSmsQueue().eldestItem() ) ) );
             }
         }
 
-        if (pwmApplication.getAuditManager() != null) {
-            aboutMap.put(app_syslogQueueSize,      Integer.toString(pwmApplication.getAuditManager().syslogQueueSize()));
+        if ( pwmApplication.getAuditManager() != null )
+        {
+            aboutMap.put( app_syslogQueueSize, Integer.toString( pwmApplication.getAuditManager().syslogQueueSize() ) );
         }
 
-        if (pwmApplication.getLocalDB() != null) {
-            aboutMap.put(app_localDbLogSize,       Integer.toString(pwmApplication.getLocalDBLogger().getStoredEventCount()));
-            aboutMap.put(app_localDbLogOldestTime, dateFormatForInfoBean(pwmApplication.getLocalDBLogger().getTailDate()));
+        if ( pwmApplication.getLocalDB() != null )
+        {
+            aboutMap.put( app_localDbLogSize, Integer.toString( pwmApplication.getLocalDBLogger().getStoredEventCount() ) );
+            aboutMap.put( app_localDbLogOldestTime, dateFormatForInfoBean( pwmApplication.getLocalDBLogger().getTailDate() ) );
 
-            aboutMap.put(app_localDbStorageSize,   StringUtil.formatDiskSize(FileSystemUtility.getFileDirectorySize(pwmApplication.getLocalDB().getFileLocation())));
-            aboutMap.put(app_localDbFreeSpace,     StringUtil.formatDiskSize(FileSystemUtility.diskSpaceRemaining(pwmApplication.getLocalDB().getFileLocation())));
+            aboutMap.put( app_localDbStorageSize, StringUtil.formatDiskSize( FileSystemUtility.getFileDirectorySize( pwmApplication.getLocalDB().getFileLocation() ) ) );
+            aboutMap.put( app_localDbFreeSpace, StringUtil.formatDiskSize( FileSystemUtility.diskSpaceRemaining( pwmApplication.getLocalDB().getFileLocation() ) ) );
         }
 
 
-        { // java info
+        {
+            // java info
             final Runtime runtime = Runtime.getRuntime();
-            aboutMap.put(java_memoryFree,          Long.toString(runtime.freeMemory()));
-            aboutMap.put(java_memoryAllocated,     Long.toString(runtime.totalMemory()));
-            aboutMap.put(java_memoryMax,           Long.toString(runtime.maxMemory()));
-            aboutMap.put(java_threadCount,         Integer.toString(Thread.activeCount()));
+            aboutMap.put( java_memoryFree, Long.toString( runtime.freeMemory() ) );
+            aboutMap.put( java_memoryAllocated, Long.toString( runtime.totalMemory() ) );
+            aboutMap.put( java_memoryMax, Long.toString( runtime.maxMemory() ) );
+            aboutMap.put( java_threadCount, Integer.toString( Thread.activeCount() ) );
 
-            aboutMap.put(java_vmVendor,            System.getProperty("java.vm.vendor"));
+            aboutMap.put( java_vmVendor, System.getProperty( "java.vm.vendor" ) );
 
-            aboutMap.put(java_runtimeVersion,      System.getProperty("java.runtime.version"));
-            aboutMap.put(java_vmVersion,           System.getProperty("java.vm.version"));
-            aboutMap.put(java_vmName,              System.getProperty("java.vm.name"));
-            aboutMap.put(java_vmLocation,          System.getProperty("java.home"));
+            aboutMap.put( java_runtimeVersion, System.getProperty( "java.runtime.version" ) );
+            aboutMap.put( java_vmVersion, System.getProperty( "java.vm.version" ) );
+            aboutMap.put( java_vmName, System.getProperty( "java.vm.name" ) );
+            aboutMap.put( java_vmLocation, System.getProperty( "java.home" ) );
 
-            aboutMap.put(java_osName,              System.getProperty("os.name"));
-            aboutMap.put(java_osVersion,           System.getProperty("os.version"));
-            aboutMap.put(java_osArch,              System.getProperty("os.arch"));
+            aboutMap.put( java_osName, System.getProperty( "os.name" ) );
+            aboutMap.put( java_osVersion, System.getProperty( "os.version" ) );
+            aboutMap.put( java_osArch, System.getProperty( "os.arch" ) );
 
-            aboutMap.put(java_randomAlgorithm,     PwmRandom.getInstance().getAlgorithm());
-            aboutMap.put(java_defaultCharset,      Charset.defaultCharset().name());
+            aboutMap.put( java_randomAlgorithm, PwmRandom.getInstance().getAlgorithm() );
+            aboutMap.put( java_defaultCharset, Charset.defaultCharset().name() );
         }
 
-        { // build info
-            aboutMap.put(build_Time,               PwmConstants.BUILD_TIME);
-            aboutMap.put(build_Number,             PwmConstants.BUILD_NUMBER);
-            aboutMap.put(build_Type,               PwmConstants.BUILD_TYPE);
-            aboutMap.put(build_User,               PwmConstants.BUILD_USER);
-            aboutMap.put(build_Revision,           PwmConstants.BUILD_REVISION);
-            aboutMap.put(build_JavaVendor,         PwmConstants.BUILD_JAVA_VENDOR);
-            aboutMap.put(build_JavaVersion,        PwmConstants.BUILD_JAVA_VERSION);
-            aboutMap.put(build_Version,            PwmConstants.BUILD_VERSION);
+        {
+            // build info
+            aboutMap.put( build_Time, PwmConstants.BUILD_TIME );
+            aboutMap.put( build_Number, PwmConstants.BUILD_NUMBER );
+            aboutMap.put( build_Type, PwmConstants.BUILD_TYPE );
+            aboutMap.put( build_User, PwmConstants.BUILD_USER );
+            aboutMap.put( build_Revision, PwmConstants.BUILD_REVISION );
+            aboutMap.put( build_JavaVendor, PwmConstants.BUILD_JAVA_VENDOR );
+            aboutMap.put( build_JavaVersion, PwmConstants.BUILD_JAVA_VERSION );
+            aboutMap.put( build_Version, PwmConstants.BUILD_VERSION );
         }
 
-        { // database info
-            try {
+        {
+            // database info
+            try
+            {
                 final DatabaseService databaseService = pwmApplication.getDatabaseService();
-                if (databaseService != null) {
-                    final Map<PwmAboutProperty,String> debugData = databaseService.getConnectionDebugProperties();
-                    aboutMap.putAll(debugData);
+                if ( databaseService != null )
+                {
+                    final Map<PwmAboutProperty, String> debugData = databaseService.getConnectionDebugProperties();
+                    aboutMap.putAll( debugData );
                 }
-            } catch (Throwable t) {
-                LOGGER.error("error reading database debug properties");
+            }
+            catch ( Throwable t )
+            {
+                LOGGER.error( "error reading database debug properties" );
             }
         }
 
-        if (pwmApplication.getPwmEnvironment().getContextManager() != null
-                && pwmApplication.getPwmEnvironment().getContextManager().getServerInfo() != null) {
-            aboutMap.put(java_appServerInfo, pwmApplication.getPwmEnvironment().getContextManager().getServerInfo());
+        if ( pwmApplication.getPwmEnvironment().getContextManager() != null
+                && pwmApplication.getPwmEnvironment().getContextManager().getServerInfo() != null )
+        {
+            aboutMap.put( java_appServerInfo, pwmApplication.getPwmEnvironment().getContextManager().getServerInfo() );
         }
 
-        return Collections.unmodifiableMap(aboutMap);
+        return Collections.unmodifiableMap( aboutMap );
     }
 
-    private static String dateFormatForInfoBean(final Date date) {
-        return dateFormatForInfoBean(date == null ? null : date.toInstant());
+    private static String dateFormatForInfoBean( final Date date )
+    {
+        return dateFormatForInfoBean( date == null ? null : date.toInstant() );
     }
 
-    private static String dateFormatForInfoBean(final Instant date) {
-        if (date != null) {
+    private static String dateFormatForInfoBean( final Instant date )
+    {
+        if ( date != null )
+        {
             return date.toString();
-        } else {
-            return LocaleHelper.getLocalizedMessage(PwmConstants.DEFAULT_LOCALE, Display.Value_NotApplicable, null);
+        }
+        else
+        {
+            return LocaleHelper.getLocalizedMessage( PwmConstants.DEFAULT_LOCALE, Display.Value_NotApplicable, null );
         }
 
     }
 
-    public String getLabel() {
+    public String getLabel( )
+    {
         return label == null ? this.name() : label;
     }
 }

+ 15 - 7
server/src/main/java/password/pwm/PwmApplicationMode.java

@@ -26,25 +26,33 @@ import password.pwm.http.ContextManager;
 
 import javax.servlet.http.HttpServletRequest;
 
-public enum PwmApplicationMode {
+public enum PwmApplicationMode
+{
     NEW,
     CONFIGURATION,
     RUNNING,
     READ_ONLY,
     ERROR;
 
-    public static PwmApplicationMode determineMode(final HttpServletRequest httpServletRequest) {
+    public static PwmApplicationMode determineMode( final HttpServletRequest httpServletRequest )
+    {
         final ContextManager contextManager;
-        try {
-            contextManager = ContextManager.getContextManager(httpServletRequest.getServletContext());
-        } catch (Throwable t) {
+        try
+        {
+            contextManager = ContextManager.getContextManager( httpServletRequest.getServletContext() );
+        }
+        catch ( Throwable t )
+        {
             return ERROR;
         }
 
         final PwmApplication pwmApplication;
-        try {
+        try
+        {
             pwmApplication = contextManager.getPwmApplication();
-        } catch (Throwable t) {
+        }
+        catch ( Throwable t )
+        {
             return ERROR;
         }
 

+ 81 - 61
server/src/main/java/password/pwm/PwmConstants.java

@@ -42,26 +42,28 @@ import java.util.TimeZone;
  *
  * @author Jason D. Rivard
  */
-public abstract class PwmConstants {
-
-    public static final String BUILD_TIME           = readBuildInfoBundle("build.time", Instant.now().toString());
-    public static final String BUILD_NUMBER         = readBuildInfoBundle("build.number","0");
-    public static final String BUILD_TYPE           = readBuildInfoBundle("build.type","");
-    public static final String BUILD_USER           = readBuildInfoBundle("build.user",System.getProperty("user.name"));
-    public static final String BUILD_REVISION       = readBuildInfoBundle("build.revision","0");
-    public static final String BUILD_JAVA_VENDOR    = readBuildInfoBundle("build.java.vendor");
-    public static final String BUILD_JAVA_VERSION   = readBuildInfoBundle("build.java.version");
-    public static final String BUILD_VERSION        = readBuildInfoBundle("build.version","");
-
-    private static final String MISSING_VERSION_STRING = readPwmConstantsBundle("missingVersionString");
+public abstract class PwmConstants
+{
+
+    public static final String BUILD_TIME = readBuildInfoBundle( "build.time", Instant.now().toString() );
+    public static final String BUILD_NUMBER = readBuildInfoBundle( "build.number", "0" );
+    public static final String BUILD_TYPE = readBuildInfoBundle( "build.type", "" );
+    public static final String BUILD_USER = readBuildInfoBundle( "build.user", System.getProperty( "user.name" ) );
+    public static final String BUILD_REVISION = readBuildInfoBundle( "build.revision", "0" );
+    public static final String BUILD_JAVA_VENDOR = readBuildInfoBundle( "build.java.vendor" );
+    public static final String BUILD_JAVA_VERSION = readBuildInfoBundle( "build.java.version" );
+    public static final String BUILD_VERSION = readBuildInfoBundle( "build.version", "" );
+
+    private static final String MISSING_VERSION_STRING = readPwmConstantsBundle( "missingVersionString" );
     public static final String SERVLET_VERSION;
 
-    static {
+    static
+    {
         final String servletVersion =
-                (BUILD_VERSION.length() > 0 ? "v" + BUILD_VERSION : "") +
-                        (BUILD_NUMBER.length() > 0 ? " b" + BUILD_NUMBER : "") +
-                        (BUILD_REVISION.length() > 0 ? " r" + BUILD_REVISION : "") +
-                        (BUILD_TYPE.length() > 0 ? " (" + BUILD_TYPE + ")" : "").trim();
+                ( BUILD_VERSION.length() > 0 ? "v" + BUILD_VERSION : "" )
+                        + ( BUILD_NUMBER.length() > 0 ? " b" + BUILD_NUMBER : "" )
+                        + ( BUILD_REVISION.length() > 0 ? " r" + BUILD_REVISION : "" )
+                        + ( BUILD_TYPE.length() > 0 ? " (" + BUILD_TYPE + ")" : "" ).trim();
 
         SERVLET_VERSION = servletVersion.isEmpty()
                 ? MISSING_VERSION_STRING
@@ -70,28 +72,28 @@ public abstract class PwmConstants {
 
     public static final String CHAI_API_VERSION = com.novell.ldapchai.ChaiConstant.CHAI_API_VERSION;
 
-    public static final String DEFAULT_CONFIG_FILE_FILENAME = readPwmConstantsBundle("defaultConfigFilename");
+    public static final String DEFAULT_CONFIG_FILE_FILENAME = readPwmConstantsBundle( "defaultConfigFilename" );
 
-    public static final String PWM_APP_NAME = readPwmConstantsBundle("pwm.appName");
-    public static final String PWM_URL_HOME = readPwmConstantsBundle("url.pwm-home");
-    public static final String PWM_URL_CLOUD = readPwmConstantsBundle("url.pwm-cloud");
+    public static final String PWM_APP_NAME = readPwmConstantsBundle( "pwm.appName" );
+    public static final String PWM_URL_HOME = readPwmConstantsBundle( "url.pwm-home" );
+    public static final String PWM_URL_CLOUD = readPwmConstantsBundle( "url.pwm-cloud" );
 
     public static final String PWM_APP_NAME_VERSION = PWM_APP_NAME + " " + SERVLET_VERSION;
 
     public static final String CONFIGMANAGER_INTRUDER_USERNAME = "ConfigurationManagerLogin";
 
-    public static final Locale DEFAULT_LOCALE = new Locale(readPwmConstantsBundle("locale.defaultLocale"));
-    public static final Charset DEFAULT_CHARSET = Charset.forName("UTF8");
+    public static final Locale DEFAULT_LOCALE = new Locale( readPwmConstantsBundle( "locale.defaultLocale" ) );
+    public static final Charset DEFAULT_CHARSET = Charset.forName( "UTF8" );
 
     public static final CSVFormat DEFAULT_CSV_FORMAT = CSVFormat.DEFAULT;
 
-    public static final String DEFAULT_DATETIME_FORMAT_STR = readPwmConstantsBundle("locale.defaultDateTimeFormat");
-    public static final TimeZone DEFAULT_TIMEZONE = TimeZone.getTimeZone(readPwmConstantsBundle("locale.defaultTimeZone"));
+    public static final String DEFAULT_DATETIME_FORMAT_STR = readPwmConstantsBundle( "locale.defaultDateTimeFormat" );
+    public static final TimeZone DEFAULT_TIMEZONE = TimeZone.getTimeZone( readPwmConstantsBundle( "locale.defaultTimeZone" ) );
 
-    public static final String APPLICATION_PATH_INFO_FILE = readPwmConstantsBundle("applicationPathInfoFile");
+    public static final String APPLICATION_PATH_INFO_FILE = readPwmConstantsBundle( "applicationPathInfoFile" );
 
-    public static final boolean ENABLE_EULA_DISPLAY = Boolean.parseBoolean(readPwmConstantsBundle("enableEulaDisplay"));
-    public static final boolean TRIAL_MODE = Boolean.parseBoolean(readPwmConstantsBundle("trial"));
+    public static final boolean ENABLE_EULA_DISPLAY = Boolean.parseBoolean( readPwmConstantsBundle( "enableEulaDisplay" ) );
+    public static final boolean TRIAL_MODE = Boolean.parseBoolean( readPwmConstantsBundle( "trial" ) );
     public static final int TRIAL_MAX_AUTHENTICATIONS = 100;
     public static final int TRIAL_MAX_TOTAL_AUTH = 10000;
 
@@ -101,9 +103,9 @@ public abstract class PwmConstants {
 
     public static final String TOKEN_KEY_PWD_CHG_DATE = "_lastPwdChange";
 
-    public static final String HTTP_BASIC_AUTH_PREFIX = readPwmConstantsBundle("httpHeaderAuthorizationBasic");
+    public static final String HTTP_BASIC_AUTH_PREFIX = readPwmConstantsBundle( "httpHeaderAuthorizationBasic" );
 
-    public static final String DEFAULT_BAD_PASSWORD_ATTEMPT = readPwmConstantsBundle("defaultBadPasswordAttempt");
+    public static final String DEFAULT_BAD_PASSWORD_ATTEMPT = readPwmConstantsBundle( "defaultBadPasswordAttempt" );
 
     public static final String CONTEXT_ATTR_CONTEXT_MANAGER = "ContextManager";
 
@@ -115,18 +117,20 @@ public abstract class PwmConstants {
     public static final PwmHashAlgorithm SETTING_CHECKSUM_HASH_METHOD = PwmHashAlgorithm.SHA256;
 
 
-    public static final String LOG_REMOVED_VALUE_REPLACEMENT = readPwmConstantsBundle("log.removedValue");
+    public static final String LOG_REMOVED_VALUE_REPLACEMENT = readPwmConstantsBundle( "log.removedValue" );
 
     public static final Collection<Locale> INCLUDED_LOCALES;
 
-    static {
+    static
+    {
         final List<Locale> localeList = new ArrayList<>();
-        final String inputString = readPwmConstantsBundle("includedLocales");
-        final List<String> inputList = JsonUtil.deserializeStringList(inputString);
-        for (final String localeKey : inputList) {
-            localeList.add(new Locale(localeKey));
+        final String inputString = readPwmConstantsBundle( "includedLocales" );
+        final List<String> inputList = JsonUtil.deserializeStringList( inputString );
+        for ( final String localeKey : inputList )
+        {
+            localeList.add( new Locale( localeKey ) );
         }
-        INCLUDED_LOCALES = Collections.unmodifiableCollection(localeList);
+        INCLUDED_LOCALES = Collections.unmodifiableCollection( localeList );
     }
 
     public static final String URL_JSP_CONFIG_GUIDE = "WEB-INF/jsp/configguide-%1%.jsp";
@@ -144,7 +148,7 @@ public abstract class PwmConstants {
     public static final String PARAM_SESSION_STATE_INFO = "ssi";
 
     public static final String PARAM_OTP_TOKEN = "otpToken";
-    public static final String PARAM_TOKEN = readPwmConstantsBundle("paramName.token");
+    public static final String PARAM_TOKEN = readPwmConstantsBundle( "paramName.token" );
     public static final String PARAM_USERNAME = "username";
     public static final String PARAM_PASSWORD = "password";
     public static final String PARAM_CONTEXT = "context";
@@ -164,7 +168,7 @@ public abstract class PwmConstants {
     public static final String RESOURCE_FILE_WELCOME_TXT = "welcome.txt";
 
     // don't worry.  look over there.
-    public static final List<String> X_AMB_HEADER = Collections.unmodifiableList(Arrays.asList(
+    public static final List<String> X_AMB_HEADER = Collections.unmodifiableList( Arrays.asList(
             "bonjour!",
             "something witty!",
             "just like X-Fry, only ambier",
@@ -186,11 +190,14 @@ public abstract class PwmConstants {
             "are passwords really necessary?  can't we all just get along?",
             "That's amazing! I've got the same combination on my luggage!",
             "just because it looks plaintext doesn't mean there isn't a steganographic 1024bit AES key",
-            "whatever happened to speech wreck a nation technology?",     // thx wk
+
+            // thx wk
+            "whatever happened to speech wreck a nation technology?",
+            "The Mummy's password is in crypted",
+            "The zombie's password is expired",
+            "Chuck Yeager's password is in plane text",
+
             "Password schmassword, I can't even remember my user name...",
-            "The Mummy's password is in crypted",   // thx wk
-            "The zombie's password is expired", // wk
-            "Chuck Yeager's password is in plane text", // thx wk
             "Fruit flies have one time use passwords",
             "As Gregor Samsa awoke one morning from uneasy dreams he found himself transformed in his bed into a gigantic password.",
             "NOTICE: This header is protected by the Digital Millennium Copyright Act of 1996.  Reading this header is strictly forbidden.",
@@ -202,45 +209,58 @@ public abstract class PwmConstants {
             "Your password must be scanned by the TSA to ensure the safety of your fellow travelers.  Please take off your password's shoes to continue.",
             "That password really tied the room together dude.",
             "Bite my shiny metal password!",
-            "I needed a password eight characters long so I picked Snow White and the Seven Dwarves.", //nick helm
+
+            //nick helm
+            "I needed a password eight characters long so I picked Snow White and the Seven Dwarves.",
             "Roses are #FF0000 , Violets are #0000FF, All your password are belongs to us.",
             "I changed my password to \"incorrect\", so whenever i forget, it will tell me \"your password is incorrect\".",
-            "passwords are like underwear, changing underwear regularly is a good thing.", //menno
+
+            //menno
+            "passwords are like underwear, changing underwear regularly is a good thing.",
             "daisy, daisy, give me your password do...",
-            "it's a wholesome can of software goodness", // thx krowten
+
+            // thx krowten
+            "it's a wholesome can of software goodness",
+
             "this password is an memorial of the richard d. kiel memorial abend"
-    ));
+    ) );
 
 
-    private static String readPwmConstantsBundle(final String key) {
-        return  ResourceBundle.getBundle(PwmConstants.class.getName()).getString(key);
+    private static String readPwmConstantsBundle( final String key )
+    {
+        return ResourceBundle.getBundle( PwmConstants.class.getName() ).getString( key );
     }
 
-    private static String readBuildInfoBundle(final String key) {
-        return readBuildInfoBundle(key, null);
+    private static String readBuildInfoBundle( final String key )
+    {
+        return readBuildInfoBundle( key, null );
     }
 
-    private static String readBuildInfoBundle(final String key, final String defaultValue) {
-        final ResourceBundle resourceBundle = ResourceBundle.getBundle("password.pwm.BuildInformation");
-        if (resourceBundle.containsKey(key)) {
-            return resourceBundle.getString(key);
+    private static String readBuildInfoBundle( final String key, final String defaultValue )
+    {
+        final ResourceBundle resourceBundle = ResourceBundle.getBundle( "password.pwm.BuildInformation" );
+        if ( resourceBundle.containsKey( key ) )
+        {
+            return resourceBundle.getString( key );
         }
 
         return defaultValue;
     }
 
-    public enum AcceptValue {
-        json("application/json"),
-        html("text/html"),
-        ;
+    public enum AcceptValue
+    {
+        json( "application/json" ),
+        html( "text/html" ),;
 
         private String headerValue;
 
-        AcceptValue(final String headerValue) {
+        AcceptValue( final String headerValue )
+        {
             this.headerValue = headerValue;
         }
 
-        public String getHeaderValue() {
+        public String getHeaderValue( )
+        {
             return headerValue;
         }
     }

+ 316 - 204
server/src/main/java/password/pwm/PwmEnvironment.java

@@ -51,8 +51,9 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
-public class PwmEnvironment {
-    private static final PwmLogger LOGGER = PwmLogger.forClass(PwmEnvironment.class);
+public class PwmEnvironment
+{
+    private static final PwmLogger LOGGER = PwmLogger.forClass( PwmEnvironment.class );
 
     // data elements
     private final PwmApplicationMode applicationMode;
@@ -62,11 +63,12 @@ public class PwmEnvironment {
     private final File configurationFile;
     private final ContextManager contextManager;
     private final Collection<ApplicationFlag> flags;
-    private final Map<ApplicationParameter,String> parameters;
+    private final Map<ApplicationParameter, String> parameters;
 
     private final FileLocker fileLocker;
 
-    public enum ApplicationParameter {
+    public enum ApplicationParameter
+    {
         AutoExportHttpsKeyStoreFile,
         AutoExportHttpsKeyStorePassword,
         AutoExportHttpsKeyStoreAlias,
@@ -74,70 +76,72 @@ public class PwmEnvironment {
         AutoWriteTomcatConfOutputFile,
         AppliancePort,
         ApplianceHostnameFile,
-        ApplianceTokenFile,
-
-        ;
+        ApplianceTokenFile,;
 
-        public static ApplicationParameter forString(final String input) {
-            return JavaHelper.readEnumFromString(ApplicationParameter.class, null, input);
+        public static ApplicationParameter forString( final String input )
+        {
+            return JavaHelper.readEnumFromString( ApplicationParameter.class, null, input );
         }
     }
 
-    public enum ApplicationFlag {
+    public enum ApplicationFlag
+    {
         Appliance,
         Docker,
         ManageHttps,
         NoFileLock,
-        CommandLineInstance,
-
-        ;
+        CommandLineInstance,;
 
-        public static ApplicationFlag forString(final String input) {
-            return JavaHelper.readEnumFromString(ApplicationFlag.class, null, input);
+        public static ApplicationFlag forString( final String input )
+        {
+            return JavaHelper.readEnumFromString( ApplicationFlag.class, null, input );
         }
     }
 
-    public enum EnvironmentParameter {
+    public enum EnvironmentParameter
+    {
         applicationPath,
         applicationFlags,
-        applicationParamFile,
-
-        ;
+        applicationParamFile,;
 
-        public String conicalJavaOptionSystemName() {
+        public String conicalJavaOptionSystemName( )
+        {
             return PwmConstants.PWM_APP_NAME.toLowerCase() + "." + this.toString();
         }
 
-        public String conicalEnvironmentSystemName() {
-            return (PwmConstants.PWM_APP_NAME.toLowerCase() + "_" + this.toString()).toUpperCase();
+        public String conicalEnvironmentSystemName( )
+        {
+            return ( PwmConstants.PWM_APP_NAME.toLowerCase() + "_" + this.toString() ).toUpperCase();
         }
 
-        public List<String> possibleNames(final String contextName) {
+        public List<String> possibleNames( final String contextName )
+        {
             final List<String> returnValues = new ArrayList<>();
-            if (contextName != null) {
+            if ( contextName != null )
+            {
                 // java property format <app>.<context>.<paramName> like pwm.pwm.applicationFlag
                 final String value = PwmConstants.PWM_APP_NAME.toLowerCase()
                         + "."
                         + contextName
                         + "."
                         + this.toString();
-                returnValues.add(value);
-                returnValues.add(value.toUpperCase());
-                returnValues.add(value.replace(".", "_"));
-                returnValues.add(value.toUpperCase().replace(".", "_"));
+                returnValues.add( value );
+                returnValues.add( value.toUpperCase() );
+                returnValues.add( value.replace( ".", "_" ) );
+                returnValues.add( value.toUpperCase().replace( ".", "_" ) );
             }
             {
                 // java property format <app>.<paramName> like pwm.applicationFlag
                 final String value = PwmConstants.PWM_APP_NAME.toLowerCase()
                         + "."
                         + this.toString();
-                returnValues.add(value);
-                returnValues.add(value.toUpperCase());
-                returnValues.add(value.replace(".","_"));
-                returnValues.add(value.toUpperCase().replace(".", "_"));
+                returnValues.add( value );
+                returnValues.add( value.toUpperCase() );
+                returnValues.add( value.replace( ".", "_" ) );
+                returnValues.add( value.toUpperCase().replace( ".", "_" ) );
             }
 
-            return Collections.unmodifiableList(returnValues);
+            return Collections.unmodifiableList( returnValues );
         }
     }
 
@@ -149,74 +153,87 @@ public class PwmEnvironment {
             final File configurationFile,
             final ContextManager contextManager,
             final Collection<ApplicationFlag> flags,
-            final Map<ApplicationParameter,String> parameters
-    ) {
+            final Map<ApplicationParameter, String> parameters
+    )
+    {
         this.applicationMode = applicationMode == null ? PwmApplicationMode.ERROR : applicationMode;
         this.config = config;
         this.applicationPath = applicationPath;
         this.internalRuntimeInstance = internalRuntimeInstance;
         this.configurationFile = configurationFile;
         this.contextManager = contextManager;
-        this.flags = flags == null ? Collections.emptySet() : Collections.unmodifiableSet(new HashSet<>(flags));
-        this.parameters = parameters == null ? Collections.emptyMap() : Collections.unmodifiableMap(parameters);
+        this.flags = flags == null ? Collections.emptySet() : Collections.unmodifiableSet( new HashSet<>( flags ) );
+        this.parameters = parameters == null ? Collections.emptyMap() : Collections.unmodifiableMap( parameters );
 
         this.fileLocker = new FileLocker();
 
         verify();
     }
 
-    public PwmApplicationMode getApplicationMode() {
+    public PwmApplicationMode getApplicationMode( )
+    {
         return applicationMode;
     }
 
-    public Configuration getConfig() {
+    public Configuration getConfig( )
+    {
         return config;
     }
 
-    public File getApplicationPath() {
+    public File getApplicationPath( )
+    {
         return applicationPath;
     }
 
-    public boolean isInternalRuntimeInstance() {
+    public boolean isInternalRuntimeInstance( )
+    {
         return internalRuntimeInstance;
     }
 
-    public File getConfigurationFile() {
+    public File getConfigurationFile( )
+    {
         return configurationFile;
     }
 
-    public ContextManager getContextManager() {
+    public ContextManager getContextManager( )
+    {
         return contextManager;
     }
 
-    public Collection<ApplicationFlag> getFlags() {
+    public Collection<ApplicationFlag> getFlags( )
+    {
         return flags;
     }
 
-    public Map<ApplicationParameter, String> getParameters() {
+    public Map<ApplicationParameter, String> getParameters( )
+    {
         return parameters;
     }
 
-    private void verify() {
+    private void verify( )
+    {
 
     }
 
-    public void verifyIfApplicationPathIsSetProperly()
+    public void verifyIfApplicationPathIsSetProperly( )
             throws PwmUnrecoverableException
     {
         final File applicationPath = this.getApplicationPath();
 
-        verifyApplicationPath(applicationPath);
+        verifyApplicationPath( applicationPath );
 
         boolean applicationPathIsWebInfPath = false;
-        if (applicationPath.getAbsolutePath().endsWith("/WEB-INF")) {
-            final File webXmlFile = new File(applicationPath.getAbsolutePath() + File.separator + "web.xml");
-            if (webXmlFile.exists()) {
+        if ( applicationPath.getAbsolutePath().endsWith( "/WEB-INF" ) )
+        {
+            final File webXmlFile = new File( applicationPath.getAbsolutePath() + File.separator + "web.xml" );
+            if ( webXmlFile.exists() )
+            {
                 applicationPathIsWebInfPath = true;
             }
         }
-        if (applicationPathIsWebInfPath) {
-            LOGGER.trace("applicationPath appears to be servlet /WEB-INF directory");
+        if ( applicationPathIsWebInfPath )
+        {
+            LOGGER.trace( "applicationPath appears to be servlet /WEB-INF directory" );
         }
     }
 
@@ -225,76 +242,105 @@ public class PwmEnvironment {
     )
             throws PwmUnrecoverableException
     {
-        return new Builder(this)
-                .setApplicationMode(PwmApplicationMode.NEW)
-                .setInternalRuntimeInstance(true)
-                .setConfigurationFile(null)
-                .setConfig(configuration)
+        return new Builder( this )
+                .setApplicationMode( PwmApplicationMode.NEW )
+                .setInternalRuntimeInstance( true )
+                .setConfigurationFile( null )
+                .setConfig( configuration )
                 .createPwmEnvironment();
     }
 
 
-    public static void verifyApplicationPath(final File applicationPath) throws PwmUnrecoverableException {
+    public static void verifyApplicationPath( final File applicationPath ) throws PwmUnrecoverableException
+    {
 
-        if (applicationPath == null) {
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_STARTUP_ERROR, "unable to determine valid applicationPath"));
+        if ( applicationPath == null )
+        {
+            throw new PwmUnrecoverableException(
+                    new ErrorInformation( PwmError.ERROR_STARTUP_ERROR,
+                            "unable to determine valid applicationPath" )
+            );
         }
 
-        LOGGER.trace("examining applicationPath of " + applicationPath.getAbsolutePath() + "");
+        LOGGER.trace( "examining applicationPath of " + applicationPath.getAbsolutePath() + "" );
 
-        if (!applicationPath.exists()) {
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_STARTUP_ERROR, "applicationPath " + applicationPath.getAbsolutePath() + " does not exist"));
+        if ( !applicationPath.exists() )
+        {
+            throw new PwmUnrecoverableException(
+                    new ErrorInformation( PwmError.ERROR_STARTUP_ERROR,
+                            "applicationPath " + applicationPath.getAbsolutePath() + " does not exist" )
+            );
         }
 
-        if (!applicationPath.canRead()) {
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_STARTUP_ERROR, "unable to read from applicationPath " + applicationPath.getAbsolutePath() + ""));
+        if ( !applicationPath.canRead() )
+        {
+            throw new PwmUnrecoverableException(
+                    new ErrorInformation( PwmError.ERROR_STARTUP_ERROR,
+                            "unable to read from applicationPath " + applicationPath.getAbsolutePath() + "" )
+            );
         }
 
-        if (!applicationPath.canWrite()) {
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_STARTUP_ERROR, "unable to write to applicationPath " + applicationPath.getAbsolutePath() + ""));
+        if ( !applicationPath.canWrite() )
+        {
+            throw new PwmUnrecoverableException(
+                    new ErrorInformation( PwmError.ERROR_STARTUP_ERROR,
+                            "unable to write to applicationPath " + applicationPath.getAbsolutePath() + "" )
+            );
         }
 
-        final File infoFile = new File(applicationPath.getAbsolutePath() + File.separator + PwmConstants.APPLICATION_PATH_INFO_FILE);
-        LOGGER.trace("checking " + infoFile.getAbsolutePath() + " status");
-        if (infoFile.exists()) {
+        final File infoFile = new File( applicationPath.getAbsolutePath() + File.separator + PwmConstants.APPLICATION_PATH_INFO_FILE );
+        LOGGER.trace( "checking " + infoFile.getAbsolutePath() + " status" );
+        if ( infoFile.exists() )
+        {
             final String errorMsg = "The file " + infoFile.getAbsolutePath() + " exists, and an applicationPath was not explicitly specified."
                     + "  This happens when an applicationPath was previously configured, but is not now being specified."
-                    + "  An explicit applicationPath parameter must be specified, or the file can be removed if the applicationPath should be changed to the default /WEB-INF directory.";
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_STARTUP_ERROR, errorMsg));
+                    + "  An explicit applicationPath parameter must be specified, or the file can be removed if the applicationPath"
+                    + " should be changed to the default /WEB-INF directory.";
+            throw new PwmUnrecoverableException( new ErrorInformation( PwmError.ERROR_STARTUP_ERROR, errorMsg ) );
         }
 
     }
 
-    public static class ParseHelper {
-        public static Collection<ApplicationFlag> readApplicationFlagsFromSystem(final String contextName) {
-            final String rawValue = readValueFromSystem(EnvironmentParameter.applicationFlags, contextName);
-            if (rawValue != null) {
-                return parseApplicationFlagValueParameter(rawValue);
+    public static class ParseHelper
+    {
+        public static Collection<ApplicationFlag> readApplicationFlagsFromSystem( final String contextName )
+        {
+            final String rawValue = readValueFromSystem( EnvironmentParameter.applicationFlags, contextName );
+            if ( rawValue != null )
+            {
+                return parseApplicationFlagValueParameter( rawValue );
             }
             return Collections.emptyList();
         }
 
-        public static Map<ApplicationParameter,String> readApplicationParmsFromSystem(final String contextName) {
-            final String rawValue = readValueFromSystem(EnvironmentParameter.applicationParamFile, contextName);
-            if (rawValue != null) {
-                return parseApplicationParamValueParameter(rawValue);
+        public static Map<ApplicationParameter, String> readApplicationParmsFromSystem( final String contextName )
+        {
+            final String rawValue = readValueFromSystem( EnvironmentParameter.applicationParamFile, contextName );
+            if ( rawValue != null )
+            {
+                return parseApplicationParamValueParameter( rawValue );
             }
             return Collections.emptyMap();
         }
 
-        public static String readValueFromSystem(final PwmEnvironment.EnvironmentParameter parameter, final String contextName) {
-            final List<String> namePossibilities = parameter.possibleNames(contextName);
+        public static String readValueFromSystem( final PwmEnvironment.EnvironmentParameter parameter, final String contextName )
+        {
+            final List<String> namePossibilities = parameter.possibleNames( contextName );
 
-            for (final String propertyName : namePossibilities){
-                final String propValue = System.getProperty(propertyName);
-                if (propValue != null && !propValue.isEmpty()) {
+            for ( final String propertyName : namePossibilities )
+            {
+                final String propValue = System.getProperty( propertyName );
+                if ( propValue != null && !propValue.isEmpty() )
+                {
                     return propValue;
                 }
             }
 
-            for (final String propertyName : namePossibilities){
-                final String propValue = System.getenv(propertyName);
-                if (propValue != null && !propValue.isEmpty()) {
+            for ( final String propertyName : namePossibilities )
+            {
+                final String propValue = System.getenv( propertyName );
+                if ( propValue != null && !propValue.isEmpty() )
+                {
                     return propValue;
                 }
             }
@@ -302,67 +348,91 @@ public class PwmEnvironment {
             return null;
         }
 
-        public static Collection<ApplicationFlag> parseApplicationFlagValueParameter(final String input) {
-            if (input == null) {
+        public static Collection<ApplicationFlag> parseApplicationFlagValueParameter( final String input )
+        {
+            if ( input == null )
+            {
                 return Collections.emptyList();
             }
 
-            try {
-                final List<String> jsonValues = JsonUtil.deserializeStringList(input);
+            try
+            {
+                final List<String> jsonValues = JsonUtil.deserializeStringList( input );
                 final List<ApplicationFlag> returnFlags = new ArrayList<>();
-                for (final String value : jsonValues) {
-                    final ApplicationFlag flag = ApplicationFlag.forString(value);
-                    if (value != null) {
-                        returnFlags.add(flag);
-                    } else {
-                        LOGGER.warn("unknown " + EnvironmentParameter.applicationFlags.toString() + " value: " + input);
+                for ( final String value : jsonValues )
+                {
+                    final ApplicationFlag flag = ApplicationFlag.forString( value );
+                    if ( value != null )
+                    {
+                        returnFlags.add( flag );
+                    }
+                    else
+                    {
+                        LOGGER.warn( "unknown " + EnvironmentParameter.applicationFlags.toString() + " value: " + input );
                     }
                 }
-                return Collections.unmodifiableList(returnFlags);
-            } catch (Exception e) {
+                return Collections.unmodifiableList( returnFlags );
+            }
+            catch ( Exception e )
+            {
                 //
             }
 
             final List<ApplicationFlag> returnFlags = new ArrayList<>();
-            for (final String value : input.split(",")) {
-                final ApplicationFlag flag = ApplicationFlag.forString(value);
-                if (value != null) {
-                    returnFlags.add(flag);
-                } else {
-                    LOGGER.warn("unknown " + EnvironmentParameter.applicationFlags.toString() + " value: " + input);
+            for ( final String value : input.split( "," ) )
+            {
+                final ApplicationFlag flag = ApplicationFlag.forString( value );
+                if ( value != null )
+                {
+                    returnFlags.add( flag );
+                }
+                else
+                {
+                    LOGGER.warn( "unknown " + EnvironmentParameter.applicationFlags.toString() + " value: " + input );
                 }
             }
             return returnFlags;
         }
 
-        public static Map<ApplicationParameter,String> parseApplicationParamValueParameter(final String input) {
-            if (input == null) {
+        public static Map<ApplicationParameter, String> parseApplicationParamValueParameter( final String input )
+        {
+            if ( input == null )
+            {
                 return Collections.emptyMap();
             }
 
             final Properties propValues = new Properties();
-            try (FileInputStream fileInputStream = new FileInputStream(new File(input))) {
-                propValues.load(fileInputStream);
-            } catch (Exception e) {
-                LOGGER.warn("error reading properties file '" + input + "' specified by environment setting " + EnvironmentParameter.applicationParamFile.toString() + ", error: " + e.getMessage());
+            try ( FileInputStream fileInputStream = new FileInputStream( new File( input ) ) )
+            {
+                propValues.load( fileInputStream );
+            }
+            catch ( Exception e )
+            {
+                LOGGER.warn( "error reading properties file '" + input + "' specified by environment setting "
+                        + EnvironmentParameter.applicationParamFile.toString() + ", error: " + e.getMessage() );
             }
 
-            if (propValues != null) {
-                try {
-                    final Map<ApplicationParameter, String> returnParams = new HashMap<>();
-                    for (final Object key : propValues.keySet()) {
-
-                        final ApplicationParameter param = ApplicationParameter.forString(key.toString());
-                        if (param != null) {
-                            returnParams.put(param, propValues.getProperty(key.toString()));
-                        } else {
-                            LOGGER.warn("unknown " + EnvironmentParameter.applicationParamFile.toString() + " value: " + input);
-                        }
+            try
+            {
+                final Map<ApplicationParameter, String> returnParams = new HashMap<>();
+                for ( final Object key : propValues.keySet() )
+                {
+
+                    final ApplicationParameter param = ApplicationParameter.forString( key.toString() );
+                    if ( param != null )
+                    {
+                        returnParams.put( param, propValues.getProperty( key.toString() ) );
+                    }
+                    else
+                    {
+                        LOGGER.warn( "unknown " + EnvironmentParameter.applicationParamFile.toString() + " value: " + input );
                     }
-                    return Collections.unmodifiableMap(returnParams);
-                } catch (Exception e) {
-                    LOGGER.warn("unable to parse jason value of " + EnvironmentParameter.applicationParamFile.toString() + ", error: " + e.getMessage());
                 }
+                return Collections.unmodifiableMap( returnParams );
+            }
+            catch ( Exception e )
+            {
+                LOGGER.warn( "unable to parse jason value of " + EnvironmentParameter.applicationParamFile.toString() + ", error: " + e.getMessage() );
             }
 
             return Collections.emptyMap();
@@ -370,8 +440,8 @@ public class PwmEnvironment {
     }
 
 
-
-    public static class Builder {
+    public static class Builder
+    {
         private PwmApplicationMode applicationMode;
         private Configuration config;
         private File applicationPath;
@@ -379,71 +449,86 @@ public class PwmEnvironment {
         private File configurationFile;
         private ContextManager contextManager;
         private Collection<ApplicationFlag> flags = new HashSet<>();
-        private Map<ApplicationParameter,String> params = new HashMap<>();
+        private Map<ApplicationParameter, String> params = new HashMap<>();
 
-        public Builder(final PwmEnvironment pwmEnvironment) {
-            this.applicationMode         = pwmEnvironment.applicationMode;
-            this.config                  = pwmEnvironment.config;
-            this.applicationPath         = pwmEnvironment.applicationPath;
+        public Builder( final PwmEnvironment pwmEnvironment )
+        {
+            this.applicationMode = pwmEnvironment.applicationMode;
+            this.config = pwmEnvironment.config;
+            this.applicationPath = pwmEnvironment.applicationPath;
             this.internalRuntimeInstance = pwmEnvironment.internalRuntimeInstance;
-            this.configurationFile       = pwmEnvironment.configurationFile;
-            this.contextManager          = pwmEnvironment.contextManager;
-            this.flags                   = pwmEnvironment.flags;
-            this.params                  = pwmEnvironment.parameters;
+            this.configurationFile = pwmEnvironment.configurationFile;
+            this.contextManager = pwmEnvironment.contextManager;
+            this.flags = pwmEnvironment.flags;
+            this.params = pwmEnvironment.parameters;
         }
 
-        public Builder(final Configuration config, final File applicationPath) {
+        public Builder( final Configuration config, final File applicationPath )
+        {
             this.config = config;
             this.applicationPath = applicationPath;
         }
 
-        public Builder setApplicationMode(final PwmApplicationMode applicationMode) {
-            if (PwmConstants.TRIAL_MODE && applicationMode == PwmApplicationMode.RUNNING) {
-                LOGGER.info("application is in trial mode");
+        public Builder setApplicationMode( final PwmApplicationMode applicationMode )
+        {
+            if ( PwmConstants.TRIAL_MODE && applicationMode == PwmApplicationMode.RUNNING )
+            {
+                LOGGER.info( "application is in trial mode" );
                 this.applicationMode = PwmApplicationMode.CONFIGURATION;
-            } else {
+            }
+            else
+            {
                 this.applicationMode = applicationMode;
             }
             return this;
         }
 
-        public Builder setInternalRuntimeInstance(final boolean internalRuntimeInstance) {
+        public Builder setInternalRuntimeInstance( final boolean internalRuntimeInstance )
+        {
             this.internalRuntimeInstance = internalRuntimeInstance;
             return this;
         }
 
-        public Builder setConfigurationFile(final File configurationFile) {
+        public Builder setConfigurationFile( final File configurationFile )
+        {
             this.configurationFile = configurationFile;
             return this;
         }
 
-        public Builder setContextManager(final ContextManager contextManager) {
+        public Builder setContextManager( final ContextManager contextManager )
+        {
             this.contextManager = contextManager;
             return this;
         }
 
-        public Builder setFlags(final Collection<ApplicationFlag> flags) {
+        public Builder setFlags( final Collection<ApplicationFlag> flags )
+        {
             this.flags.clear();
-            if (flags != null) {
-                this.flags.addAll(flags);
+            if ( flags != null )
+            {
+                this.flags.addAll( flags );
             }
             return this;
         }
 
-        public Builder setParams(final Map<ApplicationParameter,String> params) {
+        public Builder setParams( final Map<ApplicationParameter, String> params )
+        {
             this.params.clear();
-            if (params != null) {
-                this.params.putAll(params);
+            if ( params != null )
+            {
+                this.params.putAll( params );
             }
             return this;
         }
 
-        public Builder setConfig(final Configuration config) {
+        public Builder setConfig( final Configuration config )
+        {
             this.config = config;
             return this;
         }
 
-        public PwmEnvironment createPwmEnvironment() {
+        public PwmEnvironment createPwmEnvironment( )
+        {
             return new PwmEnvironment(
                     applicationMode,
                     config,
@@ -457,104 +542,131 @@ public class PwmEnvironment {
         }
     }
 
-    public void attemptFileLock() {
+    public void attemptFileLock( )
+    {
         fileLocker.attemptFileLock();
     }
 
-    public void releaseFileLock()
+    public void releaseFileLock( )
     {
         fileLocker.releaseFileLock();
     }
 
-    public boolean isFileLocked() {
+    public boolean isFileLocked( )
+    {
         return fileLocker.isLocked();
     }
 
-    public void waitForFileLock() throws PwmUnrecoverableException {
-        final int maxWaitSeconds = this.getFlags().contains(ApplicationFlag.CommandLineInstance)
+    public void waitForFileLock( ) throws PwmUnrecoverableException
+    {
+        final int maxWaitSeconds = this.getFlags().contains( ApplicationFlag.CommandLineInstance )
                 ? 1
-                : Integer.parseInt(getConfig().readAppProperty(AppProperty.APPLICATION_FILELOCK_WAIT_SECONDS));
+                : Integer.parseInt( getConfig().readAppProperty( AppProperty.APPLICATION_FILELOCK_WAIT_SECONDS ) );
         final Instant startTime = Instant.now();
-        final int attemptInterval = 5021; //ms
+        final TimeDuration attemptInterval = new TimeDuration( 5021, TimeUnit.MILLISECONDS );
 
-        while (!this.isFileLocked() && TimeDuration.fromCurrent(startTime).isShorterThan(maxWaitSeconds, TimeUnit.SECONDS)) {
+        while ( !this.isFileLocked() && TimeDuration.fromCurrent( startTime ).isShorterThan( maxWaitSeconds, TimeUnit.SECONDS ) )
+        {
             attemptFileLock();
 
-            if (!isFileLocked()) {
-                LOGGER.debug("can't establish application file lock after "
-                        + TimeDuration.fromCurrent(startTime).asCompactString()
-                        + ", will retry;");
-                JavaHelper.pause(attemptInterval);
+            if ( !isFileLocked() )
+            {
+                LOGGER.debug( "can't establish application file lock after "
+                        + TimeDuration.fromCurrent( startTime ).asCompactString()
+                        + ", will retry;" );
+                attemptInterval.pause();
             }
         }
 
-        if (!isFileLocked()) {
+        if ( !isFileLocked() )
+        {
             final String errorMsg = "unable to obtain application path file lock";
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_STARTUP_ERROR,errorMsg);
-            throw new PwmUnrecoverableException(errorInformation);
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_STARTUP_ERROR, errorMsg );
+            throw new PwmUnrecoverableException( errorInformation );
         }
     }
 
-    private class FileLocker {
+    private class FileLocker
+    {
         private FileLock lock;
         private final File lockfile;
 
-        FileLocker() {
-            final String lockfileName = config.readAppProperty(AppProperty.APPLICATION_FILELOCK_FILENAME);
-            lockfile = new File(getApplicationPath(), lockfileName);
+        FileLocker( )
+        {
+            final String lockfileName = config.readAppProperty( AppProperty.APPLICATION_FILELOCK_FILENAME );
+            lockfile = new File( getApplicationPath(), lockfileName );
         }
 
-        private boolean lockingAllowed() {
-            return !isInternalRuntimeInstance() && !getFlags().contains(ApplicationFlag.NoFileLock);
+        private boolean lockingAllowed( )
+        {
+            return !isInternalRuntimeInstance() && !getFlags().contains( ApplicationFlag.NoFileLock );
         }
 
-        public boolean isLocked() {
+        public boolean isLocked( )
+        {
             return !lockingAllowed() || lock != null && lock.isValid();
         }
 
-        public void attemptFileLock() {
-            if (lockingAllowed() && !isLocked()) {
-                try {
-                    final RandomAccessFile file = new RandomAccessFile(lockfile, "rw");
+        public void attemptFileLock( )
+        {
+            if ( lockingAllowed() && !isLocked() )
+            {
+                try
+                {
+                    final RandomAccessFile file = new RandomAccessFile( lockfile, "rw" );
                     final FileChannel f = file.getChannel();
                     lock = f.tryLock();
-                    if (lock != null) {
-                        LOGGER.debug("obtained file lock on file " + lockfile.getAbsolutePath() + " lock is valid=" + lock.isValid());
-                        writeLockFileContents(file);
-                    } else {
-                        LOGGER.debug("unable to obtain file lock on file " + lockfile.getAbsolutePath());
+                    if ( lock != null )
+                    {
+                        LOGGER.debug( "obtained file lock on file " + lockfile.getAbsolutePath() + " lock is valid=" + lock.isValid() );
+                        writeLockFileContents( file );
+                    }
+                    else
+                    {
+                        LOGGER.debug( "unable to obtain file lock on file " + lockfile.getAbsolutePath() );
                     }
-                } catch (Exception e) {
-                    LOGGER.error("unable to obtain file lock on file " + lockfile.getAbsolutePath() + " due to error: " + e.getMessage());
+                }
+                catch ( Exception e )
+                {
+                    LOGGER.error( "unable to obtain file lock on file " + lockfile.getAbsolutePath() + " due to error: " + e.getMessage() );
                 }
             }
         }
 
-        void writeLockFileContents(final RandomAccessFile file) {
-            try {
+        void writeLockFileContents( final RandomAccessFile file )
+        {
+            try
+            {
                 final Properties props = new Properties();
-                props.put("timestamp", JavaHelper.toIsoDate(new Date()));
-                props.put("applicationPath",PwmEnvironment.this.getApplicationPath() == null ? "n/a" : PwmEnvironment.this.getApplicationPath().getAbsolutePath());
-                props.put("configurationFile", PwmEnvironment.this.getConfigurationFile() == null ? "n/a" : PwmEnvironment.this.getConfigurationFile().getAbsolutePath());
+                props.put( "timestamp", JavaHelper.toIsoDate( new Date() ) );
+                props.put( "applicationPath", PwmEnvironment.this.getApplicationPath() == null ? "n/a" : PwmEnvironment.this.getApplicationPath().getAbsolutePath() );
+                props.put( "configurationFile", PwmEnvironment.this.getConfigurationFile() == null ? "n/a" : PwmEnvironment.this.getConfigurationFile().getAbsolutePath() );
                 final String comment = PwmConstants.PWM_APP_NAME + " file lock";
                 final StringWriter stringWriter = new StringWriter();
-                props.store(stringWriter, comment);
-                file.write(stringWriter.getBuffer().toString().getBytes(PwmConstants.DEFAULT_CHARSET));
-            } catch (IOException e) {
-                LOGGER.error("unable to write contents of application lock file: " + e.getMessage());
+                props.store( stringWriter, comment );
+                file.write( stringWriter.getBuffer().toString().getBytes( PwmConstants.DEFAULT_CHARSET ) );
+            }
+            catch ( IOException e )
+            {
+                LOGGER.error( "unable to write contents of application lock file: " + e.getMessage() );
             }
             // do not close FileWriter, otherwise lock is released.
         }
 
-        public void releaseFileLock() {
-            if (lock != null && lock.isValid()) {
-                try {
+        public void releaseFileLock( )
+        {
+            if ( lock != null && lock.isValid() )
+            {
+                try
+                {
                     lock.release();
-                } catch (IOException e) {
-                    LOGGER.error("error releasing file lock: " + e.getMessage());
+                }
+                catch ( IOException e )
+                {
+                    LOGGER.error( "error releasing file lock: " + e.getMessage() );
                 }
 
-                LOGGER.debug("released file lock on file " + lockfile.getAbsolutePath());
+                LOGGER.debug( "released file lock on file " + lockfile.getAbsolutePath() );
             }
         }
     }

+ 4 - 3
server/src/main/java/password/pwm/PwmHttpFilterAuthenticationProvider.java

@@ -27,9 +27,10 @@ import password.pwm.http.PwmRequest;
 
 import java.io.IOException;
 
-public interface PwmHttpFilterAuthenticationProvider {
-    void attemptAuthentication( PwmRequest pwmRequest)
+public interface PwmHttpFilterAuthenticationProvider
+{
+    void attemptAuthentication( PwmRequest pwmRequest )
             throws PwmUnrecoverableException, IOException;
 
-    boolean hasRedirectedResponse();
+    boolean hasRedirectedResponse( );
 }

+ 25 - 20
server/src/main/java/password/pwm/VerificationMethodSystem.java

@@ -23,60 +23,65 @@
 package password.pwm;
 
 import password.pwm.bean.SessionLabel;
-import password.pwm.ldap.UserInfo;
 import password.pwm.error.ErrorInformation;
 import password.pwm.error.PwmUnrecoverableException;
+import password.pwm.ldap.UserInfo;
 
 import java.io.Serializable;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
-public interface VerificationMethodSystem {
-    enum VerificationState {
+public interface VerificationMethodSystem
+{
+    enum VerificationState
+    {
         INPROGRESS,
         FAILED,
         COMPLETE,
     }
 
-    interface UserPrompt {
-        String getDisplayPrompt();
+    interface UserPrompt
+    {
+        String getDisplayPrompt( );
 
-        String getIdentifier();
+        String getIdentifier( );
     }
 
-    class UserPromptBean implements Serializable, UserPrompt {
+    class UserPromptBean implements Serializable, UserPrompt
+    {
         private String displayPrompt;
         private String identifier;
 
-        public String getDisplayPrompt() {
+        public String getDisplayPrompt( )
+        {
             return displayPrompt;
         }
 
-        public void setDisplayPrompt(final String displayPrompt) {
+        public void setDisplayPrompt( final String displayPrompt )
+        {
             this.displayPrompt = displayPrompt;
         }
 
-        public String getIdentifier() {
+        public String getIdentifier( )
+        {
             return identifier;
         }
 
-        public void setIdentifier(final String identifier) {
+        public void setIdentifier( final String identifier )
+        {
             this.identifier = identifier;
         }
     }
 
-    List<UserPrompt> getCurrentPrompts() throws PwmUnrecoverableException;
-
-    String getCurrentDisplayInstructions();
-
-    ErrorInformation respondToPrompts( Map<String, String> answers) throws PwmUnrecoverableException;
+    List<UserPrompt> getCurrentPrompts( ) throws PwmUnrecoverableException;
 
-    VerificationState getVerificationState();
+    String getCurrentDisplayInstructions( );
 
-    void init(PwmApplication pwmApplication, UserInfo userInfoBean, SessionLabel sessionLabel, Locale locale)
-            throws PwmUnrecoverableException
-            ;
+    ErrorInformation respondToPrompts( Map<String, String> answers ) throws PwmUnrecoverableException;
 
+    VerificationState getVerificationState( );
 
+    void init( PwmApplication pwmApplication, UserInfo userInfoBean, SessionLabel sessionLabel, Locale locale )
+            throws PwmUnrecoverableException;
 }

+ 5 - 5
server/src/main/java/password/pwm/bean/EmailItemBean.java

@@ -29,16 +29,16 @@ import java.io.Serializable;
 
 @Getter
 @AllArgsConstructor
-public class EmailItemBean implements Serializable {
+public class EmailItemBean implements Serializable
+{
     private final String to;
     private final String from;
     private final String subject;
     private final String bodyPlain;
     private final String bodyHtml;
 
-    public String toDebugString() {
-        final StringBuilder sb = new StringBuilder();
-        sb.append("from: ").append(from).append(", to: ").append(to).append(", subject: ").append(subject);
-        return sb.toString();
+    public String toDebugString( )
+    {
+        return "from: " + from + ", to: " + to + ", subject: " + subject;
     }
 }

+ 6 - 5
server/src/main/java/password/pwm/bean/FormNonce.java

@@ -31,17 +31,18 @@ import java.time.Instant;
 
 @Getter
 @AllArgsConstructor
-public class FormNonce implements Serializable {
+public class FormNonce implements Serializable
+{
 
-    @SerializedName("g")
+    @SerializedName( "g" )
     private final String sessionGUID;
 
-    @SerializedName("t")
+    @SerializedName( "t" )
     private final Instant timestamp;
 
-    @SerializedName("c")
+    @SerializedName( "c" )
     private final int reqCounter;
 
-    @SerializedName("p")
+    @SerializedName( "p" )
     private final String payload;
 }

+ 11 - 6
server/src/main/java/password/pwm/bean/LocalSessionStateBean.java

@@ -41,7 +41,8 @@ import java.util.Locale;
  */
 
 @Data
-public class LocalSessionStateBean implements Serializable {
+public class LocalSessionStateBean implements Serializable
+{
 
     private String srcAddress;
     private String srcHostname;
@@ -70,20 +71,24 @@ public class LocalSessionStateBean implements Serializable {
     private int sessionVerificationKeyLength;
     private boolean sessionIdRecycleNeeded;
 
-    public LocalSessionStateBean(final int sessionVerificationKeyLength) {
+    public LocalSessionStateBean( final int sessionVerificationKeyLength )
+    {
         this.sessionVerificationKeyLength = sessionVerificationKeyLength;
     }
 
-    public void incrementIntruderAttempts() {
+    public void incrementIntruderAttempts( )
+    {
         intruderAttempts++;
     }
 
-    public void clearIntruderAttempts() {
+    public void clearIntruderAttempts( )
+    {
         intruderAttempts = 0;
     }
 
-    public void regenerateSessionVerificationKey() {
-        sessionVerificationKey = PwmRandom.getInstance().alphaNumericString(sessionVerificationKeyLength) + Long.toHexString(System.currentTimeMillis());
+    public void regenerateSessionVerificationKey( )
+    {
+        sessionVerificationKey = PwmRandom.getInstance().alphaNumericString( sessionVerificationKeyLength ) + Long.toHexString( System.currentTimeMillis() );
     }
 }
 

+ 79 - 56
server/src/main/java/password/pwm/bean/LoginInfoBean.java

@@ -42,199 +42,222 @@ import java.util.Set;
 
 
 /**
- * This bean is synchronized across application sessions by {@link password.pwm.http.state.SessionLoginProvider}.
+ * <p>This bean is synchronized across application sessions by {@link password.pwm.http.state.SessionLoginProvider}.</p>
  *
- * Short serialized names are used to shrink the effective size of the login cookie.
+ * <p>Short serialized names are used to shrink the effective size of the login cookie.</p>
  */
 @Getter
 @Setter
-public class LoginInfoBean implements Serializable {
+public class LoginInfoBean implements Serializable
+{
 
-    public enum LoginFlag {
+    public enum LoginFlag
+    {
         skipOtp,
         skipNewPw,
-        noSso, // bypass sso
+
+        // bypass sso
+        noSso,
         authRecordSet,
         forcePwChange
     }
 
-    @SerializedName("u")
+    @SerializedName( "u" )
     private UserIdentity userIdentity;
 
-    @SerializedName("a")
+    @SerializedName( "a" )
     private boolean auth;
 
-    @SerializedName("p")
+    @SerializedName( "p" )
     private PasswordData pw;
 
-    @SerializedName("t")
+    @SerializedName( "t" )
     private AuthenticationType type = AuthenticationType.UNAUTHENTICATED;
 
-    @SerializedName("af")
+    @SerializedName( "af" )
     private List<AuthenticationType> authFlags = new ArrayList<>();
 
-    @SerializedName("as")
+    @SerializedName( "as" )
     private PwmAuthenticationSource authSource;
 
-    @SerializedName("at")
+    @SerializedName( "at" )
     private Instant authTime;
 
-    @SerializedName("rq")
+    @SerializedName( "rq" )
     private Instant reqTime;
 
-    @SerializedName("g")
+    @SerializedName( "g" )
     private String guid;
 
-    @SerializedName("ba")
+    @SerializedName( "ba" )
     private BasicAuthInfo basicAuth;
 
-    @SerializedName("oe")
+    @SerializedName( "oe" )
     private Instant oauthExp;
 
-    @SerializedName("or")
+    @SerializedName( "or" )
     private String oauthRefToken;
 
-    @SerializedName("c")
+    @SerializedName( "c" )
     private int reqCounter;
 
-    @SerializedName("lf")
+    @SerializedName( "lf" )
     private Set<LoginFlag> loginFlags = new HashSet<>();
 
-    public Instant getAuthTime()
+    public Instant getAuthTime( )
     {
         return authTime;
     }
 
-    public void setAuthTime(final Instant authTime)
+    public void setAuthTime( final Instant authTime )
     {
         this.authTime = authTime;
     }
 
-    public AuthenticationType getType()
+    public AuthenticationType getType( )
     {
         return type;
     }
 
-    public void setType(final AuthenticationType type)
+    public void setType( final AuthenticationType type )
     {
         this.type = type;
     }
 
-    public PasswordData getUserCurrentPassword()
+    public PasswordData getUserCurrentPassword( )
     {
         return pw;
     }
 
-    public void setUserCurrentPassword(final PasswordData userCurrentPassword)
+    public void setUserCurrentPassword( final PasswordData userCurrentPassword )
     {
         this.pw = userCurrentPassword;
     }
 
-    public BasicAuthInfo getBasicAuth()
+    public BasicAuthInfo getBasicAuth( )
     {
         return basicAuth;
     }
 
-    public void setBasicAuth(final BasicAuthInfo basicAuth)
+    public void setBasicAuth( final BasicAuthInfo basicAuth )
     {
         this.basicAuth = basicAuth;
     }
 
-    public Instant getOauthExp()
+    public Instant getOauthExp( )
     {
         return oauthExp;
     }
 
-    public void setOauthExp(final Instant oauthExp)
+    public void setOauthExp( final Instant oauthExp )
     {
         this.oauthExp = oauthExp;
     }
 
-    public String getOauthRefToken()
+    public String getOauthRefToken( )
     {
         return oauthRefToken;
     }
 
-    public void setOauthRefToken(final String oauthRefToken)
+    public void setOauthRefToken( final String oauthRefToken )
     {
         this.oauthRefToken = oauthRefToken;
     }
 
-    public List<AuthenticationType> getAuthFlags() {
+    public List<AuthenticationType> getAuthFlags( )
+    {
         return authFlags;
     }
 
-    public PwmAuthenticationSource getAuthSource() {
+    public PwmAuthenticationSource getAuthSource( )
+    {
         return authSource;
     }
 
-    public void setAuthSource(final PwmAuthenticationSource authSource) {
+    public void setAuthSource( final PwmAuthenticationSource authSource )
+    {
         this.authSource = authSource;
     }
 
-    public String getGuid() {
+    public String getGuid( )
+    {
         return guid;
     }
 
-    public void setGuid(final String guid) {
+    public void setGuid( final String guid )
+    {
         this.guid = guid;
     }
 
-    public int getReqCounter() {
+    public int getReqCounter( )
+    {
         return reqCounter;
     }
 
-    public void setReqCounter(final int reqCounter) {
+    public void setReqCounter( final int reqCounter )
+    {
         this.reqCounter = reqCounter;
     }
 
-    public UserIdentity getUserIdentity() {
+    public UserIdentity getUserIdentity( )
+    {
         return userIdentity;
     }
 
-    public void setUserIdentity(final UserIdentity userIdentity) {
+    public void setUserIdentity( final UserIdentity userIdentity )
+    {
         this.userIdentity = userIdentity;
     }
 
-    public boolean isAuthenticated() {
+    public boolean isAuthenticated( )
+    {
         return auth;
     }
 
-    public void setAuthenticated(final boolean authenticated) {
+    public void setAuthenticated( final boolean authenticated )
+    {
         this.auth = authenticated;
     }
 
-    public PasswordData getPw() {
+    public PasswordData getPw( )
+    {
         return pw;
     }
 
-    public void setPw(final PasswordData pw) {
+    public void setPw( final PasswordData pw )
+    {
         this.pw = pw;
     }
 
-    public Instant getReqTime() {
+    public Instant getReqTime( )
+    {
         return reqTime;
     }
 
-    public void setReqTime(final Instant reqTime) {
+    public void setReqTime( final Instant reqTime )
+    {
         this.reqTime = reqTime;
     }
 
-    public boolean isLoginFlag(final LoginFlag loginStateFlag) {
-        return loginFlags.contains(loginStateFlag);
+    public boolean isLoginFlag( final LoginFlag loginStateFlag )
+    {
+        return loginFlags.contains( loginStateFlag );
     }
 
-    public void setFlag(final LoginFlag loginFlag) {
-        loginFlags.add(loginFlag);
+    public void setFlag( final LoginFlag loginFlag )
+    {
+        loginFlags.add( loginFlag );
     }
 
-    public void removeFlag(final LoginFlag loginFlag) {
-        loginFlags.remove(loginFlag);
+    public void removeFlag( final LoginFlag loginFlag )
+    {
+        loginFlags.remove( loginFlag );
     }
 
-    public String toDebugString() throws PwmUnrecoverableException {
-        final LoginInfoBean debugLoginCookieBean = JsonUtil.cloneUsingJson(this, LoginInfoBean.class);
-        debugLoginCookieBean.setUserCurrentPassword(new PasswordData(PwmConstants.LOG_REMOVED_VALUE_REPLACEMENT));
-        return JsonUtil.serialize(debugLoginCookieBean);
+    public String toDebugString( ) throws PwmUnrecoverableException
+    {
+        final LoginInfoBean debugLoginCookieBean = JsonUtil.cloneUsingJson( this, LoginInfoBean.class );
+        debugLoginCookieBean.setUserCurrentPassword( new PasswordData( PwmConstants.LOG_REMOVED_VALUE_REPLACEMENT ) );
+        return JsonUtil.serialize( debugLoginCookieBean );
     }
 }

+ 7 - 4
server/src/main/java/password/pwm/bean/PasswordStatus.java

@@ -30,18 +30,21 @@ import java.io.Serializable;
 
 @Getter
 @Builder
-public class PasswordStatus implements Serializable {
+public class PasswordStatus implements Serializable
+{
     private final boolean expired;
     private final boolean preExpired;
     private final boolean violatesPolicy;
     private final boolean warnPeriod;
 
     @Override
-    public String toString() {
-        return JsonUtil.serialize(this);
+    public String toString( )
+    {
+        return JsonUtil.serialize( this );
     }
 
-    public boolean isEffectivelyExpired() {
+    public boolean isEffectivelyExpired( )
+    {
         return this.isExpired() || !this.isPreExpired() || !this.isViolatesPolicy();
     }
 }

+ 10 - 6
server/src/main/java/password/pwm/bean/PrivateKeyCertificate.java

@@ -28,20 +28,24 @@ import java.security.cert.X509Certificate;
 import java.util.Collections;
 import java.util.List;
 
-public class PrivateKeyCertificate implements Serializable {
+public class PrivateKeyCertificate implements Serializable
+{
     private final List<X509Certificate> certificates;
     private final PrivateKey key;
 
-    public PrivateKeyCertificate(final List<X509Certificate> certificates, final PrivateKey key) {
-        this.certificates = Collections.unmodifiableList(certificates);
+    public PrivateKeyCertificate( final List<X509Certificate> certificates, final PrivateKey key )
+    {
+        this.certificates = Collections.unmodifiableList( certificates );
         this.key = key;
     }
 
-    public List<X509Certificate> getCertificates() {
-        return Collections.unmodifiableList(certificates);
+    public List<X509Certificate> getCertificates( )
+    {
+        return Collections.unmodifiableList( certificates );
     }
 
-    public PrivateKey getKey() {
+    public PrivateKey getKey( )
+    {
         return key;
     }
 }

+ 14 - 7
server/src/main/java/password/pwm/bean/RemoteVerificationRequestBean.java

@@ -27,32 +27,39 @@ import password.pwm.bean.pub.PublicUserInfoBean;
 import java.io.Serializable;
 import java.util.Map;
 
-public class RemoteVerificationRequestBean implements Serializable {
+public class RemoteVerificationRequestBean implements Serializable
+{
     private String responseSessionID;
     private PublicUserInfoBean userInfo;
     private Map<String, String> userResponses;
 
-    public String getResponseSessionID() {
+    public String getResponseSessionID( )
+    {
         return responseSessionID;
     }
 
-    public void setResponseSessionID(final String responseSessionID) {
+    public void setResponseSessionID( final String responseSessionID )
+    {
         this.responseSessionID = responseSessionID;
     }
 
-    public PublicUserInfoBean getUserInfo() {
+    public PublicUserInfoBean getUserInfo( )
+    {
         return userInfo;
     }
 
-    public void setUserInfo(final PublicUserInfoBean userInfo) {
+    public void setUserInfo( final PublicUserInfoBean userInfo )
+    {
         this.userInfo = userInfo;
     }
 
-    public Map<String, String> getUserResponses() {
+    public Map<String, String> getUserResponses( )
+    {
         return userResponses;
     }
 
-    public void setUserResponses(final Map<String, String> userResponses) {
+    public void setUserResponses( final Map<String, String> userResponses )
+    {
         this.userResponses = userResponses;
     }
 }

+ 18 - 9
server/src/main/java/password/pwm/bean/RemoteVerificationResponseBean.java

@@ -27,41 +27,50 @@ import password.pwm.VerificationMethodSystem;
 import java.io.Serializable;
 import java.util.List;
 
-public class RemoteVerificationResponseBean implements Serializable {
+public class RemoteVerificationResponseBean implements Serializable
+{
     private String displayInstructions;
     private VerificationMethodSystem.VerificationState verificationState;
     private List<VerificationMethodSystem.UserPromptBean> userPrompts;
     private String errorMessage;
 
-    public String getDisplayInstructions() {
+    public String getDisplayInstructions( )
+    {
         return displayInstructions;
     }
 
-    public void setDisplayInstructions(final String displayInstructions) {
+    public void setDisplayInstructions( final String displayInstructions )
+    {
         this.displayInstructions = displayInstructions;
     }
 
-    public VerificationMethodSystem.VerificationState getVerificationState() {
+    public VerificationMethodSystem.VerificationState getVerificationState( )
+    {
         return verificationState;
     }
 
-    public void setVerificationState(final VerificationMethodSystem.VerificationState verificationState) {
+    public void setVerificationState( final VerificationMethodSystem.VerificationState verificationState )
+    {
         this.verificationState = verificationState;
     }
 
-    public List<VerificationMethodSystem.UserPromptBean> getUserPrompts() {
+    public List<VerificationMethodSystem.UserPromptBean> getUserPrompts( )
+    {
         return userPrompts;
     }
 
-    public void setUserPrompts(final List<VerificationMethodSystem.UserPromptBean> userPrompts) {
+    public void setUserPrompts( final List<VerificationMethodSystem.UserPromptBean> userPrompts )
+    {
         this.userPrompts = userPrompts;
     }
 
-    public String getErrorMessage() {
+    public String getErrorMessage( )
+    {
         return errorMessage;
     }
 
-    public void setErrorMessage(final String errorMessage) {
+    public void setErrorMessage( final String errorMessage )
+    {
         this.errorMessage = errorMessage;
     }
 }

+ 24 - 15
server/src/main/java/password/pwm/bean/ResponseInfoBean.java

@@ -31,9 +31,10 @@ import java.time.Instant;
 import java.util.Locale;
 import java.util.Map;
 
-public class ResponseInfoBean implements Serializable {
-    private final Map<Challenge,String> crMap;
-    private final Map<Challenge,String> helpdeskCrMap;
+public class ResponseInfoBean implements Serializable
+{
+    private final Map<Challenge, String> crMap;
+    private final Map<Challenge, String> helpdeskCrMap;
     private final Locale locale;
     private final int minRandoms;
     private final String csIdentifier;
@@ -43,14 +44,15 @@ public class ResponseInfoBean implements Serializable {
     private Instant timestamp;
 
     public ResponseInfoBean(
-            final Map<Challenge,String> crMap,
-            final Map<Challenge,String> helpdeskCrMap,
+            final Map<Challenge, String> crMap,
+            final Map<Challenge, String> helpdeskCrMap,
             final Locale locale,
             final int minRandoms,
             final String csIdentifier,
             final DataStorageMethod dataSource,
             final Answer.FormatType formatType
-    ) {
+    )
+    {
         this.crMap = crMap;
         this.helpdeskCrMap = helpdeskCrMap;
         this.locale = locale;
@@ -60,40 +62,47 @@ public class ResponseInfoBean implements Serializable {
         this.formatType = formatType;
     }
 
-    public Map<Challenge, String> getCrMap() {
+    public Map<Challenge, String> getCrMap( )
+    {
         return crMap;
     }
 
-    public Locale getLocale() {
+    public Locale getLocale( )
+    {
         return locale;
     }
 
-    public int getMinRandoms() {
+    public int getMinRandoms( )
+    {
         return minRandoms;
     }
 
-    public String getCsIdentifier() {
+    public String getCsIdentifier( )
+    {
         return csIdentifier;
     }
 
-    public Map<Challenge, String> getHelpdeskCrMap() {
+    public Map<Challenge, String> getHelpdeskCrMap( )
+    {
         return helpdeskCrMap;
     }
 
-    public Instant getTimestamp() {
+    public Instant getTimestamp( )
+    {
         return timestamp;
     }
 
-    public void setTimestamp(final Instant timestamp) {
+    public void setTimestamp( final Instant timestamp )
+    {
         this.timestamp = timestamp;
     }
 
-    public DataStorageMethod getDataStorageMethod()
+    public DataStorageMethod getDataStorageMethod( )
     {
         return dataStorageMethod;
     }
 
-    public Answer.FormatType getFormatType()
+    public Answer.FormatType getFormatType( )
     {
         return formatType;
     }

+ 16 - 13
server/src/main/java/password/pwm/bean/SessionLabel.java

@@ -29,16 +29,17 @@ import java.io.Serializable;
 
 @Getter
 @AllArgsConstructor
-public class SessionLabel implements Serializable {
+public class SessionLabel implements Serializable
+{
     public static final SessionLabel SYSTEM_LABEL = null;
     public static final String SESSION_LABEL_SESSION_ID = "#";
-    public static final SessionLabel PW_EXP_NOTICE_LABEL = new SessionLabel(SESSION_LABEL_SESSION_ID ,null,"pwExpireNotice",null,null);
-    public static final SessionLabel TOKEN_SESSION_LABEL = new SessionLabel(SESSION_LABEL_SESSION_ID ,null,"token",null,null);
-    public static final SessionLabel CLI_SESSION_LABEL= new SessionLabel(SESSION_LABEL_SESSION_ID ,null,"cli",null,null);
-    public static final SessionLabel HEALTH_SESSION_LABEL = new SessionLabel(SESSION_LABEL_SESSION_ID ,null,"health",null,null);
-    public static final SessionLabel REPORTING_SESSION_LABEL = new SessionLabel(SESSION_LABEL_SESSION_ID ,null,"reporting",null,null);
-    public static final SessionLabel AUDITING_SESSION_LABEL = new SessionLabel(SESSION_LABEL_SESSION_ID ,null,"auditing",null,null);
-    public static final SessionLabel TELEMETRY_SESSION_LABEL = new SessionLabel(SESSION_LABEL_SESSION_ID ,null,"telemetry",null,null);
+    public static final SessionLabel PW_EXP_NOTICE_LABEL = new SessionLabel( SESSION_LABEL_SESSION_ID, null, "pwExpireNotice", null, null );
+    public static final SessionLabel TOKEN_SESSION_LABEL = new SessionLabel( SESSION_LABEL_SESSION_ID, null, "token", null, null );
+    public static final SessionLabel CLI_SESSION_LABEL = new SessionLabel( SESSION_LABEL_SESSION_ID, null, "cli", null, null );
+    public static final SessionLabel HEALTH_SESSION_LABEL = new SessionLabel( SESSION_LABEL_SESSION_ID, null, "health", null, null );
+    public static final SessionLabel REPORTING_SESSION_LABEL = new SessionLabel( SESSION_LABEL_SESSION_ID, null, "reporting", null, null );
+    public static final SessionLabel AUDITING_SESSION_LABEL = new SessionLabel( SESSION_LABEL_SESSION_ID, null, "auditing", null, null );
+    public static final SessionLabel TELEMETRY_SESSION_LABEL = new SessionLabel( SESSION_LABEL_SESSION_ID, null, "telemetry", null, null );
 
     private final String sessionID;
     private final UserIdentity userIdentity;
@@ -46,13 +47,15 @@ public class SessionLabel implements Serializable {
     private final String srcAddress;
     private final String srcHostname;
 
-    public String toString() {
-        if (this.getSessionID() == null || this.getSessionID().isEmpty()) {
+    public String toString( )
+    {
+        if ( this.getSessionID() == null || this.getSessionID().isEmpty() )
+        {
             return "";
         }
-        return "{" + this.getSessionID() 
-                + (this.getUsername() != null && !this.getUsername().isEmpty() ? "," + this.getUsername() : "")
+        return "{" + this.getSessionID()
+                + ( this.getUsername() != null && !this.getUsername().isEmpty() ? "," + this.getUsername() : "" )
                 + "}";
-        
+
     }
 }

+ 5 - 3
server/src/main/java/password/pwm/bean/SmsItemBean.java

@@ -31,12 +31,14 @@ import java.io.Serializable;
 
 @Getter
 @AllArgsConstructor
-public class SmsItemBean implements Serializable {
+public class SmsItemBean implements Serializable
+{
     private final String to;
     private final String message;
     private final SessionLabel sessionLabel;
 
-    public String toString() {
-        return "SMS Item: " + JsonUtil.serialize(this);
+    public String toString( )
+    {
+        return "SMS Item: " + JsonUtil.serialize( this );
     }
 }

+ 19 - 15
server/src/main/java/password/pwm/bean/TokenDestinationItem.java

@@ -14,49 +14,53 @@ import java.util.List;
 
 @Getter
 @AllArgsConstructor
-public class TokenDestinationItem {
+public class TokenDestinationItem
+{
     private String id;
     private String display;
     private String value;
     private Type type;
 
-    public enum Type {
+    public enum Type
+    {
         sms,
         email,
     }
 
-    public static List<TokenDestinationItem> allFromConfig(final Configuration configuration, final UserInfo userInfo)
+    public static List<TokenDestinationItem> allFromConfig( final Configuration configuration, final UserInfo userInfo )
             throws PwmUnrecoverableException
     {
-        final ValueObfuscator valueObfuscator = new ValueObfuscator(configuration);
+        final ValueObfuscator valueObfuscator = new ValueObfuscator( configuration );
         int counter = 0;
 
         final List<TokenDestinationItem> results = new ArrayList<>();
 
         {
             final String smsValue = userInfo.getUserSmsNumber();
-            if (!StringUtil.isEmpty(smsValue)) {
-                results.add(new TokenDestinationItem(
-                        String.valueOf(++counter),
-                        valueObfuscator.maskPhone(smsValue),
+            if ( !StringUtil.isEmpty( smsValue ) )
+            {
+                results.add( new TokenDestinationItem(
+                        String.valueOf( ++counter ),
+                        valueObfuscator.maskPhone( smsValue ),
                         smsValue,
                         Type.sms
-                ));
+                ) );
             }
         }
 
         {
             final String emailValue = userInfo.getUserEmailAddress();
-            if (!StringUtil.isEmpty(emailValue)) {
-                results.add(new TokenDestinationItem(
-                        String.valueOf(++counter),
-                        valueObfuscator.maskEmail(emailValue),
+            if ( !StringUtil.isEmpty( emailValue ) )
+            {
+                results.add( new TokenDestinationItem(
+                        String.valueOf( ++counter ),
+                        valueObfuscator.maskEmail( emailValue ),
                         emailValue,
                         Type.email
-                ));
+                ) );
             }
         }
 
-        return Collections.unmodifiableList(results);
+        return Collections.unmodifiableList( results );
     }
 }

+ 16 - 8
server/src/main/java/password/pwm/bean/TokenVerificationProgress.java

@@ -26,38 +26,46 @@ import java.io.Serializable;
 import java.util.HashSet;
 import java.util.Set;
 
-public class TokenVerificationProgress implements Serializable {
+public class TokenVerificationProgress implements Serializable
+{
     private Set<TokenChannel> passedTokens = new HashSet<>();
     private Set<TokenChannel> issuedTokens = new HashSet<>();
     private TokenChannel phase;
     private String tokenDisplayText;
 
-    public enum TokenChannel {
+    public enum TokenChannel
+    {
         EMAIL,
         SMS,
     }
 
-    public Set<TokenChannel> getPassedTokens() {
+    public Set<TokenChannel> getPassedTokens( )
+    {
         return passedTokens;
     }
 
-    public Set<TokenChannel> getIssuedTokens() {
+    public Set<TokenChannel> getIssuedTokens( )
+    {
         return issuedTokens;
     }
 
-    public TokenChannel getPhase() {
+    public TokenChannel getPhase( )
+    {
         return phase;
     }
 
-    public void setPhase(final TokenChannel phase) {
+    public void setPhase( final TokenChannel phase )
+    {
         this.phase = phase;
     }
 
-    public String getTokenDisplayText() {
+    public String getTokenDisplayText( )
+    {
         return tokenDisplayText;
     }
 
-    public void setTokenDisplayText(final String tokenDisplayText) {
+    public void setTokenDisplayText( final String tokenDisplayText )
+    {
         this.tokenDisplayText = tokenDisplayText;
     }
 }

+ 118 - 76
server/src/main/java/password/pwm/bean/UserIdentity.java

@@ -40,7 +40,8 @@ import password.pwm.util.java.TimeDuration;
 import java.io.Serializable;
 import java.util.StringTokenizer;
 
-public class UserIdentity implements Serializable, Comparable {
+public class UserIdentity implements Serializable, Comparable
+{
     private static final String CRYPO_HEADER = "ui_C-";
     private static final String DELIM_SEPARATOR = "|";
 
@@ -50,150 +51,186 @@ public class UserIdentity implements Serializable, Comparable {
     private String userDN;
     private String ldapProfile;
 
-    public UserIdentity(final String userDN, final String ldapProfile) {
-        if (userDN == null || userDN.length() < 1) {
-            throw new IllegalArgumentException("UserIdentity: userDN value cannot be empty");
+    public UserIdentity( final String userDN, final String ldapProfile )
+    {
+        if ( userDN == null || userDN.length() < 1 )
+        {
+            throw new IllegalArgumentException( "UserIdentity: userDN value cannot be empty" );
         }
         this.userDN = userDN;
         this.ldapProfile = ldapProfile == null ? "" : ldapProfile;
     }
 
-    public String getUserDN() {
+    public String getUserDN( )
+    {
         return userDN;
     }
 
-    public String getLdapProfileID() {
+    public String getLdapProfileID( )
+    {
         return ldapProfile;
     }
 
-    public LdapProfile getLdapProfile(final Configuration configuration) {
-        if (configuration == null) {
+    public LdapProfile getLdapProfile( final Configuration configuration )
+    {
+        if ( configuration == null )
+        {
             return null;
         }
-        if (configuration.getLdapProfiles().containsKey(this.getLdapProfileID())) {
-            return configuration.getLdapProfiles().get(this.getLdapProfileID());
-        } else {
+        if ( configuration.getLdapProfiles().containsKey( this.getLdapProfileID() ) )
+        {
+            return configuration.getLdapProfiles().get( this.getLdapProfileID() );
+        }
+        else
+        {
             return null;
         }
     }
 
-    public String toString() {
-        return "UserIdentity" + JsonUtil.serialize(this);
+    public String toString( )
+    {
+        return "UserIdentity" + JsonUtil.serialize( this );
     }
 
-    public String toObfuscatedKey(final PwmApplication pwmApplication)
+    public String toObfuscatedKey( final PwmApplication pwmApplication )
             throws PwmUnrecoverableException
     {
         // use local cache first.
-        if (!StringUtil.isEmpty(obfuscatedValue)) {
+        if ( !StringUtil.isEmpty( obfuscatedValue ) )
+        {
             return obfuscatedValue;
         }
 
         // check app cache.  This is used primarily so that keys are static over some meaningful lifetime, allowing browser caching based on keys.
         final CacheService cacheService = pwmApplication.getCacheService();
-        final CacheKey cacheKey = CacheKey.makeCacheKey(this.getClass(), null, "userKey" + "|" + this.toDelimitedKey());
-        final String cachedValue = cacheService.get(cacheKey);
+        final CacheKey cacheKey = CacheKey.makeCacheKey( this.getClass(), null, "userKey" + "|" + this.toDelimitedKey() );
+        final String cachedValue = cacheService.get( cacheKey );
 
-        if (!StringUtil.isEmpty(cachedValue)) {
+        if ( !StringUtil.isEmpty( cachedValue ) )
+        {
             obfuscatedValue = cachedValue;
             return cachedValue;
         }
 
         // generate key
-        try {
-            final String jsonValue = JsonUtil.serialize(this);
-            final String localValue = CRYPO_HEADER + pwmApplication.getSecureService().encryptToString(jsonValue);
+        try
+        {
+            final String jsonValue = JsonUtil.serialize( this );
+            final String localValue = CRYPO_HEADER + pwmApplication.getSecureService().encryptToString( jsonValue );
             this.obfuscatedValue = localValue;
-            cacheService.put(cacheKey, CachePolicy.makePolicyWithExpiration(TimeDuration.DAY), localValue);
+            cacheService.put( cacheKey, CachePolicy.makePolicyWithExpiration( TimeDuration.DAY ), localValue );
             return localValue;
-        } catch (Exception e) {
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_UNKNOWN,"unexpected error making obfuscated user key: " + e.getMessage()));
+        }
+        catch ( Exception e )
+        {
+            throw new PwmUnrecoverableException( new ErrorInformation( PwmError.ERROR_UNKNOWN, "unexpected error making obfuscated user key: " + e.getMessage() ) );
         }
     }
 
-    public String toDelimitedKey() {
+    public String toDelimitedKey( )
+    {
         return this.getLdapProfileID() + DELIM_SEPARATOR + this.getUserDN();
     }
 
-    public String toDisplayString() {
-        return this.getUserDN() + ((this.getLdapProfileID() != null && !this.getLdapProfileID().isEmpty()) ? " (" + this.getLdapProfileID() + ")" : "");
+    public String toDisplayString( )
+    {
+        return this.getUserDN() + ( ( this.getLdapProfileID() != null && !this.getLdapProfileID().isEmpty() ) ? " (" + this.getLdapProfileID() + ")" : "" );
     }
 
-    public static UserIdentity fromObfuscatedKey(final String key, final PwmApplication pwmApplication) throws PwmUnrecoverableException {
-        if (key == null || key.length() < 1) {
+    public static UserIdentity fromObfuscatedKey( final String key, final PwmApplication pwmApplication ) throws PwmUnrecoverableException
+    {
+        if ( key == null || key.length() < 1 )
+        {
             return null;
         }
 
-        if (!key.startsWith(CRYPO_HEADER)) {
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_UNKNOWN,"cannot reverse obfuscated user key: missing header; value=" + key));
+        if ( !key.startsWith( CRYPO_HEADER ) )
+        {
+            throw new PwmUnrecoverableException( new ErrorInformation( PwmError.ERROR_UNKNOWN, "cannot reverse obfuscated user key: missing header; value=" + key ) );
         }
 
-        try {
-            final String input = key.substring(CRYPO_HEADER.length(),key.length());
-            final String jsonValue = pwmApplication.getSecureService().decryptStringValue(input);
-            return JsonUtil.deserialize(jsonValue,UserIdentity.class);
-        } catch (Exception e) {
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_UNKNOWN,"unexpected error reversing obfuscated user key: " + e.getMessage()));
+        try
+        {
+            final String input = key.substring( CRYPO_HEADER.length(), key.length() );
+            final String jsonValue = pwmApplication.getSecureService().decryptStringValue( input );
+            return JsonUtil.deserialize( jsonValue, UserIdentity.class );
+        }
+        catch ( Exception e )
+        {
+            throw new PwmUnrecoverableException( new ErrorInformation( PwmError.ERROR_UNKNOWN, "unexpected error reversing obfuscated user key: " + e.getMessage() ) );
         }
     }
 
-    public static UserIdentity fromDelimitedKey(final String key) throws PwmUnrecoverableException {
-        if (key == null || key.length() < 1) {
+    public static UserIdentity fromDelimitedKey( final String key ) throws PwmUnrecoverableException
+    {
+        if ( key == null || key.length() < 1 )
+        {
             return null;
         }
 
-        final StringTokenizer st = new StringTokenizer(key, DELIM_SEPARATOR);
-        if (st.countTokens() < 2) {
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_UNKNOWN,"not enough tokens while parsing delimited identity key"));
-        } else if (st.countTokens() > 2) {
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_UNKNOWN,"too many string tokens while parsing delimited identity key"));
+        final StringTokenizer st = new StringTokenizer( key, DELIM_SEPARATOR );
+        if ( st.countTokens() < 2 )
+        {
+            throw new PwmUnrecoverableException( new ErrorInformation( PwmError.ERROR_UNKNOWN, "not enough tokens while parsing delimited identity key" ) );
+        }
+        else if ( st.countTokens() > 2 )
+        {
+            throw new PwmUnrecoverableException( new ErrorInformation( PwmError.ERROR_UNKNOWN, "too many string tokens while parsing delimited identity key" ) );
         }
         final String profileID = st.nextToken();
         final String userDN = st.nextToken();
-        return new UserIdentity(userDN,profileID);
+        return new UserIdentity( userDN, profileID );
     }
 
-    public static UserIdentity fromKey(final String key, final PwmApplication pwmApplication) throws PwmUnrecoverableException {
-        if (key == null || key.length() < 1) {
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_MISSING_PARAMETER,"userKey parameter is missing");
-            throw new PwmUnrecoverableException(errorInformation);
+    public static UserIdentity fromKey( final String key, final PwmApplication pwmApplication ) throws PwmUnrecoverableException
+    {
+        if ( key == null || key.length() < 1 )
+        {
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_MISSING_PARAMETER, "userKey parameter is missing" );
+            throw new PwmUnrecoverableException( errorInformation );
         }
 
-        if (key.startsWith(CRYPO_HEADER)) {
-            return fromObfuscatedKey(key, pwmApplication);
+        if ( key.startsWith( CRYPO_HEADER ) )
+        {
+            return fromObfuscatedKey( key, pwmApplication );
         }
 
-        return fromDelimitedKey(key);
+        return fromDelimitedKey( key );
     }
 
-    public boolean canonicalEquals(final UserIdentity otherIdentity, final PwmApplication pwmApplication)
+    public boolean canonicalEquals( final UserIdentity otherIdentity, final PwmApplication pwmApplication )
             throws PwmUnrecoverableException
     {
-        if (otherIdentity == null) {
+        if ( otherIdentity == null )
+        {
             return false;
         }
 
-        final UserIdentity thisCanonicalIdentity = this.canonicalized(pwmApplication);
-        final UserIdentity otherCanonicalIdentity = otherIdentity.canonicalized(pwmApplication);
-        return thisCanonicalIdentity.equals(otherCanonicalIdentity);
+        final UserIdentity thisCanonicalIdentity = this.canonicalized( pwmApplication );
+        final UserIdentity otherCanonicalIdentity = otherIdentity.canonicalized( pwmApplication );
+        return thisCanonicalIdentity.equals( otherCanonicalIdentity );
     }
 
     @Override
-    public boolean equals(final Object o)
+    public boolean equals( final Object o )
     {
-        if (this == o) {
+        if ( this == o )
+        {
             return true;
         }
-        if (o == null || getClass() != o.getClass()) {
+        if ( o == null || getClass() != o.getClass() )
+        {
             return false;
         }
 
-        final UserIdentity that = (UserIdentity) o;
+        final UserIdentity that = ( UserIdentity ) o;
 
-        if (!ldapProfile.equals(that.ldapProfile)) {
+        if ( !ldapProfile.equals( that.ldapProfile ) )
+        {
             return false;
         }
-        if (!userDN.equals(that.userDN)) {
+        if ( !userDN.equals( that.userDN ) )
+        {
             return false;
         }
 
@@ -201,7 +238,7 @@ public class UserIdentity implements Serializable, Comparable {
     }
 
     @Override
-    public int hashCode()
+    public int hashCode( )
     {
         int result = userDN.hashCode();
         result = 31 * result + ldapProfile.hashCode();
@@ -209,29 +246,34 @@ public class UserIdentity implements Serializable, Comparable {
     }
 
     @Override
-    public int compareTo(final Object o) {
-        final String thisStr = (ldapProfile == null ? "_" : ldapProfile) + userDN;
-        final UserIdentity otherIdentity = (UserIdentity)o;
-        final String otherStr = (otherIdentity.ldapProfile == null ? "_" : otherIdentity.ldapProfile) + otherIdentity.userDN;
+    public int compareTo( final Object o )
+    {
+        final String thisStr = ( ldapProfile == null ? "_" : ldapProfile ) + userDN;
+        final UserIdentity otherIdentity = ( UserIdentity ) o;
+        final String otherStr = ( otherIdentity.ldapProfile == null ? "_" : otherIdentity.ldapProfile ) + otherIdentity.userDN;
 
-        return thisStr.compareTo(otherStr);
+        return thisStr.compareTo( otherStr );
     }
 
-    public UserIdentity canonicalized(final PwmApplication pwmApplication)
+    public UserIdentity canonicalized( final PwmApplication pwmApplication )
             throws PwmUnrecoverableException
     {
-        if (this.canonicalized) {
+        if ( this.canonicalized )
+        {
             return this;
         }
 
-        final ChaiUser chaiUser = pwmApplication.getProxiedChaiUser(this);
+        final ChaiUser chaiUser = pwmApplication.getProxiedChaiUser( this );
         final String userDN;
-        try {
+        try
+        {
             userDN = chaiUser.readCanonicalDN();
-        } catch (ChaiException e) {
-            throw PwmUnrecoverableException.fromChaiException(e);
         }
-        final UserIdentity canonicalziedIdentity = new UserIdentity(userDN, this.getLdapProfileID());
+        catch ( ChaiException e )
+        {
+            throw PwmUnrecoverableException.fromChaiException( e );
+        }
+        final UserIdentity canonicalziedIdentity = new UserIdentity( userDN, this.getLdapProfileID() );
         canonicalziedIdentity.canonicalized = true;
         return canonicalziedIdentity;
     }

+ 12 - 9
server/src/main/java/password/pwm/bean/pub/PublicUserInfoBean.java

@@ -24,11 +24,11 @@ package password.pwm.bean.pub;
 
 import lombok.Getter;
 import password.pwm.bean.PasswordStatus;
-import password.pwm.error.PwmUnrecoverableException;
-import password.pwm.ldap.UserInfo;
 import password.pwm.config.Configuration;
 import password.pwm.config.profile.PwmPasswordRule;
+import password.pwm.error.PwmUnrecoverableException;
 import password.pwm.http.tag.PasswordRequirementsTag;
+import password.pwm.ldap.UserInfo;
 import password.pwm.util.macro.MacroMachine;
 
 import java.io.Serializable;
@@ -40,7 +40,8 @@ import java.util.Locale;
 import java.util.Map;
 
 @Getter
-public class PublicUserInfoBean implements Serializable {
+public class PublicUserInfoBean implements Serializable
+{
     private String userDN;
     private String ldapProfile;
     private String userID;
@@ -71,8 +72,8 @@ public class PublicUserInfoBean implements Serializable {
             throws PwmUnrecoverableException
     {
         final PublicUserInfoBean publicUserInfoBean = new PublicUserInfoBean();
-        publicUserInfoBean.userDN = (userInfoBean.getUserIdentity() == null) ? "" : userInfoBean.getUserIdentity().getUserDN();
-        publicUserInfoBean.ldapProfile = (userInfoBean.getUserIdentity() == null) ? "" : userInfoBean.getUserIdentity().getLdapProfileID();
+        publicUserInfoBean.userDN = ( userInfoBean.getUserIdentity() == null ) ? "" : userInfoBean.getUserIdentity().getUserDN();
+        publicUserInfoBean.ldapProfile = ( userInfoBean.getUserIdentity() == null ) ? "" : userInfoBean.getUserIdentity().getLdapProfileID();
         publicUserInfoBean.userID = userInfoBean.getUsername();
         publicUserInfoBean.userGUID = publicUserInfoBean.getUserGUID();
         publicUserInfoBean.userEmailAddress = userInfoBean.getUserEmailAddress();
@@ -90,8 +91,9 @@ public class PublicUserInfoBean implements Serializable {
         publicUserInfoBean.requiresInteraction = userInfoBean.isRequiresInteraction();
 
         publicUserInfoBean.passwordPolicy = new HashMap<>();
-        for (final PwmPasswordRule rule : PwmPasswordRule.values()) {
-            publicUserInfoBean.passwordPolicy.put(rule.name(), userInfoBean.getPasswordPolicy().getValue(rule));
+        for ( final PwmPasswordRule rule : PwmPasswordRule.values() )
+        {
+            publicUserInfoBean.passwordPolicy.put( rule.name(), userInfoBean.getPasswordPolicy().getValue( rule ) );
         }
 
         publicUserInfoBean.passwordRules = PasswordRequirementsTag.getPasswordRequirementsStrings(
@@ -101,8 +103,9 @@ public class PublicUserInfoBean implements Serializable {
                 macroMachine
         );
 
-        if (userInfoBean.getCachedAttributeValues() != null && !userInfoBean.getCachedAttributeValues().isEmpty()) {
-            publicUserInfoBean.attributes = Collections.unmodifiableMap(userInfoBean.getCachedAttributeValues());
+        if ( userInfoBean.getCachedAttributeValues() != null && !userInfoBean.getCachedAttributeValues().isEmpty() )
+        {
+            publicUserInfoBean.attributes = Collections.unmodifiableMap( userInfoBean.getCachedAttributeValues() );
         }
 
         return publicUserInfoBean;

+ 2 - 1
server/src/main/java/password/pwm/bean/pub/PublishedBean.java

@@ -22,5 +22,6 @@
 
 package password.pwm.bean.pub;
 
-public interface PublishedBean {
+public interface PublishedBean
+{
 }

+ 2 - 1
server/src/main/java/password/pwm/bean/pub/SessionStateInfoBean.java

@@ -28,7 +28,8 @@ import java.time.Instant;
 import java.util.Locale;
 
 @Data
-public class SessionStateInfoBean implements PublishedBean {
+public class SessionStateInfoBean implements PublishedBean
+{
     private String label;
     private Instant createTime;
     private Instant lastTime;

File diff suppressed because it is too large
+ 504 - 331
server/src/main/java/password/pwm/config/Configuration.java


+ 19 - 12
server/src/main/java/password/pwm/config/CustomLinkConfiguration.java

@@ -35,31 +35,38 @@ import java.util.Map;
  * @author Richard A. Keil
  */
 @Getter
-public class CustomLinkConfiguration implements Serializable {
+public class CustomLinkConfiguration implements Serializable
+{
 
-    public enum Type {text, url, select, checkbox, customLink}
+    public enum Type
+    {
+        text, url, select, checkbox, customLink
+    }
 
     private String name;
     private Type type = Type.customLink;
-    private Map<String,String> labels = Collections.singletonMap("", "");
-    private Map<String,String> description = Collections.singletonMap("","");
+    private Map<String, String> labels = Collections.singletonMap( "", "" );
+    private Map<String, String> description = Collections.singletonMap( "", "" );
     private String customLinkUrl = "";
     private boolean customLinkNewWindow;
-    private Map<String,String> selectOptions = Collections.emptyMap();
+    private Map<String, String> selectOptions = Collections.emptyMap();
 
-    public String getLabel(final Locale locale) {
-        return LocaleHelper.resolveStringKeyLocaleMap(locale, labels);
+    public String getLabel( final Locale locale )
+    {
+        return LocaleHelper.resolveStringKeyLocaleMap( locale, labels );
     }
 
-    public String getDescription(final Locale locale) {
-        return LocaleHelper.resolveStringKeyLocaleMap(locale, description);
+    public String getDescription( final Locale locale )
+    {
+        return LocaleHelper.resolveStringKeyLocaleMap( locale, description );
     }
 
-    public String toString() {
+    public String toString( )
+    {
         final StringBuilder sb = new StringBuilder();
 
-        sb.append("CustomLink: ");
-        sb.append(JsonUtil.serialize(this));
+        sb.append( "CustomLink: " );
+        sb.append( JsonUtil.serialize( this ) );
 
         return sb.toString();
     }

+ 19 - 13
server/src/main/java/password/pwm/config/LDAPPermissionInfo.java

@@ -29,44 +29,50 @@ import password.pwm.util.macro.MacroMachine;
 import java.io.Serializable;
 import java.util.Locale;
 
-public class LDAPPermissionInfo implements Serializable {
+public class LDAPPermissionInfo implements Serializable
+{
     private final Access access;
     private final Actor actor;
 
-    public LDAPPermissionInfo(final Access type, final Actor actor) {
+    public LDAPPermissionInfo( final Access type, final Actor actor )
+    {
         this.access = type;
         this.actor = actor;
     }
 
-    public Access getAccess() {
+    public Access getAccess( )
+    {
         return access;
     }
 
-    public Actor getActor() {
+    public Actor getActor( )
+    {
         return actor;
     }
 
-    public enum Access {
+    public enum Access
+    {
         read,
         write,
     }
 
-    public enum Actor {
+    public enum Actor
+    {
         proxy,
         self,
         self_other,
         helpdesk,
-        guestManager,
+        guestManager,;
 
-        ;
-
-        public String getLabel(final Locale locale, final Configuration config) {
-            return LocaleHelper.getLocalizedMessage(locale, "Actor_Label_" + this.toString(), config, Config.class);
+        public String getLabel( final Locale locale, final Configuration config )
+        {
+            return LocaleHelper.getLocalizedMessage( locale, "Actor_Label_" + this.toString(), config, Config.class );
         }
 
-        public String getDescription(final Locale locale, final Configuration config) {
+        public String getDescription( final Locale locale, final Configuration config )
+        {
             final MacroMachine macroMachine = MacroMachine.forStatic();
-            return macroMachine.expandMacros(LocaleHelper.getLocalizedMessage(locale, "Actor_Description_" + this.toString(), config, Config.class));
+            return macroMachine.expandMacros( LocaleHelper.getLocalizedMessage( locale, "Actor_Description_" + this.toString(), config, Config.class ) );
         }
     }
 }

+ 243 - 188
server/src/main/java/password/pwm/config/PwmSettingCategory.java

@@ -38,267 +38,299 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.TreeMap;
 
-public enum PwmSettingCategory {
+public enum PwmSettingCategory
+{
 
-    TEMPLATES                   (null),
-    NOTES                       (null),
+    TEMPLATES( null ),
+    NOTES( null ),
 
-    LDAP                        (null),
-    SETTINGS                    (null),
-    PROFILES                    (null),
-    MODULES                     (null),
-    MODULES_PUBLIC              (MODULES),
-    MODULES_PRIVATE             (MODULES),
+    LDAP( null ),
+    SETTINGS( null ),
+    PROFILES( null ),
+    MODULES( null ),
+    MODULES_PUBLIC( MODULES ),
+    MODULES_PRIVATE( MODULES ),
 
-    LDAP_PROFILE                (LDAP),
-    LDAP_BASE                   (LDAP_PROFILE),
-    LDAP_LOGIN                  (LDAP_PROFILE),
-    LDAP_ATTRIBUTES             (LDAP_PROFILE),
+    LDAP_PROFILE( LDAP ),
+    LDAP_BASE( LDAP_PROFILE ),
+    LDAP_LOGIN( LDAP_PROFILE ),
+    LDAP_ATTRIBUTES( LDAP_PROFILE ),
 
 
-    LDAP_SETTINGS               (LDAP),
-    LDAP_GLOBAL                 (LDAP_SETTINGS),
+    LDAP_SETTINGS( LDAP ),
+    LDAP_GLOBAL( LDAP_SETTINGS ),
 
-    EDIRECTORY                  (LDAP_SETTINGS),
-    EDIR_SETTINGS               (EDIRECTORY),
-    EDIR_CR_SETTINGS            (EDIRECTORY),
+    EDIRECTORY( LDAP_SETTINGS ),
+    EDIR_SETTINGS( EDIRECTORY ),
+    EDIR_CR_SETTINGS( EDIRECTORY ),
 
-    ACTIVE_DIRECTORY            (LDAP_SETTINGS),
-    ORACLE_DS                   (LDAP_SETTINGS),
+    ACTIVE_DIRECTORY( LDAP_SETTINGS ),
+    ORACLE_DS( LDAP_SETTINGS ),
 
-    APPLICATION                 (SETTINGS),
-    GENERAL                     (APPLICATION),
-    CLUSTERING                  (APPLICATION),
-    LOCALIZATION                (APPLICATION),
-    TELEMETRY                   (APPLICATION),
+    APPLICATION( SETTINGS ),
+    GENERAL( APPLICATION ),
+    CLUSTERING( APPLICATION ),
+    LOCALIZATION( APPLICATION ),
+    TELEMETRY( APPLICATION ),
 
-    AUDITING                    (SETTINGS),
-    AUDIT_CONFIG                (AUDITING),
-    AUDIT_FORWARD               (AUDITING),
+    AUDITING( SETTINGS ),
+    AUDIT_CONFIG( AUDITING ),
+    AUDIT_FORWARD( AUDITING ),
 
-    USER_HISTORY                (SETTINGS),
+    USER_HISTORY( SETTINGS ),
 
-    CAPTCHA                     (SETTINGS),
+    CAPTCHA( SETTINGS ),
 
-    INTRUDER                    (SETTINGS),
-    INTRUDER_SETTINGS           (INTRUDER),
-    INTRUDER_TIMEOUTS           (INTRUDER),
+    INTRUDER( SETTINGS ),
+    INTRUDER_SETTINGS( INTRUDER ),
+    INTRUDER_TIMEOUTS( INTRUDER ),
 
-    USER_INTERFACE              (SETTINGS),
-    UI_FEATURES                 (USER_INTERFACE),
-    UI_WEB                      (USER_INTERFACE),
+    USER_INTERFACE( SETTINGS ),
+    UI_FEATURES( USER_INTERFACE ),
+    UI_WEB( USER_INTERFACE ),
 
-    EMAIL                       (SETTINGS),
-    EMAIL_SETTINGS              (EMAIL),
-    EMAIL_TEMPLATES             (EMAIL),
+    EMAIL( SETTINGS ),
+    EMAIL_SETTINGS( EMAIL ),
+    EMAIL_TEMPLATES( EMAIL ),
 
-    SMS                         (SETTINGS),
-    SMS_GATEWAY                 (SMS),
-    SMS_MESSAGES                (SMS),
+    SMS( SETTINGS ),
+    SMS_GATEWAY( SMS ),
+    SMS_MESSAGES( SMS ),
 
-    SECURITY                    (SETTINGS),
-    APP_SECURITY                (SECURITY),
-    WEB_SECURITY                (SECURITY),
+    SECURITY( SETTINGS ),
+    APP_SECURITY( SECURITY ),
+    WEB_SECURITY( SECURITY ),
 
-    WORDLISTS                   (SETTINGS),
+    WORDLISTS( SETTINGS ),
 
-    PASSWORD_GLOBAL             (SETTINGS),
+    PASSWORD_GLOBAL( SETTINGS ),
 
-    TOKEN                       (SETTINGS),
-    OTP                         (SETTINGS),
-    LOGGING                     (SETTINGS),
+    TOKEN( SETTINGS ),
+    OTP( SETTINGS ),
+    LOGGING( SETTINGS ),
 
-    DATABASE                    (SETTINGS),
-    DATABASE_SETTINGS           (DATABASE),
-    DATABASE_ADV                (DATABASE),
+    DATABASE( SETTINGS ),
+    DATABASE_SETTINGS( DATABASE ),
+    DATABASE_ADV( DATABASE ),
 
-    REPORTING                   (SETTINGS),
+    REPORTING( SETTINGS ),
 
-    SSO                         (SETTINGS),
-    OAUTH                       (SSO),
-    HTTP_SSO                    (SSO),
-    CAS_SSO                     (SSO),
-    BASIC_SSO                   (SSO),
+    SSO( SETTINGS ),
+    OAUTH( SSO ),
+    HTTP_SSO( SSO ),
+    CAS_SSO( SSO ),
+    BASIC_SSO( SSO ),
 
-    WEB_SERVICES                (SETTINGS),
-    REST_SERVER                 (WEB_SERVICES),
-    REST_CLIENT                 (WEB_SERVICES),
+    WEB_SERVICES( SETTINGS ),
+    REST_SERVER( WEB_SERVICES ),
+    REST_CLIENT( WEB_SERVICES ),
 
-    PASSWORD_POLICY             (PROFILES),
-    CHALLENGE_POLICY            (PROFILES),
+    PASSWORD_POLICY( PROFILES ),
+    CHALLENGE_POLICY( PROFILES ),
 
-    HTTPS_SERVER                (SETTINGS),
+    HTTPS_SERVER( SETTINGS ),
 
-    ADMINISTRATION              (MODULES_PRIVATE),
+    ADMINISTRATION( MODULES_PRIVATE ),
 
-    ACCOUNT_INFO                (MODULES_PRIVATE),
-    CHANGE_PASSWORD             (MODULES_PRIVATE),
-    CHALLENGE                   (MODULES_PRIVATE),
+    ACCOUNT_INFO( MODULES_PRIVATE ),
+    CHANGE_PASSWORD( MODULES_PRIVATE ),
+    CHALLENGE( MODULES_PRIVATE ),
 
-    RECOVERY                    (MODULES_PUBLIC),
-    RECOVERY_SETTINGS           (RECOVERY),
-    RECOVERY_PROFILE            (RECOVERY),
+    RECOVERY( MODULES_PUBLIC ),
+    RECOVERY_SETTINGS( RECOVERY ),
+    RECOVERY_PROFILE( RECOVERY ),
 
-    RECOVERY_DEF                (RECOVERY_PROFILE),
-    RECOVERY_OAUTH              (RECOVERY_PROFILE),
+    RECOVERY_DEF( RECOVERY_PROFILE ),
+    RECOVERY_OAUTH( RECOVERY_PROFILE ),
 
-    FORGOTTEN_USERNAME          (MODULES_PUBLIC),
+    FORGOTTEN_USERNAME( MODULES_PUBLIC ),
 
-    ACTIVATION                  (MODULES_PUBLIC),
+    ACTIVATION( MODULES_PUBLIC ),
 
-    NEWUSER                     (MODULES_PUBLIC),
-    NEWUSER_SETTINGS            (NEWUSER),
-    NEWUSER_PROFILE             (NEWUSER),
+    NEWUSER( MODULES_PUBLIC ),
+    NEWUSER_SETTINGS( NEWUSER ),
+    NEWUSER_PROFILE( NEWUSER ),
 
-    UPDATE                      (MODULES_PRIVATE),
-    UPDATE_SETTINGS             (UPDATE),
-    UPDATE_PROFILE              (UPDATE),
+    UPDATE( MODULES_PRIVATE ),
+    UPDATE_SETTINGS( UPDATE ),
+    UPDATE_PROFILE( UPDATE ),
 
-    GUEST                       (MODULES_PRIVATE),
-    SHORTCUT                    (MODULES_PRIVATE),
-    PEOPLE_SEARCH               (MODULES_PRIVATE),
+    GUEST( MODULES_PRIVATE ),
+    SHORTCUT( MODULES_PRIVATE ),
+    PEOPLE_SEARCH( MODULES_PRIVATE ),
 
-    HELPDESK                    (MODULES_PRIVATE),
-    HELPDESK_PROFILE            (HELPDESK),
+    HELPDESK( MODULES_PRIVATE ),
+    HELPDESK_PROFILE( HELPDESK ),
 
-    HELPDESK_BASE               (HELPDESK_PROFILE),
-    HELPDESK_VERIFICATION       (HELPDESK_PROFILE),
-    HELPDESK_OPTIONS            (HELPDESK_PROFILE),
+    HELPDESK_BASE( HELPDESK_PROFILE ),
+    HELPDESK_VERIFICATION( HELPDESK_PROFILE ),
+    HELPDESK_OPTIONS( HELPDESK_PROFILE ),
 
-    HELPDESK_SETTINGS           (HELPDESK),
+    HELPDESK_SETTINGS( HELPDESK ),
 
-    DELETE_ACCOUNT              (MODULES_PRIVATE),
-    DELETE_ACCOUNT_SETTINGS     (DELETE_ACCOUNT),
-    DELETE_ACCOUNT_PROFILE      (DELETE_ACCOUNT),
+    DELETE_ACCOUNT( MODULES_PRIVATE ),
+    DELETE_ACCOUNT_SETTINGS( DELETE_ACCOUNT ),
+    DELETE_ACCOUNT_PROFILE( DELETE_ACCOUNT ),
 
-    INTERNAL                    (SETTINGS),
-
-    ;
+    INTERNAL( SETTINGS ),;
 
     private final PwmSettingCategory parent;
     private static final Map<PwmSettingCategory, password.pwm.config.PwmSetting> CACHE_PROFILE_SETTING = new HashMap<>();
-    private static List<PwmSettingCategory> cached_sortedSettings;
+    private static List<PwmSettingCategory> cachedSortedSettings;
 
     private Integer level;
     private Boolean hidden;
 
 
-    PwmSettingCategory(final PwmSettingCategory parent) {
+    PwmSettingCategory( final PwmSettingCategory parent )
+    {
         this.parent = parent;
     }
 
-    public PwmSettingCategory getParent() {
+    public PwmSettingCategory getParent( )
+    {
         return parent;
     }
 
-    public String getKey() {
+    public String getKey( )
+    {
         return this.toString();
     }
 
-    public password.pwm.config.PwmSetting getProfileSetting()
+    public password.pwm.config.PwmSetting getProfileSetting( )
     {
-        if (!CACHE_PROFILE_SETTING.containsKey(this)) {
-            CACHE_PROFILE_SETTING.put(this, readProfileSettingFromXml(true));
+        if ( !CACHE_PROFILE_SETTING.containsKey( this ) )
+        {
+            CACHE_PROFILE_SETTING.put( this, readProfileSettingFromXml( true ) );
         }
-        return CACHE_PROFILE_SETTING.get(this);
+        return CACHE_PROFILE_SETTING.get( this );
     }
 
-    public boolean hasProfiles() {
+    public boolean hasProfiles( )
+    {
         return getProfileSetting() != null;
     }
 
-    public boolean isTopLevelProfile() {
-        return readProfileSettingFromXml(false) != null;
+    public boolean isTopLevelProfile( )
+    {
+        return readProfileSettingFromXml( false ) != null;
     }
 
-    public String getLabel(final Locale locale) {
+    public String getLabel( final Locale locale )
+    {
         final String key = PwmSetting.CATEGORY_LABEL_PREFIX + this.getKey();
-        return LocaleHelper.getLocalizedMessage(locale, key, null, PwmSetting.class);
+        return LocaleHelper.getLocalizedMessage( locale, key, null, PwmSetting.class );
     }
 
-    public String getDescription(final Locale locale) {
+    public String getDescription( final Locale locale )
+    {
         final String key = PwmSetting.CATEGORY_DESCRIPTION_PREFIX + this.getKey();
-        return LocaleHelper.getLocalizedMessage(locale, key, null, PwmSetting.class);
+        return LocaleHelper.getLocalizedMessage( locale, key, null, PwmSetting.class );
     }
 
-    public int getLevel() {
-        if (level == null) {
-            final Element settingElement = PwmSettingXml.readCategoryXml(this);
-            final Attribute levelAttribute = settingElement.getAttribute("level");
-            level = levelAttribute != null ? Integer.parseInt(levelAttribute.getValue()) : 0;
+    public int getLevel( )
+    {
+        if ( level == null )
+        {
+            final Element settingElement = PwmSettingXml.readCategoryXml( this );
+            final Attribute levelAttribute = settingElement.getAttribute( "level" );
+            level = levelAttribute != null ? Integer.parseInt( levelAttribute.getValue() ) : 0;
         }
         return level;
     }
 
-    public boolean isHidden() {
-        if (hidden == null) {
-            final Element settingElement = PwmSettingXml.readCategoryXml(this);
-            final Attribute hiddenElement = settingElement.getAttribute("hidden");
-            if (hiddenElement != null && "true".equalsIgnoreCase(hiddenElement.getValue())) {
+    public boolean isHidden( )
+    {
+        if ( hidden == null )
+        {
+            final Element settingElement = PwmSettingXml.readCategoryXml( this );
+            final Attribute hiddenElement = settingElement.getAttribute( "hidden" );
+            if ( hiddenElement != null && "true".equalsIgnoreCase( hiddenElement.getValue() ) )
+            {
                 hidden = true;
-            } else {
-                for (final PwmSettingCategory parentCategory : getParents()) {
-                    if (parentCategory.isHidden()) {
+            }
+            else
+            {
+                for ( final PwmSettingCategory parentCategory : getParents() )
+                {
+                    if ( parentCategory.isHidden() )
+                    {
                         hidden = true;
                     }
                 }
             }
-            if (hidden == null) {
+            if ( hidden == null )
+            {
                 hidden = false;
             }
         }
         return hidden;
     }
 
-    public boolean isTopCategory() {
+    public boolean isTopCategory( )
+    {
         return getParent() == null;
     }
 
-    public Collection<PwmSettingCategory> getParents() {
+    public Collection<PwmSettingCategory> getParents( )
+    {
         final ArrayList<PwmSettingCategory> returnObj = new ArrayList<>();
         PwmSettingCategory currentCategory = this.getParent();
-        while (currentCategory != null) {
-            returnObj.add(0,currentCategory);
+        while ( currentCategory != null )
+        {
+            returnObj.add( 0, currentCategory );
             currentCategory = currentCategory.getParent();
         }
         return returnObj;
     }
 
-    public Collection<PwmSettingCategory> getChildCategories() {
+    public Collection<PwmSettingCategory> getChildCategories( )
+    {
         final ArrayList<PwmSettingCategory> returnObj = new ArrayList<>();
-        for (final PwmSettingCategory category : values()) {
-            if (this == category.getParent()) {
-                returnObj.add(category);
+        for ( final PwmSettingCategory category : values() )
+        {
+            if ( this == category.getParent() )
+            {
+                returnObj.add( category );
             }
         }
         return returnObj;
     }
 
-    public static Collection<PwmSettingCategory> topCategories() {
+    public static Collection<PwmSettingCategory> topCategories( )
+    {
         final ArrayList<PwmSettingCategory> returnObj = new ArrayList<>();
-        for (final PwmSettingCategory category : values()) {
-            if (category.isTopCategory()) {
-                returnObj.add(category);
+        for ( final PwmSettingCategory category : values() )
+        {
+            if ( category.isTopCategory() )
+            {
+                returnObj.add( category );
             }
         }
         return returnObj;
     }
 
-    private password.pwm.config.PwmSetting readProfileSettingFromXml(final boolean nested)
+    private password.pwm.config.PwmSetting readProfileSettingFromXml( final boolean nested )
     {
         PwmSettingCategory nextCategory = this;
-        while (nextCategory != null) {
-            final Element categoryElement = PwmSettingXml.readCategoryXml(nextCategory);
-            final Element profileElement = categoryElement.getChild("profile");
-            if (profileElement != null) {
-                final String settingKey = profileElement.getAttributeValue("setting");
-                if (settingKey != null) {
-                    return password.pwm.config.PwmSetting.forKey(settingKey);
+        while ( nextCategory != null )
+        {
+            final Element categoryElement = PwmSettingXml.readCategoryXml( nextCategory );
+            final Element profileElement = categoryElement.getChild( "profile" );
+            if ( profileElement != null )
+            {
+                final String settingKey = profileElement.getAttributeValue( "setting" );
+                if ( settingKey != null )
+                {
+                    return password.pwm.config.PwmSetting.forKey( settingKey );
                 }
             }
-            if (nested) {
+            if ( nested )
+            {
                 nextCategory = nextCategory.getParent();
-            } else {
+            }
+            else
+            {
                 nextCategory = null;
             }
         }
@@ -306,92 +338,115 @@ public enum PwmSettingCategory {
         return null;
     }
 
-    public List<password.pwm.config.PwmSetting> getSettings() {
+    public List<password.pwm.config.PwmSetting> getSettings( )
+    {
         final List<password.pwm.config.PwmSetting> returnList = new ArrayList<>();
-        for (final password.pwm.config.PwmSetting setting : password.pwm.config.PwmSetting.values()) {
-            if (setting.getCategory() == this) {
-                returnList.add(setting);
+        for ( final password.pwm.config.PwmSetting setting : password.pwm.config.PwmSetting.values() )
+        {
+            if ( setting.getCategory() == this )
+            {
+                returnList.add( setting );
             }
         }
-        return Collections.unmodifiableList(returnList);
+        return Collections.unmodifiableList( returnList );
     }
 
     public String toMenuLocationDebug(
             final String profileID,
             final Locale locale
-    ) {
-        return toMenuLocationDebug(this, profileID, locale);
+    )
+    {
+        return toMenuLocationDebug( this, profileID, locale );
     }
 
     private static String toMenuLocationDebug(
             final PwmSettingCategory category,
             final String profileID,
             final Locale locale
-    ) {
+    )
+    {
 
         final String parentValue = category.getParent() == null
                 ? ""
-                : toMenuLocationDebug(category.getParent(), profileID, locale);
+                : toMenuLocationDebug( category.getParent(), profileID, locale );
 
-        final String SEPARATOR = LocaleHelper.getLocalizedMessage(locale, Config.Display_SettingNavigationSeparator, null);
+        final String separator = LocaleHelper.getLocalizedMessage( locale, Config.Display_SettingNavigationSeparator, null );
         final StringBuilder sb = new StringBuilder();
 
-        if (!parentValue.isEmpty()) {
-            sb.append(parentValue);
-            sb.append(SEPARATOR);
+        if ( !parentValue.isEmpty() )
+        {
+            sb.append( parentValue );
+            sb.append( separator );
         }
 
-        sb.append(category.getLabel(locale));
+        sb.append( category.getLabel( locale ) );
 
-        if (category.isTopLevelProfile()) {
-            sb.append(SEPARATOR);
-            if (profileID != null) {
-                sb.append(profileID);
-            } else {
-                sb.append(LocaleHelper.getLocalizedMessage(locale, Config.Display_SettingNavigationNullProfile, null));
+        if ( category.isTopLevelProfile() )
+        {
+            sb.append( separator );
+            if ( profileID != null )
+            {
+                sb.append( profileID );
+            }
+            else
+            {
+                sb.append( LocaleHelper.getLocalizedMessage( locale, Config.Display_SettingNavigationNullProfile, null ) );
             }
         }
 
         return sb.toString();
     }
 
-    public static List<PwmSettingCategory> sortedValues(final Locale locale) {
-        if (cached_sortedSettings == null) {
-            int counter = 0; // prevents dupes from being eliminated;
+    public static List<PwmSettingCategory> sortedValues( final Locale locale )
+    {
+        if ( cachedSortedSettings == null )
+        {
+            // prevents dupes from being eliminated;
+            int counter = 0;
+
             final Map<String, PwmSettingCategory> sortedCategories = new TreeMap<>();
-            for (final PwmSettingCategory category : PwmSettingCategory.values()) {
-                final String sortValue = category.toMenuLocationDebug(null, locale) + (counter++);
-                sortedCategories.put(sortValue, category);
+            for ( final PwmSettingCategory category : PwmSettingCategory.values() )
+            {
+                final String sortValue = category.toMenuLocationDebug( null, locale ) + ( counter++ );
+                sortedCategories.put( sortValue, category );
             }
-            cached_sortedSettings = Collections.unmodifiableList(new ArrayList<>(sortedCategories.values()));
+            cachedSortedSettings = Collections.unmodifiableList( new ArrayList<>( sortedCategories.values() ) );
         }
-        return cached_sortedSettings;
+        return cachedSortedSettings;
     }
 
-    public static List<PwmSettingCategory> valuesForReferenceDoc(final Locale locale) {
-        final List<PwmSettingCategory> values = new ArrayList<>(sortedValues(locale));
-        for (final Iterator<PwmSettingCategory> iterator = values.iterator(); iterator.hasNext(); ) {
+    public static List<PwmSettingCategory> valuesForReferenceDoc( final Locale locale )
+    {
+        final List<PwmSettingCategory> values = new ArrayList<>( sortedValues( locale ) );
+        for ( final Iterator<PwmSettingCategory> iterator = values.iterator(); iterator.hasNext(); )
+        {
             final PwmSettingCategory category = iterator.next();
-            if (category.isHidden()) {
+            if ( category.isHidden() )
+            {
                 iterator.remove();
-            } else if (category.getSettings().isEmpty()) {
+            }
+            else if ( category.getSettings().isEmpty() )
+            {
                 iterator.remove();
             }
         }
-        return Collections.unmodifiableList(values);
+        return Collections.unmodifiableList( values );
     }
 
-    public static Collection<PwmSettingCategory> associatedProfileCategories(final PwmSettingCategory inputCategory) {
+    public static Collection<PwmSettingCategory> associatedProfileCategories( final PwmSettingCategory inputCategory )
+    {
         final Collection<PwmSettingCategory> returnValues = new ArrayList<>();
-        if (inputCategory != null && inputCategory.hasProfiles()) {
+        if ( inputCategory != null && inputCategory.hasProfiles() )
+        {
             PwmSettingCategory topLevelCategory = inputCategory;
-            while (!topLevelCategory.isTopLevelProfile()) {
+            while ( !topLevelCategory.isTopLevelProfile() )
+            {
                 topLevelCategory = topLevelCategory.getParent();
             }
-            returnValues.add(topLevelCategory);
-            returnValues.addAll(topLevelCategory.getChildCategories());
+            returnValues.add( topLevelCategory );
+            returnValues.addAll( topLevelCategory.getChildCategories() );
         }
 
-        return Collections.unmodifiableCollection(returnValues);
+        return Collections.unmodifiableCollection( returnValues );
     }
 }

+ 2 - 1
server/src/main/java/password/pwm/config/PwmSettingFlag.java

@@ -25,7 +25,8 @@ package password.pwm.config;
 /**
  * Flags defined for {@link PwmSetting} values.  Flags typically correspond to one or more {@link PwmSettingSyntax} types.
  */
-public enum PwmSettingFlag {
+public enum PwmSettingFlag
+{
     /* Marker to indicate in setting UI and generated docs that setting supports macros */
     MacroSupport,
 

+ 2 - 1
server/src/main/java/password/pwm/config/PwmSettingProperty.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config;
 
-public enum PwmSettingProperty {
+public enum PwmSettingProperty
+{
 
     ModificationWarning,
 

+ 31 - 30
server/src/main/java/password/pwm/config/PwmSettingSyntax.java

@@ -48,42 +48,43 @@ import password.pwm.config.value.X509CertificateValue;
  * methods for marshaling to and from XML and JSON formats.  For user-facing syntactical differences in format, see the
  * {@link PwmSetting#getRegExPattern()} or use a {@link PwmSettingFlag} type.
  */
-public enum PwmSettingSyntax {
-    STRING(StringValue.factory()),
-    USER_PERMISSION(UserPermissionValue.factory()),
-    STRING_ARRAY(StringArrayValue.factory()),
-    TEXT_AREA(StringValue.factory()),
-    LOCALIZED_STRING(LocalizedStringValue.factory()),
-    LOCALIZED_TEXT_AREA(LocalizedStringValue.factory()),
-    LOCALIZED_STRING_ARRAY(LocalizedStringArrayValue.factory()),
-    PASSWORD(PasswordValue.factory()),
-    NUMERIC(NumericValue.factory()),
-    DURATION(NumericValue.factory()),
-    BOOLEAN(BooleanValue.factory()),
-    SELECT(StringValue.factory()),
-    FORM(FormValue.factory()),
-    ACTION(ActionValue.factory()),
-    EMAIL(EmailValue.factory()),
-    X509CERT(X509CertificateValue.factory()),
-    CHALLENGE(ChallengeValue.factory()),
-    OPTIONLIST(OptionListValue.factory()),
-    FILE(FileValue.factory()),
-    PROFILE(StringArrayValue.factory()),
-    VERIFICATION_METHOD(VerificationMethodValue.factory()),
-    PRIVATE_KEY(PrivateKeyValue.factory()),
-    NAMED_SECRET(NamedSecretValue.factory()),
-    CUSTOMLINKS(CustomLinkValue.factory()),
-    REMOTE_WEB_SERVICE(RemoteWebServiceValue.factory()),
-
-    ;
+public enum PwmSettingSyntax
+{
+    STRING( StringValue.factory() ),
+    USER_PERMISSION( UserPermissionValue.factory() ),
+    STRING_ARRAY( StringArrayValue.factory() ),
+    TEXT_AREA( StringValue.factory() ),
+    LOCALIZED_STRING( LocalizedStringValue.factory() ),
+    LOCALIZED_TEXT_AREA( LocalizedStringValue.factory() ),
+    LOCALIZED_STRING_ARRAY( LocalizedStringArrayValue.factory() ),
+    PASSWORD( PasswordValue.factory() ),
+    NUMERIC( NumericValue.factory() ),
+    DURATION( NumericValue.factory() ),
+    BOOLEAN( BooleanValue.factory() ),
+    SELECT( StringValue.factory() ),
+    FORM( FormValue.factory() ),
+    ACTION( ActionValue.factory() ),
+    EMAIL( EmailValue.factory() ),
+    X509CERT( X509CertificateValue.factory() ),
+    CHALLENGE( ChallengeValue.factory() ),
+    OPTIONLIST( OptionListValue.factory() ),
+    FILE( FileValue.factory() ),
+    PROFILE( StringArrayValue.factory() ),
+    VERIFICATION_METHOD( VerificationMethodValue.factory() ),
+    PRIVATE_KEY( PrivateKeyValue.factory() ),
+    NAMED_SECRET( NamedSecretValue.factory() ),
+    CUSTOMLINKS( CustomLinkValue.factory() ),
+    REMOTE_WEB_SERVICE( RemoteWebServiceValue.factory() ),;
 
     private StoredValue.StoredValueFactory storedValueImpl;
 
-    PwmSettingSyntax(final StoredValue.StoredValueFactory storedValueImpl) {
+    PwmSettingSyntax( final StoredValue.StoredValueFactory storedValueImpl )
+    {
         this.storedValueImpl = storedValueImpl;
     }
 
-    public StoredValue.StoredValueFactory getStoredValueImpl() {
+    public StoredValue.StoredValueFactory getStoredValueImpl( )
+    {
         return storedValueImpl;
     }
 }

+ 40 - 34
server/src/main/java/password/pwm/config/PwmSettingTemplate.java

@@ -26,60 +26,65 @@ import org.jdom2.Attribute;
 import org.jdom2.Element;
 import password.pwm.util.java.JavaHelper;
 
-public enum PwmSettingTemplate {
-    NOVL(Type.LDAP_VENDOR),
-    AD(Type.LDAP_VENDOR),
-    ORACLE_DS(Type.LDAP_VENDOR),
-    DEFAULT(Type.LDAP_VENDOR),
-    NOVL_IDM(Type.LDAP_VENDOR),
-    OPEN_LDAP(Type.LDAP_VENDOR),
-
-    LOCALDB(Type.STORAGE),
-    DB(Type.STORAGE),
-    LDAP(Type.STORAGE),
-
-    DB_ORACLE(Type.DB_VENDOR),
-    DB_OTHER(Type.DB_VENDOR),
-
-    ;
+public enum PwmSettingTemplate
+{
+    NOVL( Type.LDAP_VENDOR ),
+    AD( Type.LDAP_VENDOR ),
+    ORACLE_DS( Type.LDAP_VENDOR ),
+    DEFAULT( Type.LDAP_VENDOR ),
+    NOVL_IDM( Type.LDAP_VENDOR ),
+    OPEN_LDAP( Type.LDAP_VENDOR ),
+
+    LOCALDB( Type.STORAGE ),
+    DB( Type.STORAGE ),
+    LDAP( Type.STORAGE ),
+
+    DB_ORACLE( Type.DB_VENDOR ),
+    DB_OTHER( Type.DB_VENDOR ),;
 
     private final Type type;
 
-    PwmSettingTemplate(final Type type) {
+    PwmSettingTemplate( final Type type )
+    {
         this.type = type;
     }
 
-    public Type getType() {
+    public Type getType( )
+    {
         return type;
     }
 
-    public static PwmSettingTemplate templateForString(final String input, final Type type) {
-        final PwmSettingTemplate template = JavaHelper.readEnumFromString(PwmSettingTemplate.class, type.getDefaultValue(), input);
+    public static PwmSettingTemplate templateForString( final String input, final Type type )
+    {
+        final PwmSettingTemplate template = JavaHelper.readEnumFromString( PwmSettingTemplate.class, type.getDefaultValue(), input );
         return template == null || template.getType() != type ? type.getDefaultValue() : template;
     }
 
-    public boolean isHidden() {
-        final Element templateElement = readTemplateElement(this);
-        final Attribute requiredAttribute = templateElement.getAttribute("hidden");
-        return requiredAttribute != null && "true".equalsIgnoreCase(requiredAttribute.getValue());
+    public boolean isHidden( )
+    {
+        final Element templateElement = readTemplateElement( this );
+        final Attribute requiredAttribute = templateElement.getAttribute( "hidden" );
+        return requiredAttribute != null && "true".equalsIgnoreCase( requiredAttribute.getValue() );
     }
 
-    private static Element readTemplateElement(final PwmSettingTemplate pwmSettingTemplate) {
-        final Element element = PwmSettingXml.readTemplateXml(pwmSettingTemplate);
-        if (element == null) {
-            throw new IllegalStateException("missing PwmSetting.xml template element for " + pwmSettingTemplate);
+    private static Element readTemplateElement( final PwmSettingTemplate pwmSettingTemplate )
+    {
+        final Element element = PwmSettingXml.readTemplateXml( pwmSettingTemplate );
+        if ( element == null )
+        {
+            throw new IllegalStateException( "missing PwmSetting.xml template element for " + pwmSettingTemplate );
         }
         return element;
     }
 
-    public enum Type {
+    public enum Type
+    {
         LDAP_VENDOR,
         STORAGE,
-        DB_VENDOR,
-
-        ;
+        DB_VENDOR,;
 
-        static {
+        static
+        {
             LDAP_VENDOR.defaultValue = DEFAULT;
             STORAGE.defaultValue = LDAP;
             DB_VENDOR.defaultValue = DB_OTHER;
@@ -87,7 +92,8 @@ public enum PwmSettingTemplate {
 
         private PwmSettingTemplate defaultValue;
 
-        public PwmSettingTemplate getDefaultValue() {
+        public PwmSettingTemplate getDefaultValue( )
+        {
             return defaultValue;
         }
     }

+ 25 - 15
server/src/main/java/password/pwm/config/PwmSettingTemplateSet.java

@@ -27,39 +27,49 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
-public class PwmSettingTemplateSet implements Serializable {
+public class PwmSettingTemplateSet implements Serializable
+{
     private final Set<PwmSettingTemplate> templates;
 
-    public PwmSettingTemplateSet(final Set<PwmSettingTemplate> templates) {
+    public PwmSettingTemplateSet( final Set<PwmSettingTemplate> templates )
+    {
         final Set<PwmSettingTemplate> workingSet = new HashSet<>();
 
-        if (templates != null) {
-            for (final PwmSettingTemplate template : templates) {
-                if (template != null) {
-                    workingSet.add(template);
+        if ( templates != null )
+        {
+            for ( final PwmSettingTemplate template : templates )
+            {
+                if ( template != null )
+                {
+                    workingSet.add( template );
                 }
             }
         }
 
         final Set<PwmSettingTemplate.Type> seenTypes = new HashSet<>();
-        for (final PwmSettingTemplate template : workingSet) {
-            seenTypes.add(template.getType());
+        for ( final PwmSettingTemplate template : workingSet )
+        {
+            seenTypes.add( template.getType() );
         }
 
-        for (final PwmSettingTemplate.Type type : PwmSettingTemplate.Type.values()) {
-            if (!seenTypes.contains(type)) {
-                workingSet.add(type.getDefaultValue());
+        for ( final PwmSettingTemplate.Type type : PwmSettingTemplate.Type.values() )
+        {
+            if ( !seenTypes.contains( type ) )
+            {
+                workingSet.add( type.getDefaultValue() );
             }
         }
 
-        this.templates = Collections.unmodifiableSet(workingSet);
+        this.templates = Collections.unmodifiableSet( workingSet );
     }
 
-    public Set<PwmSettingTemplate> getTemplates() {
+    public Set<PwmSettingTemplate> getTemplates( )
+    {
         return templates;
     }
 
-    public static PwmSettingTemplateSet getDefault() {
-        return new PwmSettingTemplateSet(null);
+    public static PwmSettingTemplateSet getDefault( )
+    {
+        return new PwmSettingTemplateSet( null );
     }
 }

+ 64 - 43
server/src/main/java/password/pwm/config/PwmSettingXml.java

@@ -41,9 +41,10 @@ import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
-public class PwmSettingXml {
-    private static final String SETTING_XML_FILENAME = (PwmSetting.class.getPackage().getName() +
-            "." + PwmSetting.class.getSimpleName()).replace(".","/") + ".xml";
+public class PwmSettingXml
+{
+    private static final String SETTING_XML_FILENAME = ( PwmSetting.class.getPackage().getName()
+            + "." + PwmSetting.class.getSimpleName() ).replace( ".", "/" ) + ".xml";
 
     public static final String XML_ELEMENT_LDAP_PERMISSION = "ldapPermission";
     public static final String XML_ELEMENT_EXAMPLE = "example";
@@ -56,82 +57,102 @@ public class PwmSettingXml {
 
     private static Document xmlDocCache;
 
-    private static Document readXml() {
+    private static Document readXml( )
+    {
         final Document docRefCopy = xmlDocCache;
-        if (docRefCopy == null) {
+        if ( docRefCopy == null )
+        {
             //validateXmlSchema();
-            final InputStream inputStream = PwmSetting.class.getClassLoader().getResourceAsStream(SETTING_XML_FILENAME);
+            final InputStream inputStream = PwmSetting.class.getClassLoader().getResourceAsStream( SETTING_XML_FILENAME );
             final SAXBuilder builder = new SAXBuilder();
-            try {
-                final Document newDoc = builder.build(inputStream);
+            try
+            {
+                final Document newDoc = builder.build( inputStream );
                 xmlDocCache = newDoc;
 
                 // clear cached dom after 30 seconds.
-                final Thread t = new Thread("PwmSettingXml static cache clear thread") {
+                final Thread t = new Thread( "PwmSettingXml static cache clear thread" )
+                {
                     @Override
-                    public void run() {
-                        JavaHelper.pause(30 * 1000);
+                    public void run( )
+                    {
+                        JavaHelper.pause( 30 * 1000 );
                         xmlDocCache = null;
                     }
                 };
-                t.setDaemon(true);
+                t.setDaemon( true );
                 t.start();
 
                 return newDoc;
-            } catch (JDOMException e) {
-                throw new IllegalStateException("error parsing " + SETTING_XML_FILENAME + ": " + e.getMessage());
-            } catch (IOException e) {
-                throw new IllegalStateException("unable to load " + SETTING_XML_FILENAME + ": " + e.getMessage());
+            }
+            catch ( JDOMException e )
+            {
+                throw new IllegalStateException( "error parsing " + SETTING_XML_FILENAME + ": " + e.getMessage() );
+            }
+            catch ( IOException e )
+            {
+                throw new IllegalStateException( "unable to load " + SETTING_XML_FILENAME + ": " + e.getMessage() );
             }
 
         }
         return docRefCopy;
     }
 
-    private static void validateXmlSchema() {
-        try {
-            final InputStream xsdInputStream = PwmSetting.class.getClassLoader().getResourceAsStream("password/pwm/config/PwmSetting.xsd");
-            final InputStream xmlInputStream = PwmSetting.class.getClassLoader().getResourceAsStream("password/pwm/config/PwmSetting.xml");
-            final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-            final Schema schema = factory.newSchema(new StreamSource(xsdInputStream));
+    private static void validateXmlSchema( )
+    {
+        try
+        {
+            final InputStream xsdInputStream = PwmSetting.class.getClassLoader().getResourceAsStream( "password/pwm/config/PwmSetting.xsd" );
+            final InputStream xmlInputStream = PwmSetting.class.getClassLoader().getResourceAsStream( "password/pwm/config/PwmSetting.xml" );
+            final SchemaFactory factory = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI );
+            final Schema schema = factory.newSchema( new StreamSource( xsdInputStream ) );
             final Validator validator = schema.newValidator();
-            validator.validate(new StreamSource(xmlInputStream));
-        } catch (Exception e) {
-            throw new IllegalStateException("error validating PwmSetting.xml schema using PwmSetting.xsd definition: " + e.getMessage());
+            validator.validate( new StreamSource( xmlInputStream ) );
+        }
+        catch ( Exception e )
+        {
+            throw new IllegalStateException( "error validating PwmSetting.xml schema using PwmSetting.xsd definition: " + e.getMessage() );
         }
     }
 
-    static Element readSettingXml(final PwmSetting setting) {
+    static Element readSettingXml( final PwmSetting setting )
+    {
         final XPathFactory xpfac = XPathFactory.instance();
-        final XPathExpression xp = xpfac.compile("/settings/setting[@key=\"" + setting.getKey() + "\"]");
-        return (Element)xp.evaluateFirst(readXml());
+        final XPathExpression xp = xpfac.compile( "/settings/setting[@key=\"" + setting.getKey() + "\"]" );
+        return ( Element ) xp.evaluateFirst( readXml() );
     }
 
-    static Element readCategoryXml(final PwmSettingCategory category) {
+    static Element readCategoryXml( final PwmSettingCategory category )
+    {
         final XPathFactory xpfac = XPathFactory.instance();
-        final XPathExpression xp = xpfac.compile("/settings/category[@key=\"" + category.toString() + "\"]");
-        return (Element)xp.evaluateFirst(readXml());
+        final XPathExpression xp = xpfac.compile( "/settings/category[@key=\"" + category.toString() + "\"]" );
+        return ( Element ) xp.evaluateFirst( readXml() );
     }
 
-    static Element readTemplateXml(final PwmSettingTemplate template) {
+    static Element readTemplateXml( final PwmSettingTemplate template )
+    {
         final XPathFactory xpfac = XPathFactory.instance();
-        final XPathExpression xp = xpfac.compile("/settings/template[@key=\"" + template.toString() + "\"]");
-        return (Element)xp.evaluateFirst(readXml());
+        final XPathExpression xp = xpfac.compile( "/settings/template[@key=\"" + template.toString() + "\"]" );
+        return ( Element ) xp.evaluateFirst( readXml() );
     }
 
-    static Set<PwmSettingTemplate> parseTemplateAttribute(final Element element) {
-        if (element == null) {
+    static Set<PwmSettingTemplate> parseTemplateAttribute( final Element element )
+    {
+        if ( element == null )
+        {
             return Collections.emptySet();
         }
-        final String templateStrValues = element.getAttributeValue("template");
+        final String templateStrValues = element.getAttributeValue( "template" );
         final String[] templateSplitValues = templateStrValues == null
-                ? new String[0]
-                : templateStrValues.split(",");
+                ? new String[ 0 ]
+                : templateStrValues.split( "," );
         final Set<PwmSettingTemplate> definedTemplates = new LinkedHashSet<>();
-        for (final String templateStrValue : templateSplitValues) {
-            final PwmSettingTemplate template = PwmSettingTemplate.valueOf(templateStrValue);
-            if (template != null) {
-                definedTemplates.add(template);
+        for ( final String templateStrValue : templateSplitValues )
+        {
+            final PwmSettingTemplate template = PwmSettingTemplate.valueOf( templateStrValue );
+            if ( template != null )
+            {
+                definedTemplates.add( template );
             }
         }
         return definedTemplates;

+ 13 - 12
server/src/main/java/password/pwm/config/SettingReader.java

@@ -31,26 +31,27 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Set;
 
-public interface SettingReader {
-    List<String> readSettingAsStringArray(PwmSetting setting);
+public interface SettingReader
+{
+    List<String> readSettingAsStringArray( PwmSetting setting );
 
-    List<FormConfiguration> readSettingAsForm(PwmSetting pwmSetting);
+    List<FormConfiguration> readSettingAsForm( PwmSetting pwmSetting );
 
-    <E extends Enum<E>> Set<E> readSettingAsOptionList(PwmSetting setting, Class<E> enumClass);
+    <E extends Enum<E>> Set<E> readSettingAsOptionList( PwmSetting setting, Class<E> enumClass );
 
-    <E extends Enum<E>> E readSettingAsEnum(PwmSetting setting, Class<E> enumClass);
+    <E extends Enum<E>> E readSettingAsEnum( PwmSetting setting, Class<E> enumClass );
 
-    List<X509Certificate> readSettingAsCertificate(PwmSetting setting);
+    List<X509Certificate> readSettingAsCertificate( PwmSetting setting );
 
-    boolean readSettingAsBoolean(PwmSetting setting);
+    boolean readSettingAsBoolean( PwmSetting setting );
 
-    long readSettingAsLong(PwmSetting setting);
+    long readSettingAsLong( PwmSetting setting );
 
-    String readSettingAsLocalizedString(PwmSetting setting, Locale locale);
+    String readSettingAsLocalizedString( PwmSetting setting, Locale locale );
 
-    List<ActionConfiguration> readSettingAsAction(PwmSetting setting);
+    List<ActionConfiguration> readSettingAsAction( PwmSetting setting );
 
-    PasswordData readSettingAsPassword(PwmSetting setting);
+    PasswordData readSettingAsPassword( PwmSetting setting );
 
-    String readSettingAsString(PwmSetting oauthIdLoginUrl);
+    String readSettingAsString( PwmSetting oauthIdLoginUrl );
 }

+ 3 - 2
server/src/main/java/password/pwm/config/SettingUIFunction.java

@@ -27,9 +27,10 @@ import password.pwm.http.PwmRequest;
 
 import java.io.Serializable;
 
-public interface SettingUIFunction {
+public interface SettingUIFunction
+{
     Serializable provideFunction(
-             PwmRequest pwmRequest,
+            PwmRequest pwmRequest,
             StoredConfigurationImpl storedConfiguration,
             PwmSetting setting,
             String profile,

+ 14 - 12
server/src/main/java/password/pwm/config/StoredValue.java

@@ -31,27 +31,29 @@ import java.io.Serializable;
 import java.util.List;
 import java.util.Locale;
 
-public interface StoredValue extends Serializable {
-    List<Element> toXmlValues( String valueElementName);
+public interface StoredValue extends Serializable
+{
+    List<Element> toXmlValues( String valueElementName );
 
-    Object toNativeObject();
+    Object toNativeObject( );
 
-    List<String> validateValue(PwmSetting pwm);
+    List<String> validateValue( PwmSetting pwm );
 
-    Serializable toDebugJsonObject(Locale locale);
+    Serializable toDebugJsonObject( Locale locale );
 
-    String toDebugString(Locale locale);
+    String toDebugString( Locale locale );
 
-    boolean requiresStoredUpdate();
+    boolean requiresStoredUpdate( );
 
-    int currentSyntaxVersion();
+    int currentSyntaxVersion( );
 
-    interface StoredValueFactory {
-        StoredValue fromJson( String input);
+    interface StoredValueFactory
+    {
+        StoredValue fromJson( String input );
 
-        StoredValue fromXmlElement( Element settingElement,  PwmSecurityKey key)
+        StoredValue fromXmlElement( Element settingElement, PwmSecurityKey key )
                 throws PwmException;
     }
 
-    String valueHash() throws PwmUnrecoverableException;
+    String valueHash( ) throws PwmUnrecoverableException;
 }

+ 23 - 17
server/src/main/java/password/pwm/config/function/AbstractUriCertImportFunction.java

@@ -40,7 +40,8 @@ import java.net.URI;
 import java.security.cert.X509Certificate;
 import java.util.List;
 
-abstract class AbstractUriCertImportFunction implements SettingUIFunction {
+abstract class AbstractUriCertImportFunction implements SettingUIFunction
+{
 
     @Override
     public String provideFunction(
@@ -48,36 +49,41 @@ abstract class AbstractUriCertImportFunction implements SettingUIFunction {
             final StoredConfigurationImpl storedConfiguration,
             final PwmSetting setting,
             final String profile,
-            final String extraData)
+            final String extraData )
             throws PwmOperationalException, PwmUnrecoverableException
     {
         final PwmSession pwmSession = pwmRequest.getPwmSession();
         final List<X509Certificate> certs;
 
-        final String urlString = getUri(storedConfiguration, setting, profile, extraData);
-            try {
-                certs = X509Utils.readRemoteCertificates(URI.create(urlString));
-            } catch (Exception e) {
-                if (e instanceof PwmException) {
-                    throw new PwmOperationalException(((PwmException) e).getErrorInformation());
-                }
-                final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,"error importing certificates: " + e.getMessage());
-                throw new PwmOperationalException(errorInformation);
+        final String urlString = getUri( storedConfiguration, setting, profile, extraData );
+        try
+        {
+            certs = X509Utils.readRemoteCertificates( URI.create( urlString ) );
+        }
+        catch ( Exception e )
+        {
+            if ( e instanceof PwmException )
+            {
+                throw new PwmOperationalException( ( ( PwmException ) e ).getErrorInformation() );
             }
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.CONFIG_FORMAT_ERROR, "error importing certificates: " + e.getMessage() );
+            throw new PwmOperationalException( errorInformation );
+        }
 
 
         final UserIdentity userIdentity = pwmSession.isAuthenticated() ? pwmSession.getUserInfo().getUserIdentity() : null;
-        store(certs, storedConfiguration, setting, profile, extraData, userIdentity);
+        store( certs, storedConfiguration, setting, profile, extraData, userIdentity );
 
         final StringBuffer returnStr = new StringBuffer();
-        for (final X509Certificate loopCert : certs) {
-            returnStr.append(X509Utils.makeDebugText(loopCert));
-            returnStr.append("\n\n");
+        for ( final X509Certificate loopCert : certs )
+        {
+            returnStr.append( X509Utils.makeDebugText( loopCert ) );
+            returnStr.append( "\n\n" );
         }
         return returnStr.toString();
     }
 
-    abstract String getUri(StoredConfigurationImpl storedConfiguration,  PwmSetting pwmSetting,  String profile,  String extraData) throws PwmOperationalException;
+    abstract String getUri( StoredConfigurationImpl storedConfiguration, PwmSetting pwmSetting, String profile, String extraData ) throws PwmOperationalException;
 
 
     void store(
@@ -90,7 +96,7 @@ abstract class AbstractUriCertImportFunction implements SettingUIFunction {
     )
             throws PwmOperationalException, PwmUnrecoverableException
     {
-        storedConfiguration.writeSetting(pwmSetting, profile, new X509CertificateValue(certs), userIdentity);
+        storedConfiguration.writeSetting( pwmSetting, profile, new X509CertificateValue( certs ), userIdentity );
     }
 
 

+ 41 - 25
server/src/main/java/password/pwm/config/function/ActionCertImportFunction.java

@@ -23,10 +23,10 @@
 package password.pwm.config.function;
 
 import password.pwm.bean.UserIdentity;
-import password.pwm.config.value.data.ActionConfiguration;
 import password.pwm.config.PwmSetting;
 import password.pwm.config.stored.StoredConfigurationImpl;
 import password.pwm.config.value.ActionValue;
+import password.pwm.config.value.data.ActionConfiguration;
 import password.pwm.error.ErrorInformation;
 import password.pwm.error.PwmError;
 import password.pwm.error.PwmOperationalException;
@@ -38,29 +38,41 @@ import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.List;
 
-public class ActionCertImportFunction extends AbstractUriCertImportFunction {
+public class ActionCertImportFunction extends AbstractUriCertImportFunction
+{
 
     @Override
-    String getUri(final StoredConfigurationImpl storedConfiguration, final PwmSetting pwmSetting, final String profile, final String extraData) throws PwmOperationalException {
-        final ActionValue actionValue = (ActionValue)storedConfiguration.readSetting(pwmSetting, profile);
-        final String actionName = actionNameFromExtraData(extraData);
-        final ActionConfiguration action =  actionValue.forName(actionName);
+    String getUri( final StoredConfigurationImpl storedConfiguration, final PwmSetting pwmSetting, final String profile, final String extraData ) throws PwmOperationalException
+    {
+        final ActionValue actionValue = ( ActionValue ) storedConfiguration.readSetting( pwmSetting, profile );
+        final String actionName = actionNameFromExtraData( extraData );
+        final ActionConfiguration action = actionValue.forName( actionName );
         final String uriString = action.getUrl();
 
-        if (uriString == null || uriString.isEmpty()) {
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,"Setting " + pwmSetting.toMenuLocationDebug(profile, null) + " action " + actionName + " must first be configured");
-            throw new PwmOperationalException(errorInformation);
+        if ( uriString == null || uriString.isEmpty() )
+        {
+            final ErrorInformation errorInformation = new ErrorInformation(
+                    PwmError.CONFIG_FORMAT_ERROR,
+                    "Setting " + pwmSetting.toMenuLocationDebug( profile, null )
+                            + " action " + actionName + " must first be configured" );
+            throw new PwmOperationalException( errorInformation );
         }
-        try {
-            URI.create(uriString);
-        } catch (IllegalArgumentException e) {
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,"Setting " + pwmSetting.toMenuLocationDebug(profile, null) + " action " + actionName + " has an invalid URL syntax");
-            throw new PwmOperationalException(errorInformation);
+        try
+        {
+            URI.create( uriString );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            final ErrorInformation errorInformation = new ErrorInformation(
+                    PwmError.CONFIG_FORMAT_ERROR, "Setting "
+                    + pwmSetting.toMenuLocationDebug( profile, null ) + " action " + actionName + " has an invalid URL syntax" );
+            throw new PwmOperationalException( errorInformation );
         }
         return uriString;
     }
 
-    private String actionNameFromExtraData(final String extraData) {
+    private String actionNameFromExtraData( final String extraData )
+    {
         return extraData;
     }
 
@@ -74,19 +86,23 @@ public class ActionCertImportFunction extends AbstractUriCertImportFunction {
     )
             throws PwmOperationalException, PwmUnrecoverableException
     {
-        final ActionValue actionValue = (ActionValue)storedConfiguration.readSetting(pwmSetting, profile);
-        final String actionName = actionNameFromExtraData(extraData);
+        final ActionValue actionValue = ( ActionValue ) storedConfiguration.readSetting( pwmSetting, profile );
+        final String actionName = actionNameFromExtraData( extraData );
         final List<ActionConfiguration> newList = new ArrayList<>();
-        for (final ActionConfiguration loopConfiguration : actionValue.toNativeObject()) {
-            if (actionName.equals(loopConfiguration.getName())) {
-                final ActionConfiguration newConfig = loopConfiguration.copyWithNewCertificate(certs);
-                newList.add(newConfig);
-            } else {
-                newList.add(JsonUtil.cloneUsingJson(loopConfiguration,ActionConfiguration.class));
+        for ( final ActionConfiguration loopConfiguration : actionValue.toNativeObject() )
+        {
+            if ( actionName.equals( loopConfiguration.getName() ) )
+            {
+                final ActionConfiguration newConfig = loopConfiguration.copyWithNewCertificate( certs );
+                newList.add( newConfig );
+            }
+            else
+            {
+                newList.add( JsonUtil.cloneUsingJson( loopConfiguration, ActionConfiguration.class ) );
             }
         }
-        final ActionValue newActionValue = new ActionValue(newList);
-        storedConfiguration.writeSetting(pwmSetting, profile, newActionValue, userIdentity);
+        final ActionValue newActionValue = new ActionValue( newList );
+        storedConfiguration.writeSetting( pwmSetting, profile, newActionValue, userIdentity );
     }
 
 }

+ 27 - 18
server/src/main/java/password/pwm/config/function/LdapCertImportFunction.java

@@ -45,7 +45,8 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
-public class LdapCertImportFunction implements SettingUIFunction {
+public class LdapCertImportFunction implements SettingUIFunction
+{
 
     @Override
     public String provideFunction(
@@ -53,34 +54,42 @@ public class LdapCertImportFunction implements SettingUIFunction {
             final StoredConfigurationImpl storedConfiguration,
             final PwmSetting setting,
             final String profile,
-            final String extraData)
-            throws PwmOperationalException, PwmUnrecoverableException {
+            final String extraData )
+            throws PwmOperationalException, PwmUnrecoverableException
+    {
         final PwmApplication pwmApplication = pwmRequest.getPwmApplication();
         final PwmSession pwmSession = pwmRequest.getPwmSession();
 
-        final StringArrayValue ldapUrlsValue = (StringArrayValue)storedConfiguration.readSetting(PwmSetting.LDAP_SERVER_URLS,profile);
+        final StringArrayValue ldapUrlsValue = ( StringArrayValue ) storedConfiguration.readSetting( PwmSetting.LDAP_SERVER_URLS, profile );
         final Set<X509Certificate> resultCertificates = new LinkedHashSet<>();
-        try {
-            if (ldapUrlsValue != null && ldapUrlsValue.toNativeObject() != null) {
+        try
+        {
+            if ( ldapUrlsValue != null && ldapUrlsValue.toNativeObject() != null )
+            {
                 final List<String> ldapUrlStrings = ldapUrlsValue.toNativeObject();
-                for (final String ldapUrlString : ldapUrlStrings) {
-                    final URI ldapURI = new URI(ldapUrlString);
-                    final List<X509Certificate> certs = X509Utils.readRemoteCertificates(ldapURI);
-                    if (certs != null) {
-                        resultCertificates.addAll(certs);
+                for ( final String ldapUrlString : ldapUrlStrings )
+                {
+                    final URI ldapURI = new URI( ldapUrlString );
+                    final List<X509Certificate> certs = X509Utils.readRemoteCertificates( ldapURI );
+                    if ( certs != null )
+                    {
+                        resultCertificates.addAll( certs );
                     }
                 }
             }
-        } catch (Exception e) {
-            if (e instanceof PwmException) {
-                throw new PwmOperationalException(((PwmException) e).getErrorInformation());
+        }
+        catch ( Exception e )
+        {
+            if ( e instanceof PwmException )
+            {
+                throw new PwmOperationalException( ( ( PwmException ) e ).getErrorInformation() );
             }
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_UNKNOWN,"error importing certificates: " + e.getMessage());
-            throw new PwmOperationalException(errorInformation);
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_UNKNOWN, "error importing certificates: " + e.getMessage() );
+            throw new PwmOperationalException( errorInformation );
         }
 
         final UserIdentity userIdentity = pwmSession.isAuthenticated() ? pwmSession.getUserInfo().getUserIdentity() : null;
-        storedConfiguration.writeSetting(setting, profile, new X509CertificateValue(resultCertificates), userIdentity);
-        return Message.getLocalizedMessage(pwmSession.getSessionStateBean().getLocale(), Message.Success_Unknown, pwmApplication.getConfig());
+        storedConfiguration.writeSetting( setting, profile, new X509CertificateValue( resultCertificates ), userIdentity );
+        return Message.getLocalizedMessage( pwmSession.getSessionStateBean().getLocale(), Message.Success_Unknown, pwmApplication.getConfig() );
     }
 }

+ 23 - 16
server/src/main/java/password/pwm/config/function/OAuthCertImportFunction.java

@@ -32,41 +32,48 @@ import password.pwm.util.java.JavaHelper;
 
 import java.net.URI;
 
-public class OAuthCertImportFunction extends AbstractUriCertImportFunction {
+public class OAuthCertImportFunction extends AbstractUriCertImportFunction
+{
 
 
     @Override
-    String getUri(final StoredConfigurationImpl storedConfiguration, final PwmSetting pwmSetting, final String profile, final String extraData) throws PwmOperationalException {
+    String getUri( final StoredConfigurationImpl storedConfiguration, final PwmSetting pwmSetting, final String profile, final String extraData ) throws PwmOperationalException
+    {
 
         final String uriString;
         final String menuDebugLocation;
 
-        switch (pwmSetting) {
+        switch ( pwmSetting )
+        {
             case OAUTH_ID_CERTIFICATE:
-                uriString = (String)storedConfiguration.readSetting(PwmSetting.OAUTH_ID_CODERESOLVE_URL).toNativeObject();
-                menuDebugLocation = PwmSetting.OAUTH_ID_CODERESOLVE_URL.toMenuLocationDebug(null, PwmConstants.DEFAULT_LOCALE);
+                uriString = ( String ) storedConfiguration.readSetting( PwmSetting.OAUTH_ID_CODERESOLVE_URL ).toNativeObject();
+                menuDebugLocation = PwmSetting.OAUTH_ID_CODERESOLVE_URL.toMenuLocationDebug( null, PwmConstants.DEFAULT_LOCALE );
                 break;
 
             case RECOVERY_OAUTH_ID_CERTIFICATE:
-                uriString = (String)storedConfiguration.readSetting(PwmSetting.RECOVERY_OAUTH_ID_CODERESOLVE_URL, profile).toNativeObject();
-                menuDebugLocation = PwmSetting.RECOVERY_OAUTH_ID_CERTIFICATE.toMenuLocationDebug(profile, PwmConstants.DEFAULT_LOCALE);
+                uriString = ( String ) storedConfiguration.readSetting( PwmSetting.RECOVERY_OAUTH_ID_CODERESOLVE_URL, profile ).toNativeObject();
+                menuDebugLocation = PwmSetting.RECOVERY_OAUTH_ID_CERTIFICATE.toMenuLocationDebug( profile, PwmConstants.DEFAULT_LOCALE );
                 break;
 
             default:
-                JavaHelper.unhandledSwitchStatement(pwmSetting);
+                JavaHelper.unhandledSwitchStatement( pwmSetting );
                 return null;
         }
 
 
-        if (uriString.isEmpty()) {
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,"Setting " + menuDebugLocation + " must first be configured");
-            throw new PwmOperationalException(errorInformation);
+        if ( uriString.isEmpty() )
+        {
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.CONFIG_FORMAT_ERROR, "Setting " + menuDebugLocation + " must first be configured" );
+            throw new PwmOperationalException( errorInformation );
         }
-        try {
-            URI.create(uriString);
-        } catch (IllegalArgumentException e) {
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,"Setting " + menuDebugLocation + " has an invalid URL syntax");
-            throw new PwmOperationalException(errorInformation);
+        try
+        {
+            URI.create( uriString );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.CONFIG_FORMAT_ERROR, "Setting " + menuDebugLocation + " has an invalid URL syntax" );
+            throw new PwmOperationalException( errorInformation );
         }
         return uriString;
     }

+ 48 - 26
server/src/main/java/password/pwm/config/function/RemoteWebServiceCertImportFunction.java

@@ -38,47 +38,69 @@ import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.List;
 
-public class RemoteWebServiceCertImportFunction extends AbstractUriCertImportFunction {
+public class RemoteWebServiceCertImportFunction extends AbstractUriCertImportFunction
+{
 
     @Override
-    String getUri(final StoredConfigurationImpl storedConfiguration, final PwmSetting pwmSetting, final String profile, final String extraData) throws PwmOperationalException {
-        final RemoteWebServiceValue actionValue = (RemoteWebServiceValue)storedConfiguration.readSetting(pwmSetting, profile);
-        final String serviceName = actionNameFromExtraData(extraData);
-        final RemoteWebServiceConfiguration action =  actionValue.forName(serviceName);
+    String getUri( final StoredConfigurationImpl storedConfiguration, final PwmSetting pwmSetting, final String profile, final String extraData ) throws PwmOperationalException
+    {
+        final RemoteWebServiceValue actionValue = ( RemoteWebServiceValue ) storedConfiguration.readSetting( pwmSetting, profile );
+        final String serviceName = actionNameFromExtraData( extraData );
+        final RemoteWebServiceConfiguration action = actionValue.forName( serviceName );
         final String uriString = action.getUrl();
 
-        if (uriString == null || uriString.isEmpty()) {
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,"Setting " + pwmSetting.toMenuLocationDebug(profile, null) + " action " + serviceName + " must first be configured");
-            throw new PwmOperationalException(errorInformation);
+        if ( uriString == null || uriString.isEmpty() )
+        {
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.CONFIG_FORMAT_ERROR,
+                    "Setting " + pwmSetting.toMenuLocationDebug( profile, null ) + " action " + serviceName + " must first be configured" );
+            throw new PwmOperationalException( errorInformation );
         }
-        try {
-            URI.create(uriString);
-        } catch (IllegalArgumentException e) {
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,"Setting " + pwmSetting.toMenuLocationDebug(profile, null) + " action " + serviceName + " has an invalid URL syntax");
-            throw new PwmOperationalException(errorInformation);
+        try
+        {
+            URI.create( uriString );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.CONFIG_FORMAT_ERROR,
+                    "Setting " + pwmSetting.toMenuLocationDebug( profile, null ) + " action " + serviceName + " has an invalid URL syntax" );
+            throw new PwmOperationalException( errorInformation );
         }
         return uriString;
     }
 
-    private String actionNameFromExtraData(final String extraData) {
+    private String actionNameFromExtraData( final String extraData )
+    {
         return extraData;
     }
 
-    void store(final List<X509Certificate> certs, final StoredConfigurationImpl storedConfiguration, final PwmSetting pwmSetting, final String profile, final String extraData, final UserIdentity userIdentity) throws PwmOperationalException, PwmUnrecoverableException {
-        final RemoteWebServiceValue actionValue = (RemoteWebServiceValue)storedConfiguration.readSetting(pwmSetting, profile);
-        final String actionName = actionNameFromExtraData(extraData);
+    void store(
+            final List<X509Certificate> certs,
+            final StoredConfigurationImpl storedConfiguration,
+            final PwmSetting pwmSetting,
+            final String profile,
+            final String extraData,
+            final UserIdentity userIdentity
+    )
+            throws PwmOperationalException, PwmUnrecoverableException
+    {
+        final RemoteWebServiceValue actionValue = ( RemoteWebServiceValue ) storedConfiguration.readSetting( pwmSetting, profile );
+        final String actionName = actionNameFromExtraData( extraData );
         final List<RemoteWebServiceConfiguration> newList = new ArrayList<>();
-        for (final RemoteWebServiceConfiguration loopConfiguration : actionValue.toNativeObject()) {
-            if (actionName.equals(loopConfiguration.getName())) {
-                final RemoteWebServiceConfiguration newConfig = JsonUtil.cloneUsingJson(loopConfiguration, RemoteWebServiceConfiguration.class);
-                newConfig.setCertificates(certs);
-                newList.add(newConfig);
-            } else {
-                newList.add(JsonUtil.cloneUsingJson(loopConfiguration,RemoteWebServiceConfiguration.class));
+        for ( final RemoteWebServiceConfiguration loopConfiguration : actionValue.toNativeObject() )
+        {
+            if ( actionName.equals( loopConfiguration.getName() ) )
+            {
+                final RemoteWebServiceConfiguration newConfig = JsonUtil.cloneUsingJson( loopConfiguration, RemoteWebServiceConfiguration.class );
+                newConfig.setCertificates( certs );
+                newList.add( newConfig );
+            }
+            else
+            {
+                newList.add( JsonUtil.cloneUsingJson( loopConfiguration, RemoteWebServiceConfiguration.class ) );
             }
         }
-        final RemoteWebServiceValue newActionValue = new RemoteWebServiceValue(newList);
-        storedConfiguration.writeSetting(pwmSetting, profile, newActionValue, userIdentity);
+        final RemoteWebServiceValue newActionValue = new RemoteWebServiceValue( newList );
+        storedConfiguration.writeSetting( pwmSetting, profile, newActionValue, userIdentity );
     }
 
 }

+ 36 - 22
server/src/main/java/password/pwm/config/function/SyslogCertImportFunction.java

@@ -44,7 +44,8 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
-public class SyslogCertImportFunction implements SettingUIFunction {
+public class SyslogCertImportFunction implements SettingUIFunction
+{
 
     @Override
     public String provideFunction(
@@ -52,8 +53,9 @@ public class SyslogCertImportFunction implements SettingUIFunction {
             final StoredConfigurationImpl storedConfiguration,
             final PwmSetting setting,
             final String profile,
-            final String extraData)
-            throws PwmOperationalException, PwmUnrecoverableException {
+            final String extraData )
+            throws PwmOperationalException, PwmUnrecoverableException
+    {
         boolean error = false;
         Exception exeception = null;
         final PwmApplication pwmApplication = pwmRequest.getPwmApplication();
@@ -61,19 +63,27 @@ public class SyslogCertImportFunction implements SettingUIFunction {
 
         final Set<X509Certificate> resultCertificates = new LinkedHashSet<>();
 
-        final List<String> syslogConfigStrs = (List<String>)storedConfiguration.readSetting(PwmSetting.AUDIT_SYSLOG_SERVERS).toNativeObject();
-        if (syslogConfigStrs != null && !syslogConfigStrs.isEmpty()) {
-            for(String entry : syslogConfigStrs) {
-                if (entry.toUpperCase().startsWith("TLS")) {
-                    final SyslogAuditService.SyslogConfig syslogConfig = SyslogAuditService.SyslogConfig.fromConfigString(entry);
-                    if (syslogConfig != null) {
-                        try {
-                            final List<X509Certificate> certs = X509Utils.readRemoteCertificates(syslogConfig.getHost(), syslogConfig.getPort());
-                            if (certs != null) {
-                                resultCertificates.addAll(certs);
+        final List<String> syslogConfigStrs = ( List<String> ) storedConfiguration.readSetting( PwmSetting.AUDIT_SYSLOG_SERVERS ).toNativeObject();
+        if ( syslogConfigStrs != null && !syslogConfigStrs.isEmpty() )
+        {
+            for ( String entry : syslogConfigStrs )
+            {
+                if ( entry.toUpperCase().startsWith( "TLS" ) )
+                {
+                    final SyslogAuditService.SyslogConfig syslogConfig = SyslogAuditService.SyslogConfig.fromConfigString( entry );
+                    if ( syslogConfig != null )
+                    {
+                        try
+                        {
+                            final List<X509Certificate> certs = X509Utils.readRemoteCertificates( syslogConfig.getHost(), syslogConfig.getPort() );
+                            if ( certs != null )
+                            {
+                                resultCertificates.addAll( certs );
                                 error = false;
                             }
-                        } catch (Exception e) {
+                        }
+                        catch ( Exception e )
+                        {
                             error = true;
                             exeception = e;
                         }
@@ -82,16 +92,20 @@ public class SyslogCertImportFunction implements SettingUIFunction {
             }
         }
 
-        if (false == error) {
+        if ( !error )
+        {
             final UserIdentity userIdentity = pwmSession.isAuthenticated() ? pwmSession.getUserInfo().getUserIdentity() : null;
-            storedConfiguration.writeSetting(setting, new X509CertificateValue(resultCertificates), userIdentity);
-            return Message.getLocalizedMessage(pwmSession.getSessionStateBean().getLocale(), Message.Success_Unknown, pwmApplication.getConfig());
-        } else {
-            if (exeception instanceof PwmException) {
-                throw new PwmOperationalException(((PwmException) exeception).getErrorInformation());
+            storedConfiguration.writeSetting( setting, new X509CertificateValue( resultCertificates ), userIdentity );
+            return Message.getLocalizedMessage( pwmSession.getSessionStateBean().getLocale(), Message.Success_Unknown, pwmApplication.getConfig() );
+        }
+        else
+        {
+            if ( exeception instanceof PwmException )
+            {
+                throw new PwmOperationalException( ( ( PwmException ) exeception ).getErrorInformation() );
             }
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_UNKNOWN,"error importing certificates: " + exeception.getMessage());
-            throw new PwmOperationalException(errorInformation);
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.ERROR_UNKNOWN, "error importing certificates: " + exeception.getMessage() );
+            throw new PwmOperationalException( errorInformation );
         }
     }
 }

+ 76 - 49
server/src/main/java/password/pwm/config/function/UserMatchViewerFunction.java

@@ -33,8 +33,8 @@ import password.pwm.bean.UserIdentity;
 import password.pwm.config.Configuration;
 import password.pwm.config.PwmSetting;
 import password.pwm.config.SettingUIFunction;
-import password.pwm.config.value.data.UserPermission;
 import password.pwm.config.stored.StoredConfigurationImpl;
+import password.pwm.config.value.data.UserPermission;
 import password.pwm.error.ErrorInformation;
 import password.pwm.error.PwmError;
 import password.pwm.error.PwmOperationalException;
@@ -53,8 +53,9 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
 
-public class UserMatchViewerFunction implements SettingUIFunction {
-    private static final PwmLogger LOGGER = PwmLogger.forClass(UserMatchViewerFunction.class);
+public class UserMatchViewerFunction implements SettingUIFunction
+{
+    private static final PwmLogger LOGGER = PwmLogger.forClass( UserMatchViewerFunction.class );
 
     @Override
     public Serializable provideFunction(
@@ -62,27 +63,27 @@ public class UserMatchViewerFunction implements SettingUIFunction {
             final StoredConfigurationImpl storedConfiguration,
             final PwmSetting setting,
             final String profile,
-            final String extraData)
+            final String extraData )
             throws Exception
     {
         final PwmApplication pwmApplication = pwmRequest.getPwmApplication();
 
         final Date startSearchTime = new Date();
-        final int maxResultSize = Integer.parseInt(pwmApplication.getConfig().readAppProperty(AppProperty.CONFIG_EDITOR_QUERY_FILTER_TEST_LIMIT));
-        final Collection<UserIdentity> users = discoverMatchingUsers(pwmApplication, maxResultSize, storedConfiguration, setting, profile);
-        final TimeDuration searchDuration = TimeDuration.fromCurrent(startSearchTime);
+        final int maxResultSize = Integer.parseInt( pwmApplication.getConfig().readAppProperty( AppProperty.CONFIG_EDITOR_QUERY_FILTER_TEST_LIMIT ) );
+        final Collection<UserIdentity> users = discoverMatchingUsers( pwmApplication, maxResultSize, storedConfiguration, setting, profile );
+        final TimeDuration searchDuration = TimeDuration.fromCurrent( startSearchTime );
 
         final UserMatchViewerResults userMatchViewerResults = new UserMatchViewerResults();
         final boolean sizeExceeded = users.size() >= maxResultSize;
 
-        userMatchViewerResults.setUsers(users);
+        userMatchViewerResults.setUsers( users );
         userMatchViewerResults.setSearchOperationSummary(
                 LocaleHelper.getLocalizedMessage(
                         Display.Display_SearchResultsInfo, pwmRequest,
-                        String.valueOf(users.size()),
-                        searchDuration.asLongString(pwmRequest.getLocale())
-                ));
-        userMatchViewerResults.setSizeExceeded(sizeExceeded);
+                        String.valueOf( users.size() ),
+                        searchDuration.asLongString( pwmRequest.getLocale() )
+                ) );
+        userMatchViewerResults.setSizeExceeded( sizeExceeded );
         return userMatchViewerResults;
     }
 
@@ -95,79 +96,105 @@ public class UserMatchViewerFunction implements SettingUIFunction {
     )
             throws Exception
     {
-        final Configuration config = new Configuration(storedConfiguration);
-        final PwmApplication tempApplication = new PwmApplication(pwmApplication.getPwmEnvironment().makeRuntimeInstance(config));
-        final List<UserPermission> permissions = (List<UserPermission>)storedConfiguration.readSetting(setting,profile).toNativeObject();
-
-        for (final UserPermission userPermission : permissions) {
-            if (userPermission.getType() == UserPermission.Type.ldapQuery) {
-                if (userPermission.getLdapBase() != null && !userPermission.getLdapBase().isEmpty()) {
-                    testIfLdapDNIsValid(tempApplication, userPermission.getLdapBase(), userPermission.getLdapProfileID());
+        final Configuration config = new Configuration( storedConfiguration );
+        final PwmApplication tempApplication = new PwmApplication( pwmApplication.getPwmEnvironment().makeRuntimeInstance( config ) );
+        final List<UserPermission> permissions = ( List<UserPermission> ) storedConfiguration.readSetting( setting, profile ).toNativeObject();
+
+        for ( final UserPermission userPermission : permissions )
+        {
+            if ( userPermission.getType() == UserPermission.Type.ldapQuery )
+            {
+                if ( userPermission.getLdapBase() != null && !userPermission.getLdapBase().isEmpty() )
+                {
+                    testIfLdapDNIsValid( tempApplication, userPermission.getLdapBase(), userPermission.getLdapProfileID() );
                 }
-            } else if (userPermission.getType() == UserPermission.Type.ldapGroup) {
-                testIfLdapDNIsValid(tempApplication, userPermission.getLdapBase(), userPermission.getLdapProfileID());
+            }
+            else if ( userPermission.getType() == UserPermission.Type.ldapGroup )
+            {
+                testIfLdapDNIsValid( tempApplication, userPermission.getLdapBase(), userPermission.getLdapProfileID() );
             }
         }
 
-        return LdapPermissionTester.discoverMatchingUsers(tempApplication, maxResultSize, permissions, SessionLabel.SYSTEM_LABEL).keySet();
+        return LdapPermissionTester.discoverMatchingUsers( tempApplication, maxResultSize, permissions, SessionLabel.SYSTEM_LABEL ).keySet();
     }
 
 
-    private void testIfLdapDNIsValid(final PwmApplication pwmApplication, final String baseDN, final String profileID)
-            throws PwmOperationalException, PwmUnrecoverableException {
+    private void testIfLdapDNIsValid( final PwmApplication pwmApplication, final String baseDN, final String profileID )
+            throws PwmOperationalException, PwmUnrecoverableException
+    {
         final Set<String> profileIDsToTest = new LinkedHashSet<>();
-        if (profileID == null || profileID.isEmpty()) {
-            profileIDsToTest.add(pwmApplication.getConfig().getDefaultLdapProfile().getIdentifier());
-        } else if (profileID.equals(PwmConstants.PROFILE_ID_ALL)) {
-            profileIDsToTest.addAll(pwmApplication.getConfig().getLdapProfiles().keySet());
-        } else {
-            profileIDsToTest.add(profileID);
+        if ( profileID == null || profileID.isEmpty() )
+        {
+            profileIDsToTest.add( pwmApplication.getConfig().getDefaultLdapProfile().getIdentifier() );
+        }
+        else if ( profileID.equals( PwmConstants.PROFILE_ID_ALL ) )
+        {
+            profileIDsToTest.addAll( pwmApplication.getConfig().getLdapProfiles().keySet() );
         }
-        for (final String loopID : profileIDsToTest) {
+        else
+        {
+            profileIDsToTest.add( profileID );
+        }
+        for ( final String loopID : profileIDsToTest )
+        {
             ChaiEntry chaiEntry = null;
-            try {
-                final ChaiProvider proxiedProvider = pwmApplication.getProxyChaiProvider(loopID);
-                chaiEntry = proxiedProvider.getEntryFactory().newChaiEntry(baseDN);
-            } catch (Exception e) {
-                LOGGER.error("error while testing entry DN for profile '" + profileID + "', error:" + profileID);
+            try
+            {
+                final ChaiProvider proxiedProvider = pwmApplication.getProxyChaiProvider( loopID );
+                chaiEntry = proxiedProvider.getEntryFactory().newChaiEntry( baseDN );
+            }
+            catch ( Exception e )
+            {
+                LOGGER.error( "error while testing entry DN for profile '" + profileID + "', error:" + profileID );
             }
-            try {
-                if (chaiEntry != null && !chaiEntry.exists()) {
+            try
+            {
+                if ( chaiEntry != null && !chaiEntry.exists() )
+                {
                     final String errorMsg = "entry DN '" + baseDN + "' is not valid for profile " + loopID;
-                    throw new PwmOperationalException(new ErrorInformation(PwmError.ERROR_LDAP_DATA_ERROR, errorMsg));
+                    throw new PwmOperationalException( new ErrorInformation( PwmError.ERROR_LDAP_DATA_ERROR, errorMsg ) );
                 }
-            } catch (ChaiUnavailableException e) {
-                throw PwmUnrecoverableException.fromChaiException(e);
+            }
+            catch ( ChaiUnavailableException e )
+            {
+                throw PwmUnrecoverableException.fromChaiException( e );
             }
         }
     }
 
-    public static class UserMatchViewerResults implements Serializable {
+    public static class UserMatchViewerResults implements Serializable
+    {
         private Collection<UserIdentity> users;
         private boolean sizeExceeded;
         private String searchOperationSummary;
 
-        public Collection<UserIdentity> getUsers() {
+        public Collection<UserIdentity> getUsers( )
+        {
             return users;
         }
 
-        public void setUsers(final Collection<UserIdentity> users) {
+        public void setUsers( final Collection<UserIdentity> users )
+        {
             this.users = users;
         }
 
-        public boolean isSizeExceeded() {
+        public boolean isSizeExceeded( )
+        {
             return sizeExceeded;
         }
 
-        public void setSizeExceeded(final boolean sizeExceeded) {
+        public void setSizeExceeded( final boolean sizeExceeded )
+        {
             this.sizeExceeded = sizeExceeded;
         }
 
-        public String getSearchOperationSummary() {
+        public String getSearchOperationSummary( )
+        {
             return searchOperationSummary;
         }
 
-        public void setSearchOperationSummary(final String searchOperationSummary) {
+        public void setSearchOperationSummary( final String searchOperationSummary )
+        {
             this.searchOperationSummary = searchOperationSummary;
         }
     }

+ 2 - 1
server/src/main/java/password/pwm/config/option/ADPolicyComplexity.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum ADPolicyComplexity implements ConfigurationOption {
+public enum ADPolicyComplexity implements ConfigurationOption
+{
     NONE,
     AD2003,
     AD2008,

+ 2 - 1
server/src/main/java/password/pwm/config/option/ApplicationPage.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum ApplicationPage implements ConfigurationOption {
+public enum ApplicationPage implements ConfigurationOption
+{
     LOGIN,
     FORGOTTEN_PASSWORD,
     FORGOTTEN_USERNAME,

+ 2 - 1
server/src/main/java/password/pwm/config/option/ConfigurationOption.java

@@ -22,5 +22,6 @@
 
 package password.pwm.config.option;
 
-public interface ConfigurationOption { /* marker interface */
+public interface ConfigurationOption
+{ /* marker interface */
 }

+ 2 - 1
server/src/main/java/password/pwm/config/option/DataStorageMethod.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum DataStorageMethod implements ConfigurationOption {
+public enum DataStorageMethod implements ConfigurationOption
+{
     AUTO,
     DB,
     LDAP,

+ 2 - 1
server/src/main/java/password/pwm/config/option/DuplicateMode.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum DuplicateMode implements ConfigurationOption {
+public enum DuplicateMode implements ConfigurationOption
+{
     FIRST_ALL,
     FIRST_PROFILE,
     NONE

+ 2 - 1
server/src/main/java/password/pwm/config/option/ForceSetupPolicy.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum ForceSetupPolicy  {
+public enum ForceSetupPolicy
+{
     FORCE,
     FORCE_ALLOW_SKIP,
     SKIP

+ 2 - 1
server/src/main/java/password/pwm/config/option/HelpdeskClearResponseMode.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum HelpdeskClearResponseMode implements ConfigurationOption {
+public enum HelpdeskClearResponseMode implements ConfigurationOption
+{
     yes,
     ask,
     no

+ 2 - 1
server/src/main/java/password/pwm/config/option/HelpdeskUIMode.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum HelpdeskUIMode implements ConfigurationOption {
+public enum HelpdeskUIMode implements ConfigurationOption
+{
     none,
     type,
     autogen,

+ 23 - 19
server/src/main/java/password/pwm/config/option/IdentityVerificationMethod.java

@@ -31,43 +31,47 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
 
-public enum IdentityVerificationMethod implements Serializable, ConfigurationOption {
-    PREVIOUS_AUTH(      false,  Display.Field_VerificationMethodPreviousAuth,       Display.Description_VerificationMethodPreviousAuth),
-    ATTRIBUTES(         true,   Display.Field_VerificationMethodAttributes,         Display.Description_VerificationMethodAttributes),
-    CHALLENGE_RESPONSES(true,   Display.Field_VerificationMethodChallengeResponses, Display.Description_VerificationMethodChallengeResponses),
-    TOKEN(              true,   Display.Field_VerificationMethodToken,              Display.Description_VerificationMethodToken),
-    OTP(                true,   Display.Field_VerificationMethodOTP,                Display.Description_VerificationMethodOTP),
-    REMOTE_RESPONSES(   false,  Display.Field_VerificationMethodRemoteResponses,    Display.Description_VerificationMethodRemoteResponses),
-    OAUTH(              true,   Display.Field_VerificationMethodOAuth,              Display.Description_VerificationMethodOAuth),
+public enum IdentityVerificationMethod implements Serializable, ConfigurationOption
+{
+    PREVIOUS_AUTH( false, Display.Field_VerificationMethodPreviousAuth, Display.Description_VerificationMethodPreviousAuth ),
+    ATTRIBUTES( true, Display.Field_VerificationMethodAttributes, Display.Description_VerificationMethodAttributes ),
+    CHALLENGE_RESPONSES( true, Display.Field_VerificationMethodChallengeResponses, Display.Description_VerificationMethodChallengeResponses ),
+    TOKEN( true, Display.Field_VerificationMethodToken, Display.Description_VerificationMethodToken ),
+    OTP( true, Display.Field_VerificationMethodOTP, Display.Description_VerificationMethodOTP ),
+    REMOTE_RESPONSES( false, Display.Field_VerificationMethodRemoteResponses, Display.Description_VerificationMethodRemoteResponses ),
+    OAUTH( true, Display.Field_VerificationMethodOAuth, Display.Description_VerificationMethodOAuth ),;
 
-    ;
-    
     private final transient boolean userSelectable;
     private final transient Display labelKey;
     private final transient Display descriptionKey;
 
-    IdentityVerificationMethod(final boolean userSelectable, final Display labelKey, final Display descriptionKey) {
+    IdentityVerificationMethod( final boolean userSelectable, final Display labelKey, final Display descriptionKey )
+    {
         this.userSelectable = userSelectable;
         this.labelKey = labelKey;
         this.descriptionKey = descriptionKey;
     }
 
-    public boolean isUserSelectable() {
+    public boolean isUserSelectable( )
+    {
         return userSelectable;
     }
 
-    public String getLabel(final Configuration configuration, final Locale locale) {
-        return Display.getLocalizedMessage(locale, this.labelKey, configuration);
+    public String getLabel( final Configuration configuration, final Locale locale )
+    {
+        return Display.getLocalizedMessage( locale, this.labelKey, configuration );
     }
 
-    public String getDescription(final Configuration configuration, final Locale locale) {
-        return Display.getLocalizedMessage(locale, this.descriptionKey, configuration);
+    public String getDescription( final Configuration configuration, final Locale locale )
+    {
+        return Display.getLocalizedMessage( locale, this.descriptionKey, configuration );
     }
 
-    public static IdentityVerificationMethod[] availableValues() {
+    public static IdentityVerificationMethod[] availableValues( )
+    {
         final List<IdentityVerificationMethod> values = new ArrayList<>();
-        values.addAll(Arrays.asList(IdentityVerificationMethod.values()));
-        return values.toArray(new IdentityVerificationMethod[values.size()]);
+        values.addAll( Arrays.asList( IdentityVerificationMethod.values() ) );
+        return values.toArray( new IdentityVerificationMethod[ values.size() ] );
     }
 
 }

+ 2 - 1
server/src/main/java/password/pwm/config/option/IntruderStorageMethod.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum IntruderStorageMethod implements ConfigurationOption {
+public enum IntruderStorageMethod implements ConfigurationOption
+{
     AUTO,
     DATABASE,
     LOCALDB,

+ 16 - 12
server/src/main/java/password/pwm/config/option/MessageSendMethod.java

@@ -22,31 +22,35 @@
 
 package password.pwm.config.option;
 
-public enum MessageSendMethod implements ConfigurationOption {
-    NONE(false),
+public enum MessageSendMethod implements ConfigurationOption
+{
+    NONE( false ),
 
-    EMAILONLY(false),
-    SMSONLY(false),
-    CHOICE_SMS_EMAIL(false),
+    EMAILONLY( false ),
+    SMSONLY( false ),
+    CHOICE_SMS_EMAIL( false ),
 
+    //deprecated oct 2017
     @Deprecated
-    BOTH(true),         //deprecated oct 2017
+    BOTH( true ),
 
+    //deprecated oct 2017
     @Deprecated
-    EMAILFIRST(true),   //deprecated oct 2017
+    EMAILFIRST( true ),
 
+    //deprecated oct 2017
     @Deprecated
-    SMSFIRST(true),     //deprecated oct 2017
-
-    ;
+    SMSFIRST( true ),;
 
     private final boolean deprecated;
 
-    MessageSendMethod(final boolean deprecated) {
+    MessageSendMethod( final boolean deprecated )
+    {
         this.deprecated = deprecated;
     }
 
-    public boolean isDeprecated() {
+    public boolean isDeprecated( )
+    {
         return deprecated;
     }
 }

+ 20 - 22
server/src/main/java/password/pwm/config/option/OTPStorageFormat.java

@@ -23,55 +23,53 @@
 package password.pwm.config.option;
 
 /**
- * One Time Password Storage Format
+ * One Time Password Storage Format.
  */
-public enum OTPStorageFormat {
+public enum OTPStorageFormat
+{
 
-    PWM(true, true),
-    BASE32SECRET(false),
-    OTPURL(false),
-    PAM(true, false);
+    PWM( true, true ),
+    BASE32SECRET( false ),
+    OTPURL( false ),
+    PAM( true, false );
 
     private final boolean useRecoveryCodes;
     private final boolean hashRecoveryCodes;
 
-    /**
-     * Constructor.
-     *
-     * @param useRecoveryCodes
-     */
-    OTPStorageFormat(final boolean useRecoveryCodes) {
+    OTPStorageFormat( final boolean useRecoveryCodes )
+    {
         this.useRecoveryCodes = useRecoveryCodes;
-        this.hashRecoveryCodes = useRecoveryCodes; // defaults to true, if recovery codes enabled.
+
+        // defaults to true, if recovery codes enabled.
+        this.hashRecoveryCodes = useRecoveryCodes;
     }
 
-    /**
-     * Constructor.
-     *
-     * @param useRecoveryCodes
-     * @param hashRecoveryCodes
-     */
     OTPStorageFormat(
             final boolean useRecoveryCodes,
             final boolean hashRecoveryCodes
-    ) {
+    )
+    {
         this.useRecoveryCodes = useRecoveryCodes;
         this.hashRecoveryCodes = useRecoveryCodes && hashRecoveryCodes;
     }
 
     /**
      * Check support for recovery codes.
+     *
      * @return true if recovery codes are supported.
      */
-    public boolean supportsRecoveryCodes() {
+    public boolean supportsRecoveryCodes( )
+    {
         return useRecoveryCodes;
     }
 
     /**
      * Check support for hashed recovery codes.
+     *
      * @return true if recovery codes are supported and hashes are to be used.
      */
-    public boolean supportsHashedRecoveryCodes() {
+    public boolean supportsHashedRecoveryCodes( )
+    {
         return useRecoveryCodes && hashRecoveryCodes;
     }
 

+ 2 - 1
server/src/main/java/password/pwm/config/option/PasswordSyncCheckMode.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum PasswordSyncCheckMode implements ConfigurationOption {
+public enum PasswordSyncCheckMode implements ConfigurationOption
+{
     DISABLED,
     ENABLED,
     ENABLED_SHOW

+ 2 - 1
server/src/main/java/password/pwm/config/option/RecoveryAction.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum RecoveryAction implements ConfigurationOption {
+public enum RecoveryAction implements ConfigurationOption
+{
     RESETPW,
     SENDNEWPW,
     SENDNEWPW_AND_EXPIRE,

+ 2 - 1
server/src/main/java/password/pwm/config/option/RequireCurrentPasswordMode.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum RequireCurrentPasswordMode {
+public enum RequireCurrentPasswordMode
+{
     TRUE,
     FALSE,
     NOTEXPIRED,

+ 2 - 1
server/src/main/java/password/pwm/config/option/SelectableContextMode.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum SelectableContextMode implements ConfigurationOption {
+public enum SelectableContextMode implements ConfigurationOption
+{
     SHOW_PROFILE,
     SHOW_CONTEXTS,
     NONE

+ 2 - 1
server/src/main/java/password/pwm/config/option/SessionBeanMode.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum SessionBeanMode implements ConfigurationOption {
+public enum SessionBeanMode implements ConfigurationOption
+{
     LOCAL,
     CRYPTCOOKIE,
     CRYPTREQUEST,

+ 2 - 1
server/src/main/java/password/pwm/config/option/SessionVerificationMode.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum SessionVerificationMode implements ConfigurationOption {
+public enum SessionVerificationMode implements ConfigurationOption
+{
     OFF,
     VERIFY,
     VERIFY_AND_CACHE,

+ 2 - 1
server/src/main/java/password/pwm/config/option/StrengthMeterType.java

@@ -1,6 +1,7 @@
 package password.pwm.config.option;
 
-public enum StrengthMeterType implements ConfigurationOption {
+public enum StrengthMeterType implements ConfigurationOption
+{
     PWM,
     ZXCVBN,
 }

+ 11 - 10
server/src/main/java/password/pwm/config/option/TLSVersion.java

@@ -22,22 +22,23 @@
 
 package password.pwm.config.option;
 
-public enum TLSVersion {
-    SSL_2_0("SSLv2"),
-    SSL_3_0("SSLv3"),
-    TLS_1_0("TLSv1"),
-    TLS_1_1("TLSv1.1"),
-    TLS_1_2("TLSv1.2"),
-
-    ;
+public enum TLSVersion
+{
+    SSL_2_0( "SSLv2" ),
+    SSL_3_0( "SSLv3" ),
+    TLS_1_0( "TLSv1" ),
+    TLS_1_1( "TLSv1.1" ),
+    TLS_1_2( "TLSv1.2" ),;
 
     private final String tomcatValueName;
 
-    TLSVersion(final String tomcatValueName) {
+    TLSVersion( final String tomcatValueName )
+    {
         this.tomcatValueName = tomcatValueName;
     }
 
-    public String getTomcatValueName() {
+    public String getTomcatValueName( )
+    {
         return tomcatValueName;
     }
 

+ 2 - 1
server/src/main/java/password/pwm/config/option/TokenStorageMethod.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum TokenStorageMethod implements ConfigurationOption {
+public enum TokenStorageMethod implements ConfigurationOption
+{
     STORE_LOCALDB,
     STORE_DB,
     STORE_CRYPTO,

+ 2 - 1
server/src/main/java/password/pwm/config/option/UserEventStorageMethod.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum UserEventStorageMethod implements ConfigurationOption {
+public enum UserEventStorageMethod implements ConfigurationOption
+{
     AUTO,
     DATABASE,
     LDAP,

+ 2 - 1
server/src/main/java/password/pwm/config/option/ViewStatusFields.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum ViewStatusFields implements ConfigurationOption {
+public enum ViewStatusFields implements ConfigurationOption
+{
     AccountEnabled,
     AccountExpired,
     AccountExpirationTime,

+ 2 - 1
server/src/main/java/password/pwm/config/option/WebServiceUsage.java

@@ -22,7 +22,8 @@
 
 package password.pwm.config.option;
 
-public enum WebServiceUsage {
+public enum WebServiceUsage
+{
     Challenges,
     CheckPassword,
     Health,

+ 81 - 55
server/src/main/java/password/pwm/config/profile/AbstractProfile.java

@@ -48,124 +48,150 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
-public abstract class AbstractProfile implements Profile, SettingReader {
+public abstract class AbstractProfile implements Profile, SettingReader
+{
 
     private final String identifier;
-    final Map<PwmSetting,StoredValue> storedValueMap;
+    final Map<PwmSetting, StoredValue> storedValueMap;
 
-    AbstractProfile(final String identifier, final Map<PwmSetting, StoredValue> storedValueMap) {
+    AbstractProfile( final String identifier, final Map<PwmSetting, StoredValue> storedValueMap )
+    {
         this.identifier = identifier;
         this.storedValueMap = storedValueMap;
     }
 
     @Override
-    public String getIdentifier() {
+    public String getIdentifier( )
+    {
         return identifier;
     }
 
-    public List<UserPermission> readSettingAsUserPermission(final PwmSetting setting) {
-        final StoredValue value = storedValueMap.get(setting);
-        return Configuration.JavaTypeConverter.valueToUserPermissions(value);
+    public List<UserPermission> readSettingAsUserPermission( final PwmSetting setting )
+    {
+        final StoredValue value = storedValueMap.get( setting );
+        return Configuration.JavaTypeConverter.valueToUserPermissions( value );
     }
 
-    public String readSettingAsString(final PwmSetting setting) {
-        return Configuration.JavaTypeConverter.valueToString(storedValueMap.get(setting));
+    public String readSettingAsString( final PwmSetting setting )
+    {
+        return Configuration.JavaTypeConverter.valueToString( storedValueMap.get( setting ) );
     }
 
     @Override
-    public List<String> readSettingAsStringArray(final PwmSetting setting) {
-        return Configuration.JavaTypeConverter.valueToStringArray(storedValueMap.get(setting));
+    public List<String> readSettingAsStringArray( final PwmSetting setting )
+    {
+        return Configuration.JavaTypeConverter.valueToStringArray( storedValueMap.get( setting ) );
     }
 
     @Override
-    public List<FormConfiguration> readSettingAsForm(final PwmSetting pwmSetting) {
-        return Configuration.JavaTypeConverter.valueToForm(storedValueMap.get(pwmSetting));
+    public List<FormConfiguration> readSettingAsForm( final PwmSetting pwmSetting )
+    {
+        return Configuration.JavaTypeConverter.valueToForm( storedValueMap.get( pwmSetting ) );
     }
 
     @Override
-    public <E extends Enum<E>> Set<E> readSettingAsOptionList(final PwmSetting setting, final Class<E> enumClass) {
-        return Configuration.JavaTypeConverter.valueToOptionList(setting, storedValueMap.get(setting), enumClass);
+    public <E extends Enum<E>> Set<E> readSettingAsOptionList( final PwmSetting setting, final Class<E> enumClass )
+    {
+        return Configuration.JavaTypeConverter.valueToOptionList( setting, storedValueMap.get( setting ), enumClass );
     }
 
     @Override
-    public <E extends Enum<E>> E readSettingAsEnum(final PwmSetting setting, final Class<E> enumClass) {
-        final StoredValue value = storedValueMap.get(setting);
-        final E returnValue =  Configuration.JavaTypeConverter.valueToEnum(setting, value, enumClass);
-        if (MessageSendMethod.class.equals(enumClass)) {
-            Configuration.deprecatedSettingException(setting, this.getIdentifier(), (MessageSendMethod) returnValue);
+    public <E extends Enum<E>> E readSettingAsEnum( final PwmSetting setting, final Class<E> enumClass )
+    {
+        final StoredValue value = storedValueMap.get( setting );
+        final E returnValue = Configuration.JavaTypeConverter.valueToEnum( setting, value, enumClass );
+        if ( MessageSendMethod.class.equals( enumClass ) )
+        {
+            Configuration.deprecatedSettingException( setting, this.getIdentifier(), ( MessageSendMethod ) returnValue );
         }
 
         return returnValue;
     }
 
-    public List<ActionConfiguration> readSettingAsAction(final PwmSetting setting) {
-        return Configuration.JavaTypeConverter.valueToAction(setting, storedValueMap.get(setting));
+    public List<ActionConfiguration> readSettingAsAction( final PwmSetting setting )
+    {
+        return Configuration.JavaTypeConverter.valueToAction( setting, storedValueMap.get( setting ) );
     }
 
     @Override
-    public List<X509Certificate> readSettingAsCertificate(final PwmSetting setting) {
-        if (PwmSettingSyntax.X509CERT != setting.getSyntax()) {
-            throw new IllegalArgumentException("may not read X509CERT value for setting: " + setting.toString());
+    public List<X509Certificate> readSettingAsCertificate( final PwmSetting setting )
+    {
+        if ( PwmSettingSyntax.X509CERT != setting.getSyntax() )
+        {
+            throw new IllegalArgumentException( "may not read X509CERT value for setting: " + setting.toString() );
         }
-        if (storedValueMap.containsKey(setting)) {
-            final X509Certificate[] arrayCert = (X509Certificate[])storedValueMap.get(setting).toNativeObject();
-            return arrayCert == null ? Collections.emptyList() : Arrays.asList(arrayCert);
+        if ( storedValueMap.containsKey( setting ) )
+        {
+            final X509Certificate[] arrayCert = ( X509Certificate[] ) storedValueMap.get( setting ).toNativeObject();
+            return arrayCert == null ? Collections.emptyList() : Arrays.asList( arrayCert );
         }
         return Collections.emptyList();
     }
 
     @Override
-    public boolean readSettingAsBoolean(final PwmSetting setting) {
-        return Configuration.JavaTypeConverter.valueToBoolean(storedValueMap.get(setting));
+    public boolean readSettingAsBoolean( final PwmSetting setting )
+    {
+        return Configuration.JavaTypeConverter.valueToBoolean( storedValueMap.get( setting ) );
     }
 
     @Override
-    public long readSettingAsLong(final PwmSetting setting) {
-        return Configuration.JavaTypeConverter.valueToLong(storedValueMap.get(setting));
+    public long readSettingAsLong( final PwmSetting setting )
+    {
+        return Configuration.JavaTypeConverter.valueToLong( storedValueMap.get( setting ) );
     }
 
     @Override
-    public String readSettingAsLocalizedString(final PwmSetting setting, final Locale locale) {
-        return Configuration.JavaTypeConverter.valueToLocalizedString(storedValueMap.get(setting), locale);
+    public String readSettingAsLocalizedString( final PwmSetting setting, final Locale locale )
+    {
+        return Configuration.JavaTypeConverter.valueToLocalizedString( storedValueMap.get( setting ), locale );
     }
 
     @Override
-    public PasswordData readSettingAsPassword(final PwmSetting setting) {
-        return Configuration.JavaTypeConverter.valueToPassword(storedValueMap.get(setting));
+    public PasswordData readSettingAsPassword( final PwmSetting setting )
+    {
+        return Configuration.JavaTypeConverter.valueToPassword( storedValueMap.get( setting ) );
     }
 
     @Override
-    public List<UserPermission> getPermissionMatches() {
-        return readSettingAsUserPermission(profileType().getQueryMatch());
+    public List<UserPermission> getPermissionMatches( )
+    {
+        return readSettingAsUserPermission( profileType().getQueryMatch() );
     }
 
-    static Map<PwmSetting,StoredValue> makeValueMap(
+    static Map<PwmSetting, StoredValue> makeValueMap(
             final StoredConfiguration storedConfiguration,
             final String identifier,
             final PwmSettingCategory pwmSettingCategory
-    ) {
-        final Map<PwmSetting,StoredValue> valueMap = new LinkedHashMap<>();
+    )
+    {
+        final Map<PwmSetting, StoredValue> valueMap = new LinkedHashMap<>();
         final List<PwmSettingCategory> categories = new ArrayList<>();
-        categories.add(pwmSettingCategory);
-        categories.addAll(pwmSettingCategory.getChildCategories());
-        for (final PwmSettingCategory category : categories) {
-            for (final PwmSetting setting : category.getSettings()) {
-                final StoredValue value = storedConfiguration.readSetting(setting, identifier);
-                valueMap.put(setting, value);
+        categories.add( pwmSettingCategory );
+        categories.addAll( pwmSettingCategory.getChildCategories() );
+        for ( final PwmSettingCategory category : categories )
+        {
+            for ( final PwmSetting setting : category.getSettings() )
+            {
+                final StoredValue value = storedConfiguration.readSetting( setting, identifier );
+                valueMap.put( setting, value );
             }
         }
         return valueMap;
     }
 
-    Set<IdentityVerificationMethod> readVerificationMethods(final PwmSetting pwmSetting, final VerificationMethodValue.EnabledState enabledState) {
+    Set<IdentityVerificationMethod> readVerificationMethods( final PwmSetting pwmSetting, final VerificationMethodValue.EnabledState enabledState )
+    {
         final Set<IdentityVerificationMethod> result = new LinkedHashSet<>();
-        final StoredValue configValue = storedValueMap.get(pwmSetting);
-        final VerificationMethodValue.VerificationMethodSettings verificationMethodSettings = (VerificationMethodValue.VerificationMethodSettings)configValue.toNativeObject();
-
-        for (final IdentityVerificationMethod recoveryVerificationMethods : IdentityVerificationMethod.availableValues()) {
-            if (verificationMethodSettings.getMethodSettings().containsKey(recoveryVerificationMethods)) {
-                if (verificationMethodSettings.getMethodSettings().get(recoveryVerificationMethods).getEnabledState() == enabledState) {
-                    result.add(recoveryVerificationMethods);
+        final StoredValue configValue = storedValueMap.get( pwmSetting );
+        final VerificationMethodValue.VerificationMethodSettings verificationMethodSettings = ( VerificationMethodValue.VerificationMethodSettings ) configValue.toNativeObject();
+
+        for ( final IdentityVerificationMethod recoveryVerificationMethods : IdentityVerificationMethod.availableValues() )
+        {
+            if ( verificationMethodSettings.getMethodSettings().containsKey( recoveryVerificationMethods ) )
+            {
+                if ( verificationMethodSettings.getMethodSettings().get( recoveryVerificationMethods ).getEnabledState() == enabledState )
+                {
+                    result.add( recoveryVerificationMethods );
                 }
             }
         }

+ 98 - 62
server/src/main/java/password/pwm/config/profile/ChallengeProfile.java

@@ -28,13 +28,13 @@ import com.novell.ldapchai.cr.Challenge;
 import com.novell.ldapchai.cr.ChallengeSet;
 import com.novell.ldapchai.exception.ChaiValidationException;
 import password.pwm.PwmConstants;
-import password.pwm.config.value.data.ChallengeItemConfiguration;
 import password.pwm.config.Configuration;
 import password.pwm.config.PwmSetting;
 import password.pwm.config.StoredValue;
-import password.pwm.config.value.data.UserPermission;
 import password.pwm.config.stored.StoredConfiguration;
 import password.pwm.config.value.ChallengeValue;
+import password.pwm.config.value.data.ChallengeItemConfiguration;
+import password.pwm.config.value.data.UserPermission;
 import password.pwm.error.ErrorInformation;
 import password.pwm.error.PwmError;
 import password.pwm.error.PwmOperationalException;
@@ -49,8 +49,9 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
-public class ChallengeProfile implements Profile, Serializable {
-    private static final PwmLogger LOGGER = PwmLogger.forClass(ChallengeProfile.class);
+public class ChallengeProfile implements Profile, Serializable
+{
+    private static final PwmLogger LOGGER = PwmLogger.forClass( ChallengeProfile.class );
 
     private final String profileID;
     private final Locale locale;
@@ -76,18 +77,20 @@ public class ChallengeProfile implements Profile, Serializable {
         this.helpdeskChallengeSet = helpdeskChallengeSet;
         this.minRandomSetup = minRandomSetup;
         this.minHelpdeskRandomsSetup = minHelpdeskRandomSetup;
-        this.userPermissions = userPermissions != null ? Collections.unmodifiableList(userPermissions) : Collections.<UserPermission>emptyList();
+        this.userPermissions = userPermissions != null ? Collections.unmodifiableList( userPermissions ) : Collections.<UserPermission>emptyList();
     }
 
     public static ChallengeProfile readChallengeProfileFromConfig(
             final String profileID,
             final Locale locale,
             final StoredConfiguration storedConfiguration
-    ) {
-        final int minRandomRequired = (int)Configuration.JavaTypeConverter.valueToLong(storedConfiguration.readSetting(PwmSetting.CHALLENGE_MIN_RANDOM_REQUIRED,profileID));
+    )
+    {
+        final int minRandomRequired = ( int ) Configuration.JavaTypeConverter.valueToLong( storedConfiguration.readSetting( PwmSetting.CHALLENGE_MIN_RANDOM_REQUIRED, profileID ) );
 
         ChallengeSet readChallengeSet = null;
-        try {
+        try
+        {
             readChallengeSet = readChallengeSet(
                     profileID,
                     locale,
@@ -96,12 +99,15 @@ public class ChallengeProfile implements Profile, Serializable {
                     PwmSetting.CHALLENGE_RANDOM_CHALLENGES,
                     minRandomRequired
             );
-        } catch (PwmOperationalException e) {
-            LOGGER.trace("configured challengeSet for profile '" + profileID + "' is not valid: " + e.getMessage());
+        }
+        catch ( PwmOperationalException e )
+        {
+            LOGGER.trace( "configured challengeSet for profile '" + profileID + "' is not valid: " + e.getMessage() );
         }
 
         ChallengeSet readHelpdeskChallengeSet = null;
-        try {
+        try
+        {
             readHelpdeskChallengeSet = readChallengeSet(
                     profileID,
                     locale,
@@ -110,15 +116,23 @@ public class ChallengeProfile implements Profile, Serializable {
                     PwmSetting.CHALLENGE_HELPDESK_RANDOM_CHALLENGES,
                     1
             );
-        } catch (PwmOperationalException e) {
-            LOGGER.trace("discarding configured helpdesk challengeSet for profile '" + profileID + "' issue: " + e.getMessage());
         }
-        
-        final int minRandomSetup = (int)Configuration.JavaTypeConverter.valueToLong(storedConfiguration.readSetting(PwmSetting.CHALLENGE_MIN_RANDOM_SETUP, profileID));
-        final int minHelpdeskRandomSetup = (int)Configuration.JavaTypeConverter.valueToLong(storedConfiguration.readSetting(PwmSetting.CHALLENGE_HELPDESK_MIN_RANDOM_SETUP, profileID));
-        final List<UserPermission> userPermissions = (List<UserPermission>)storedConfiguration.readSetting(PwmSetting.CHALLENGE_POLICY_QUERY_MATCH, profileID).toNativeObject();
+        catch ( PwmOperationalException e )
+        {
+            LOGGER.trace( "discarding configured helpdesk challengeSet for profile '" + profileID + "' issue: " + e.getMessage() );
+        }
+
+        final int minRandomSetup = ( int ) Configuration.JavaTypeConverter.valueToLong( storedConfiguration.readSetting( PwmSetting.CHALLENGE_MIN_RANDOM_SETUP, profileID ) );
+        final int minHelpdeskRandomSetup = ( int ) Configuration.JavaTypeConverter.valueToLong( storedConfiguration.readSetting(
+                PwmSetting.CHALLENGE_HELPDESK_MIN_RANDOM_SETUP,
+                profileID
+        ) );
+        final List<UserPermission> userPermissions = ( List<UserPermission> ) storedConfiguration.readSetting(
+                PwmSetting.CHALLENGE_POLICY_QUERY_MATCH,
+                profileID
+        ).toNativeObject();
 
-        return new ChallengeProfile(profileID, locale, readChallengeSet, readHelpdeskChallengeSet, minRandomSetup, minHelpdeskRandomSetup, userPermissions);
+        return new ChallengeProfile( profileID, locale, readChallengeSet, readHelpdeskChallengeSet, minRandomSetup, minHelpdeskRandomSetup, userPermissions );
     }
 
     public static ChallengeProfile createChallengeProfile(
@@ -128,43 +142,48 @@ public class ChallengeProfile implements Profile, Serializable {
             final ChallengeSet helpdeskChallengeSet,
             final int minRandomSetup,
             final int minHelpdeskRandomSetup
-    ) {
-        return new ChallengeProfile(profileID, locale, challengeSet, helpdeskChallengeSet, minRandomSetup, minHelpdeskRandomSetup, null);
+    )
+    {
+        return new ChallengeProfile( profileID, locale, challengeSet, helpdeskChallengeSet, minRandomSetup, minHelpdeskRandomSetup, null );
     }
 
-    public String getIdentifier()
+    public String getIdentifier( )
     {
         return profileID;
     }
 
-    public String getDisplayName(final Locale locale) {
+    public String getDisplayName( final Locale locale )
+    {
         return getIdentifier();
     }
 
-    public Locale getLocale()
+    public Locale getLocale( )
     {
         return locale;
     }
 
-    public ChallengeSet getChallengeSet()
+    public ChallengeSet getChallengeSet( )
     {
         return challengeSet;
     }
 
-    public ChallengeSet getHelpdeskChallengeSet()
+    public ChallengeSet getHelpdeskChallengeSet( )
     {
         return helpdeskChallengeSet;
     }
 
-    public int getMinRandomSetup() {
+    public int getMinRandomSetup( )
+    {
         return minRandomSetup;
     }
 
-    public int getMinHelpdeskRandomsSetup() {
+    public int getMinHelpdeskRandomsSetup( )
+    {
         return minHelpdeskRandomsSetup;
     }
 
-    public List<UserPermission> getUserPermissions() {
+    public List<UserPermission> getUserPermissions( )
+    {
         return userPermissions;
     }
 
@@ -179,85 +198,102 @@ public class ChallengeProfile implements Profile, Serializable {
             throws PwmOperationalException
     {
         final List<ChallengeItemConfiguration> requiredQuestions = valueToChallengeItemArray(
-                storedConfiguration.readSetting(requiredChallenges, profileID), locale);
+                storedConfiguration.readSetting( requiredChallenges, profileID ), locale );
         final List<ChallengeItemConfiguration> randomQuestions = valueToChallengeItemArray(
-                storedConfiguration.readSetting(randomChallenges, profileID), locale);
+                storedConfiguration.readSetting( randomChallenges, profileID ), locale );
 
         final List<Challenge> challenges = new ArrayList<>();
         int randoms = minimumRands;
 
-        if (requiredQuestions != null) {
-            for (final ChallengeItemConfiguration item : requiredQuestions) {
-                if (item != null) {
+        if ( requiredQuestions != null )
+        {
+            for ( final ChallengeItemConfiguration item : requiredQuestions )
+            {
+                if ( item != null )
+                {
                     final Challenge chaiChallenge = new ChaiChallenge(
-                            true, 
-                            item.getText(), 
-                            item.getMinLength(), 
-                            item.getMaxLength(), 
+                            true,
+                            item.getText(),
+                            item.getMinLength(),
+                            item.getMaxLength(),
                             item.isAdminDefined(),
                             item.getMaxQuestionCharsInAnswer(),
                             item.isEnforceWordlist()
                     );
-                    challenges.add(chaiChallenge);
+                    challenges.add( chaiChallenge );
                 }
             }
         }
 
-        if (randomQuestions != null) {
-            for (final ChallengeItemConfiguration item : randomQuestions) {
-                if (item != null) {
+        if ( randomQuestions != null )
+        {
+            for ( final ChallengeItemConfiguration item : randomQuestions )
+            {
+                if ( item != null )
+                {
                     final Challenge chaiChallenge = new ChaiChallenge(
-                            false, 
-                            item.getText(), 
-                            item.getMinLength(), 
-                            item.getMaxLength(), 
+                            false,
+                            item.getText(),
+                            item.getMinLength(),
+                            item.getMaxLength(),
                             item.isAdminDefined(),
                             item.getMaxQuestionCharsInAnswer(),
                             item.isEnforceWordlist()
                     );
-                    challenges.add(chaiChallenge);
+                    challenges.add( chaiChallenge );
                 }
             }
 
-            if (randoms > randomQuestions.size()) {
+            if ( randoms > randomQuestions.size() )
+            {
                 randoms = randomQuestions.size();
             }
-        } else {
+        }
+        else
+        {
             randoms = 0;
         }
 
-        try {
-            return new ChaiChallengeSet(challenges, randoms, locale, PwmConstants.PWM_APP_NAME + "-defined " + PwmConstants.SERVLET_VERSION);
-        } catch (ChaiValidationException e) {
-            throw new PwmOperationalException(new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,"invalid challenge set configuration: " + e.getMessage()));
+        try
+        {
+            return new ChaiChallengeSet( challenges, randoms, locale, PwmConstants.PWM_APP_NAME + "-defined " + PwmConstants.SERVLET_VERSION );
+        }
+        catch ( ChaiValidationException e )
+        {
+            throw new PwmOperationalException( new ErrorInformation( PwmError.CONFIG_FORMAT_ERROR, "invalid challenge set configuration: " + e.getMessage() ) );
         }
     }
 
     static List<ChallengeItemConfiguration> valueToChallengeItemArray(
             final StoredValue value,
             final Locale locale
-    ) {
-        if (!(value instanceof ChallengeValue)) {
-            throw new IllegalArgumentException("may not read ChallengeValue value");
+    )
+    {
+        if ( !( value instanceof ChallengeValue ) )
+        {
+            throw new IllegalArgumentException( "may not read ChallengeValue value" );
         }
-        final Map<String, List<ChallengeItemConfiguration>> storedValues = (Map<String, List<ChallengeItemConfiguration>>)value.toNativeObject();
+        final Map<String, List<ChallengeItemConfiguration>> storedValues = ( Map<String, List<ChallengeItemConfiguration>> ) value.toNativeObject();
         final Map<Locale, List<ChallengeItemConfiguration>> availableLocaleMap = new LinkedHashMap<>();
-        for (final Map.Entry<String,List<ChallengeItemConfiguration>> entry : storedValues.entrySet()) {
+        for ( final Map.Entry<String, List<ChallengeItemConfiguration>> entry : storedValues.entrySet() )
+        {
             final String localeStr = entry.getKey();
-            availableLocaleMap.put(LocaleHelper.parseLocaleString(localeStr), entry.getValue());
+            availableLocaleMap.put( LocaleHelper.parseLocaleString( localeStr ), entry.getValue() );
         }
-        final Locale matchedLocale = LocaleHelper.localeResolver(locale, availableLocaleMap.keySet());
+        final Locale matchedLocale = LocaleHelper.localeResolver( locale, availableLocaleMap.keySet() );
 
-        return availableLocaleMap.get(matchedLocale);
+        return availableLocaleMap.get( matchedLocale );
     }
 
     @Override
-    public ProfileType profileType() {
+    public ProfileType profileType( )
+    {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public List<UserPermission> getPermissionMatches() {
+    public List<UserPermission> getPermissionMatches( )
+    {
         throw new UnsupportedOperationException();
     }
 }

+ 12 - 8
server/src/main/java/password/pwm/config/profile/DeleteAccountProfile.java

@@ -29,27 +29,31 @@ import password.pwm.config.stored.StoredConfiguration;
 import java.util.Locale;
 import java.util.Map;
 
-public class DeleteAccountProfile extends AbstractProfile implements Profile {
+public class DeleteAccountProfile extends AbstractProfile implements Profile
+{
     private static final ProfileType PROFILE_TYPE = ProfileType.DeleteAccount;
 
-    protected DeleteAccountProfile(final String identifier, final Map<PwmSetting, StoredValue> storedValueMap) {
-        super(identifier, storedValueMap);
+    protected DeleteAccountProfile( final String identifier, final Map<PwmSetting, StoredValue> storedValueMap )
+    {
+        super( identifier, storedValueMap );
     }
 
-    public static DeleteAccountProfile makeFromStoredConfiguration(final StoredConfiguration storedConfiguration, final String identifier) {
-        final Map<PwmSetting,StoredValue> valueMap = makeValueMap(storedConfiguration, identifier, PROFILE_TYPE.getCategory());
-        return new DeleteAccountProfile(identifier, valueMap);
+    public static DeleteAccountProfile makeFromStoredConfiguration( final StoredConfiguration storedConfiguration, final String identifier )
+    {
+        final Map<PwmSetting, StoredValue> valueMap = makeValueMap( storedConfiguration, identifier, PROFILE_TYPE.getCategory() );
+        return new DeleteAccountProfile( identifier, valueMap );
 
     }
 
     @Override
-    public String getDisplayName(final Locale locale)
+    public String getDisplayName( final Locale locale )
     {
         return this.getIdentifier();
     }
 
     @Override
-    public ProfileType profileType() {
+    public ProfileType profileType( )
+    {
         return PROFILE_TYPE;
     }
 }

+ 32 - 21
server/src/main/java/password/pwm/config/profile/ForgottenPasswordProfile.java

@@ -32,56 +32,67 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
-public class ForgottenPasswordProfile extends AbstractProfile {
+public class ForgottenPasswordProfile extends AbstractProfile
+{
 
     private static final ProfileType PROFILE_TYPE = ProfileType.ForgottenPassword;
 
     private Set<IdentityVerificationMethod> requiredRecoveryVerificationMethods;
     private Set<IdentityVerificationMethod> optionalRecoveryVerificationMethods;
 
-    public ForgottenPasswordProfile(final String identifier, final Map<PwmSetting, StoredValue> storedValueMap) {
-        super(identifier, storedValueMap);
+    public ForgottenPasswordProfile( final String identifier, final Map<PwmSetting, StoredValue> storedValueMap )
+    {
+        super( identifier, storedValueMap );
     }
 
 
     @Override
-    public String getDisplayName(final Locale locale) {
+    public String getDisplayName( final Locale locale )
+    {
         return null;
     }
 
-    public static ForgottenPasswordProfile makeFromStoredConfiguration(final StoredConfiguration storedConfiguration, final String identifier) {
-        final Map<PwmSetting,StoredValue> valueMap = makeValueMap(storedConfiguration, identifier, PROFILE_TYPE.getCategory());
+    public static ForgottenPasswordProfile makeFromStoredConfiguration( final StoredConfiguration storedConfiguration, final String identifier )
+    {
+        final Map<PwmSetting, StoredValue> valueMap = makeValueMap( storedConfiguration, identifier, PROFILE_TYPE.getCategory() );
         return new
-                ForgottenPasswordProfile(identifier, valueMap);
+                ForgottenPasswordProfile( identifier, valueMap );
 
     }
 
     @Override
-    public ProfileType profileType() {
+    public ProfileType profileType( )
+    {
         return PROFILE_TYPE;
     }
-    
-    public Set<IdentityVerificationMethod> requiredRecoveryAuthenticationMethods() {
-        if (requiredRecoveryVerificationMethods == null) {
-            requiredRecoveryVerificationMethods = readRecoveryAuthMethods(VerificationMethodValue.EnabledState.required);
+
+    public Set<IdentityVerificationMethod> requiredRecoveryAuthenticationMethods( )
+    {
+        if ( requiredRecoveryVerificationMethods == null )
+        {
+            requiredRecoveryVerificationMethods = readRecoveryAuthMethods( VerificationMethodValue.EnabledState.required );
         }
         return requiredRecoveryVerificationMethods;
     }
 
-    public Set<IdentityVerificationMethod> optionalRecoveryAuthenticationMethods() {
-        if (optionalRecoveryVerificationMethods == null) {
-            optionalRecoveryVerificationMethods = readRecoveryAuthMethods(VerificationMethodValue.EnabledState.optional);
+    public Set<IdentityVerificationMethod> optionalRecoveryAuthenticationMethods( )
+    {
+        if ( optionalRecoveryVerificationMethods == null )
+        {
+            optionalRecoveryVerificationMethods = readRecoveryAuthMethods( VerificationMethodValue.EnabledState.optional );
         }
         return optionalRecoveryVerificationMethods;
     }
-    
-    private Set<IdentityVerificationMethod> readRecoveryAuthMethods(final VerificationMethodValue.EnabledState enabledState) {
-        return this.readVerificationMethods(PwmSetting.RECOVERY_VERIFICATION_METHODS, enabledState);
+
+    private Set<IdentityVerificationMethod> readRecoveryAuthMethods( final VerificationMethodValue.EnabledState enabledState )
+    {
+        return this.readVerificationMethods( PwmSetting.RECOVERY_VERIFICATION_METHODS, enabledState );
     }
 
-    public int getMinOptionalRequired() {
-        final StoredValue configValue = storedValueMap.get(PwmSetting.RECOVERY_VERIFICATION_METHODS);
-        final VerificationMethodValue.VerificationMethodSettings verificationMethodSettings = (VerificationMethodValue.VerificationMethodSettings)configValue.toNativeObject();
+    public int getMinOptionalRequired( )
+    {
+        final StoredValue configValue = storedValueMap.get( PwmSetting.RECOVERY_VERIFICATION_METHODS );
+        final VerificationMethodValue.VerificationMethodSettings verificationMethodSettings = ( VerificationMethodValue.VerificationMethodSettings ) configValue.toNativeObject();
         return verificationMethodSettings.getMinOptionalRequired();
     }
 }

+ 20 - 14
server/src/main/java/password/pwm/config/profile/HelpdeskProfile.java

@@ -35,38 +35,44 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
-public class HelpdeskProfile extends AbstractProfile implements Profile {
+public class HelpdeskProfile extends AbstractProfile implements Profile
+{
 
     private static final ProfileType PROFILE_TYPE = ProfileType.Helpdesk;
 
-    protected HelpdeskProfile(final String identifier, final Map<PwmSetting, StoredValue> storedValueMap) {
-        super(identifier, storedValueMap);
+    protected HelpdeskProfile( final String identifier, final Map<PwmSetting, StoredValue> storedValueMap )
+    {
+        super( identifier, storedValueMap );
     }
 
-    public static HelpdeskProfile makeFromStoredConfiguration(final StoredConfiguration storedConfiguration, final String identifier) {
-        final Map<PwmSetting,StoredValue> valueMap = makeValueMap(storedConfiguration, identifier, PROFILE_TYPE.getCategory());
-        return new HelpdeskProfile(identifier, valueMap);
+    public static HelpdeskProfile makeFromStoredConfiguration( final StoredConfiguration storedConfiguration, final String identifier )
+    {
+        final Map<PwmSetting, StoredValue> valueMap = makeValueMap( storedConfiguration, identifier, PROFILE_TYPE.getCategory() );
+        return new HelpdeskProfile( identifier, valueMap );
     }
 
     @Override
-    public String getDisplayName(final Locale locale)
+    public String getDisplayName( final Locale locale )
     {
         return this.getIdentifier();
     }
 
     @Override
-    public ProfileType profileType() {
+    public ProfileType profileType( )
+    {
         return PROFILE_TYPE;
     }
 
-    public Collection<IdentityVerificationMethod> readOptionalVerificationMethods() {
+    public Collection<IdentityVerificationMethod> readOptionalVerificationMethods( )
+    {
         final Set<IdentityVerificationMethod> result = new LinkedHashSet<>();
-        result.addAll(readVerificationMethods(PwmSetting.HELPDESK_VERIFICATION_METHODS, VerificationMethodValue.EnabledState.optional));
-        result.addAll(readVerificationMethods(PwmSetting.HELPDESK_VERIFICATION_METHODS, VerificationMethodValue.EnabledState.required));
-        return Collections.unmodifiableSet(result);
+        result.addAll( readVerificationMethods( PwmSetting.HELPDESK_VERIFICATION_METHODS, VerificationMethodValue.EnabledState.optional ) );
+        result.addAll( readVerificationMethods( PwmSetting.HELPDESK_VERIFICATION_METHODS, VerificationMethodValue.EnabledState.required ) );
+        return Collections.unmodifiableSet( result );
     }
 
-    public Collection<IdentityVerificationMethod> readRequiredVerificationMethods() {
-        return readVerificationMethods(PwmSetting.HELPDESK_VERIFICATION_METHODS, VerificationMethodValue.EnabledState.required);
+    public Collection<IdentityVerificationMethod> readRequiredVerificationMethods( )
+    {
+        return readVerificationMethods( PwmSetting.HELPDESK_VERIFICATION_METHODS, VerificationMethodValue.EnabledState.required );
     }
 }

+ 64 - 47
server/src/main/java/password/pwm/config/profile/LdapProfile.java

@@ -23,7 +23,6 @@
 package password.pwm.config.profile;
 
 import com.novell.ldapchai.ChaiEntry;
-
 import com.novell.ldapchai.exception.ChaiOperationException;
 import com.novell.ldapchai.exception.ChaiUnavailableException;
 import com.novell.ldapchai.provider.ChaiProvider;
@@ -32,8 +31,8 @@ import password.pwm.PwmApplication;
 import password.pwm.config.PwmSetting;
 import password.pwm.config.PwmSettingCategory;
 import password.pwm.config.StoredValue;
-import password.pwm.config.value.data.UserPermission;
 import password.pwm.config.stored.StoredConfigurationImpl;
+import password.pwm.config.value.data.UserPermission;
 import password.pwm.error.PwmUnrecoverableException;
 import password.pwm.ldap.LdapPermissionTester;
 import password.pwm.svc.cache.CacheKey;
@@ -50,16 +49,19 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
-public class LdapProfile extends AbstractProfile implements Profile {
-    private static final PwmLogger LOGGER = PwmLogger.forClass(LdapProfile.class);
+public class LdapProfile extends AbstractProfile implements Profile
+{
+    private static final PwmLogger LOGGER = PwmLogger.forClass( LdapProfile.class );
 
-    protected LdapProfile(final String identifier, final Map<PwmSetting, StoredValue> storedValueMap) {
-        super(identifier, storedValueMap);
+    protected LdapProfile( final String identifier, final Map<PwmSetting, StoredValue> storedValueMap )
+    {
+        super( identifier, storedValueMap );
     }
 
-    public static LdapProfile makeFromStoredConfiguration(final StoredConfigurationImpl storedConfiguration, final String profileID) {
-        final Map<PwmSetting,StoredValue> valueMap = AbstractProfile.makeValueMap(storedConfiguration, profileID, PwmSettingCategory.LDAP_PROFILE);
-        return new LdapProfile(profileID, valueMap);
+    public static LdapProfile makeFromStoredConfiguration( final StoredConfigurationImpl storedConfiguration, final String profileID )
+    {
+        final Map<PwmSetting, StoredValue> valueMap = AbstractProfile.makeValueMap( storedConfiguration, profileID, PwmSettingCategory.LDAP_PROFILE );
+        return new LdapProfile( profileID, valueMap );
     }
 
     public Map<String, String> getSelectableContexts(
@@ -67,16 +69,17 @@ public class LdapProfile extends AbstractProfile implements Profile {
     )
             throws PwmUnrecoverableException
     {
-        final List<String> rawValues = readSettingAsStringArray(PwmSetting.LDAP_LOGIN_CONTEXTS);
-        final Map<String, String> configuredValues = StringUtil.convertStringListToNameValuePair(rawValues, ":::");
+        final List<String> rawValues = readSettingAsStringArray( PwmSetting.LDAP_LOGIN_CONTEXTS );
+        final Map<String, String> configuredValues = StringUtil.convertStringListToNameValuePair( rawValues, ":::" );
         final Map<String, String> canonicalValues = new LinkedHashMap<>();
-        for (final Map.Entry<String,String> entry : configuredValues.entrySet()) {
+        for ( final Map.Entry<String, String> entry : configuredValues.entrySet() )
+        {
             final String dn = entry.getKey();
             final String label = entry.getValue();
-            final String canonicalDN = readCanonicalDN(pwmApplication, dn);
-            canonicalValues.put(canonicalDN, label);
+            final String canonicalDN = readCanonicalDN( pwmApplication, dn );
+            canonicalValues.put( canonicalDN, label );
         }
-        return Collections.unmodifiableMap(canonicalValues);
+        return Collections.unmodifiableMap( canonicalValues );
     }
 
     public List<String> getRootContexts(
@@ -84,38 +87,44 @@ public class LdapProfile extends AbstractProfile implements Profile {
     )
             throws PwmUnrecoverableException
     {
-        final List<String> rawValues = readSettingAsStringArray(PwmSetting.LDAP_CONTEXTLESS_ROOT);
+        final List<String> rawValues = readSettingAsStringArray( PwmSetting.LDAP_CONTEXTLESS_ROOT );
         final List<String> canonicalValues = new ArrayList<>();
-        for (final String dn : rawValues ) {
-            final String canonicalDN = readCanonicalDN(pwmApplication, dn);
-            canonicalValues.add(canonicalDN);
+        for ( final String dn : rawValues )
+        {
+            final String canonicalDN = readCanonicalDN( pwmApplication, dn );
+            canonicalValues.add( canonicalDN );
         }
-        return Collections.unmodifiableList(canonicalValues);
+        return Collections.unmodifiableList( canonicalValues );
     }
 
     @Override
-    public String getDisplayName(final Locale locale) {
-        final String displayName = readSettingAsLocalizedString(PwmSetting.LDAP_PROFILE_DISPLAY_NAME,locale);
+    public String getDisplayName( final Locale locale )
+    {
+        final String displayName = readSettingAsLocalizedString( PwmSetting.LDAP_PROFILE_DISPLAY_NAME, locale );
         return displayName == null || displayName.length() < 1 ? getIdentifier() : displayName;
     }
 
-    public String getUsernameAttribute() {
-        final String configUsernameAttr = this.readSettingAsString(PwmSetting.LDAP_USERNAME_ATTRIBUTE);
-        final String ldapNamingAttribute = this.readSettingAsString(PwmSetting.LDAP_NAMING_ATTRIBUTE);
+    public String getUsernameAttribute( )
+    {
+        final String configUsernameAttr = this.readSettingAsString( PwmSetting.LDAP_USERNAME_ATTRIBUTE );
+        final String ldapNamingAttribute = this.readSettingAsString( PwmSetting.LDAP_NAMING_ATTRIBUTE );
         return configUsernameAttr != null && configUsernameAttr.length() > 0 ? configUsernameAttr : ldapNamingAttribute;
     }
 
-    public ChaiProvider getProxyChaiProvider(final PwmApplication pwmApplication) throws PwmUnrecoverableException {
-        return pwmApplication.getProxyChaiProvider(this.getIdentifier());
+    public ChaiProvider getProxyChaiProvider( final PwmApplication pwmApplication ) throws PwmUnrecoverableException
+    {
+        return pwmApplication.getProxyChaiProvider( this.getIdentifier() );
     }
 
     @Override
-    public ProfileType profileType() {
+    public ProfileType profileType( )
+    {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public List<UserPermission> getPermissionMatches() {
+    public List<UserPermission> getPermissionMatches( )
+    {
         throw new UnsupportedOperationException();
     }
 
@@ -126,38 +135,46 @@ public class LdapProfile extends AbstractProfile implements Profile {
             throws PwmUnrecoverableException
     {
         {
-            final boolean doCanonicalDnResolve = Boolean.parseBoolean(pwmApplication.getConfig().readAppProperty(AppProperty.LDAP_RESOLVE_CANONICAL_DN));
-            if (!doCanonicalDnResolve) {
+            final boolean doCanonicalDnResolve = Boolean.parseBoolean( pwmApplication.getConfig().readAppProperty( AppProperty.LDAP_RESOLVE_CANONICAL_DN ) );
+            if ( !doCanonicalDnResolve )
+            {
                 return dnValue;
             }
         }
 
-        final boolean enableCanonicalCache = Boolean.parseBoolean(pwmApplication.getConfig().readAppProperty(AppProperty.LDAP_CACHE_CANONICAL_ENABLE));
+        final boolean enableCanonicalCache = Boolean.parseBoolean( pwmApplication.getConfig().readAppProperty( AppProperty.LDAP_CACHE_CANONICAL_ENABLE ) );
 
         String canonicalValue = null;
-        final CacheKey cacheKey = CacheKey.makeCacheKey(LdapPermissionTester.class, null, "canonicalDN-" + this.getIdentifier() + "-" + dnValue);
-        if (enableCanonicalCache) {
-            final String cachedDN = pwmApplication.getCacheService().get(cacheKey);
-            if (cachedDN != null) {
+        final CacheKey cacheKey = CacheKey.makeCacheKey( LdapPermissionTester.class, null, "canonicalDN-" + this.getIdentifier() + "-" + dnValue );
+        if ( enableCanonicalCache )
+        {
+            final String cachedDN = pwmApplication.getCacheService().get( cacheKey );
+            if ( cachedDN != null )
+            {
                 canonicalValue = cachedDN;
             }
         }
 
-        if (canonicalValue == null) {
-            try {
-                final ChaiProvider chaiProvider = this.getProxyChaiProvider(pwmApplication);
-                final ChaiEntry chaiEntry = chaiProvider.getEntryFactory().newChaiEntry(dnValue);
+        if ( canonicalValue == null )
+        {
+            try
+            {
+                final ChaiProvider chaiProvider = this.getProxyChaiProvider( pwmApplication );
+                final ChaiEntry chaiEntry = chaiProvider.getEntryFactory().newChaiEntry( dnValue );
                 canonicalValue = chaiEntry.readCanonicalDN();
 
-                if (enableCanonicalCache) {
-                    final long cacheSeconds = Long.parseLong(pwmApplication.getConfig().readAppProperty(AppProperty.LDAP_CACHE_CANONICAL_SECONDS));
-                    final CachePolicy cachePolicy = CachePolicy.makePolicyWithExpiration(new TimeDuration(cacheSeconds, TimeUnit.SECONDS));
-                    pwmApplication.getCacheService().put(cacheKey, cachePolicy, canonicalValue);
+                if ( enableCanonicalCache )
+                {
+                    final long cacheSeconds = Long.parseLong( pwmApplication.getConfig().readAppProperty( AppProperty.LDAP_CACHE_CANONICAL_SECONDS ) );
+                    final CachePolicy cachePolicy = CachePolicy.makePolicyWithExpiration( new TimeDuration( cacheSeconds, TimeUnit.SECONDS ) );
+                    pwmApplication.getCacheService().put( cacheKey, cachePolicy, canonicalValue );
                 }
 
-                LOGGER.trace("read and cached canonical ldap DN value for input '" + dnValue + "' as '" + canonicalValue + "'");
-            } catch (ChaiUnavailableException | ChaiOperationException e) {
-                LOGGER.error("error while reading canonicalDN for dn value '" + dnValue + "', error: " + e.getMessage());
+                LOGGER.trace( "read and cached canonical ldap DN value for input '" + dnValue + "' as '" + canonicalValue + "'" );
+            }
+            catch ( ChaiUnavailableException | ChaiOperationException e )
+            {
+                LOGGER.error( "error while reading canonicalDN for dn value '" + dnValue + "', error: " + e.getMessage() );
                 return dnValue;
             }
         }

+ 82 - 52
server/src/main/java/password/pwm/config/profile/NewUserProfile.java

@@ -45,104 +45,134 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
-public class NewUserProfile extends AbstractProfile {
+public class NewUserProfile extends AbstractProfile
+{
 
     private static final ProfileType PROFILE_TYPE = ProfileType.NewUser;
 
     private Instant newUserPasswordPolicyCacheTime;
-    private final Map<Locale,PwmPasswordPolicy> newUserPasswordPolicyCache = new HashMap<>();
+    private final Map<Locale, PwmPasswordPolicy> newUserPasswordPolicyCache = new HashMap<>();
 
-    protected NewUserProfile(final String identifier, final Map<PwmSetting, StoredValue> storedValueMap) {
-        super(identifier, storedValueMap);
+    protected NewUserProfile( final String identifier, final Map<PwmSetting, StoredValue> storedValueMap )
+    {
+        super( identifier, storedValueMap );
     }
 
-    public static NewUserProfile makeFromStoredConfiguration(final StoredConfiguration storedConfiguration, final String identifier) {
-        final Map<PwmSetting,StoredValue> valueMap = makeValueMap(storedConfiguration, identifier, PROFILE_TYPE.getCategory());
-        return new NewUserProfile(identifier, valueMap);
+    public static NewUserProfile makeFromStoredConfiguration( final StoredConfiguration storedConfiguration, final String identifier )
+    {
+        final Map<PwmSetting, StoredValue> valueMap = makeValueMap( storedConfiguration, identifier, PROFILE_TYPE.getCategory() );
+        return new NewUserProfile( identifier, valueMap );
 
     }
 
     @Override
-    public ProfileType profileType() {
+    public ProfileType profileType( )
+    {
         return PROFILE_TYPE;
     }
 
     @Override
-    public String getDisplayName(final Locale locale) {
-        final String value = this.readSettingAsLocalizedString(PwmSetting.NEWUSER_PROFILE_DISPLAY_NAME, locale);
+    public String getDisplayName( final Locale locale )
+    {
+        final String value = this.readSettingAsLocalizedString( PwmSetting.NEWUSER_PROFILE_DISPLAY_NAME, locale );
         return value != null && !value.isEmpty() ? value : this.getIdentifier();
     }
 
-    public PwmPasswordPolicy getNewUserPasswordPolicy(final PwmApplication pwmApplication, final Locale userLocale)
+    public PwmPasswordPolicy getNewUserPasswordPolicy( final PwmApplication pwmApplication, final Locale userLocale )
             throws PwmUnrecoverableException
     {
         final Configuration config = pwmApplication.getConfig();
-        final long maxNewUserCacheMS = Long.parseLong(pwmApplication.getConfig().readAppProperty(AppProperty.CONFIG_NEWUSER_PASSWORD_POLICY_CACHE_MS));
-        if (newUserPasswordPolicyCacheTime != null && TimeDuration.fromCurrent(newUserPasswordPolicyCacheTime).isLongerThan(maxNewUserCacheMS)) {
+        final long maxNewUserCacheMS = Long.parseLong( pwmApplication.getConfig().readAppProperty( AppProperty.CONFIG_NEWUSER_PASSWORD_POLICY_CACHE_MS ) );
+        if ( newUserPasswordPolicyCacheTime != null && TimeDuration.fromCurrent( newUserPasswordPolicyCacheTime ).isLongerThan( maxNewUserCacheMS ) )
+        {
             newUserPasswordPolicyCacheTime = Instant.now();
             newUserPasswordPolicyCache.clear();
         }
 
-        final PwmPasswordPolicy cachedPolicy = newUserPasswordPolicyCache.get(userLocale);
-        if (cachedPolicy != null) {
+        final PwmPasswordPolicy cachedPolicy = newUserPasswordPolicyCache.get( userLocale );
+        if ( cachedPolicy != null )
+        {
             return cachedPolicy;
         }
-        
+
         final PwmPasswordPolicy thePolicy;
         final LdapProfile defaultLdapProfile = config.getDefaultLdapProfile();
-        final String configuredNewUserPasswordDN = readSettingAsString(PwmSetting.NEWUSER_PASSWORD_POLICY_USER);
-        if (configuredNewUserPasswordDN == null || configuredNewUserPasswordDN.length() < 1) {
-            final String errorMsg = "the setting " + PwmSetting.NEWUSER_PASSWORD_POLICY_USER.toMenuLocationDebug(this.getIdentifier(),PwmConstants.DEFAULT_LOCALE) + " must have a value";
-            throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_INVALID_CONFIG,errorMsg));
-        } else {
+        final String configuredNewUserPasswordDN = readSettingAsString( PwmSetting.NEWUSER_PASSWORD_POLICY_USER );
+        if ( configuredNewUserPasswordDN == null || configuredNewUserPasswordDN.length() < 1 )
+        {
+            final String errorMsg = "the setting " + PwmSetting.NEWUSER_PASSWORD_POLICY_USER.toMenuLocationDebug( this.getIdentifier(), PwmConstants.DEFAULT_LOCALE )
+                    + " must have a value";
+            throw new PwmUnrecoverableException( new ErrorInformation( PwmError.ERROR_INVALID_CONFIG, errorMsg ) );
+        }
+        else
+        {
 
             final String lookupDN;
-            if ("TESTUSER".equalsIgnoreCase(configuredNewUserPasswordDN)) {
-                lookupDN = defaultLdapProfile.readSettingAsString(PwmSetting.LDAP_TEST_USER_DN);
-                if (lookupDN == null || lookupDN.isEmpty()) {
-                    final String errorMsg ="setting " 
-                            + PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug(defaultLdapProfile.getIdentifier(),PwmConstants.DEFAULT_LOCALE) 
+            if ( "TESTUSER".equalsIgnoreCase( configuredNewUserPasswordDN ) )
+            {
+                lookupDN = defaultLdapProfile.readSettingAsString( PwmSetting.LDAP_TEST_USER_DN );
+                if ( lookupDN == null || lookupDN.isEmpty() )
+                {
+                    final String errorMsg = "setting "
+                            + PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( defaultLdapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE )
                             + " must be configured since setting "
-                            + PwmSetting.NEWUSER_PASSWORD_POLICY_USER.toMenuLocationDebug(this.getIdentifier(),PwmConstants.DEFAULT_LOCALE)
+                            + PwmSetting.NEWUSER_PASSWORD_POLICY_USER.toMenuLocationDebug( this.getIdentifier(), PwmConstants.DEFAULT_LOCALE )
                             + " is set to TESTUSER";
-                    throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_INVALID_CONFIG,errorMsg));
+                    throw new PwmUnrecoverableException( new ErrorInformation( PwmError.ERROR_INVALID_CONFIG, errorMsg ) );
                 }
-            } else {
+            }
+            else
+            {
                 lookupDN = configuredNewUserPasswordDN;
             }
 
-            if (lookupDN.isEmpty()) {
-                throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_INVALID_CONFIG,"user ldap dn in setting " + PwmSetting.NEWUSER_PASSWORD_POLICY_USER.toMenuLocationDebug(null,PwmConstants.DEFAULT_LOCALE) + " can not be resolved"));
-            } else {
-                try {
-                    final ChaiProvider chaiProvider = pwmApplication.getProxyChaiProvider(defaultLdapProfile.getIdentifier());
-                    final ChaiUser chaiUser = chaiProvider.getEntryFactory().newChaiUser(lookupDN);
-                    final UserIdentity userIdentity = new UserIdentity(lookupDN, defaultLdapProfile.getIdentifier());
-                    thePolicy = PasswordUtility.readPasswordPolicyForUser(pwmApplication, null, userIdentity, chaiUser, userLocale);
-                } catch (ChaiUnavailableException e) {
-                    throw new PwmUnrecoverableException(PwmError.forChaiError(e.getErrorCode()));
+            if ( lookupDN.isEmpty() )
+            {
+                throw new PwmUnrecoverableException( new ErrorInformation(
+                        PwmError.ERROR_INVALID_CONFIG,
+                        "user ldap dn in setting " + PwmSetting.NEWUSER_PASSWORD_POLICY_USER.toMenuLocationDebug(
+                                null,
+                                PwmConstants.DEFAULT_LOCALE ) + " can not be resolved" )
+                );
+            }
+            else
+            {
+                try
+                {
+                    final ChaiProvider chaiProvider = pwmApplication.getProxyChaiProvider( defaultLdapProfile.getIdentifier() );
+                    final ChaiUser chaiUser = chaiProvider.getEntryFactory().newChaiUser( lookupDN );
+                    final UserIdentity userIdentity = new UserIdentity( lookupDN, defaultLdapProfile.getIdentifier() );
+                    thePolicy = PasswordUtility.readPasswordPolicyForUser( pwmApplication, null, userIdentity, chaiUser, userLocale );
+                }
+                catch ( ChaiUnavailableException e )
+                {
+                    throw new PwmUnrecoverableException( PwmError.forChaiError( e.getErrorCode() ) );
                 }
             }
         }
-        newUserPasswordPolicyCache.put(userLocale,thePolicy);
+        newUserPasswordPolicyCache.put( userLocale, thePolicy );
         return thePolicy;
     }
 
-    public TimeDuration getTokenDurationEmail(final Configuration configuration) {
-        final long newUserDuration = readSettingAsLong(PwmSetting.NEWUSER_TOKEN_LIFETIME_EMAIL);
-        if (newUserDuration < 1) {
-            final long defaultDuration = configuration.readSettingAsLong(PwmSetting.TOKEN_LIFETIME);
-            return new TimeDuration(defaultDuration, TimeUnit.SECONDS);
+    public TimeDuration getTokenDurationEmail( final Configuration configuration )
+    {
+        final long newUserDuration = readSettingAsLong( PwmSetting.NEWUSER_TOKEN_LIFETIME_EMAIL );
+        if ( newUserDuration < 1 )
+        {
+            final long defaultDuration = configuration.readSettingAsLong( PwmSetting.TOKEN_LIFETIME );
+            return new TimeDuration( defaultDuration, TimeUnit.SECONDS );
         }
-        return new TimeDuration(newUserDuration, TimeUnit.SECONDS);
+        return new TimeDuration( newUserDuration, TimeUnit.SECONDS );
     }
 
-    public TimeDuration getTokenDurationSMS(final Configuration configuration) {
-        final long newUserDuration = readSettingAsLong(PwmSetting.NEWUSER_TOKEN_LIFETIME_SMS);
-        if (newUserDuration < 1) {
-            final long defaultDuration = configuration.readSettingAsLong(PwmSetting.TOKEN_LIFETIME);
-            return new TimeDuration(defaultDuration, TimeUnit.SECONDS);
+    public TimeDuration getTokenDurationSMS( final Configuration configuration )
+    {
+        final long newUserDuration = readSettingAsLong( PwmSetting.NEWUSER_TOKEN_LIFETIME_SMS );
+        if ( newUserDuration < 1 )
+        {
+            final long defaultDuration = configuration.readSettingAsLong( PwmSetting.TOKEN_LIFETIME );
+            return new TimeDuration( defaultDuration, TimeUnit.SECONDS );
         }
-        return new TimeDuration(newUserDuration, TimeUnit.SECONDS);
+        return new TimeDuration( newUserDuration, TimeUnit.SECONDS );
     }
 }

+ 6 - 5
server/src/main/java/password/pwm/config/profile/Profile.java

@@ -28,12 +28,13 @@ import java.io.Serializable;
 import java.util.List;
 import java.util.Locale;
 
-public interface Profile extends Serializable {
-    ProfileType profileType();
+public interface Profile extends Serializable
+{
+    ProfileType profileType( );
 
-    String getIdentifier();
+    String getIdentifier( );
 
-    String getDisplayName(Locale locale);
+    String getDisplayName( Locale locale );
 
-    List<UserPermission> getPermissionMatches();
+    List<UserPermission> getPermissionMatches( );
 }

+ 16 - 12
server/src/main/java/password/pwm/config/profile/ProfileType.java

@@ -25,33 +25,37 @@ package password.pwm.config.profile;
 import password.pwm.config.PwmSetting;
 import password.pwm.config.PwmSettingCategory;
 
-public enum ProfileType {
-    Helpdesk            (true,  PwmSettingCategory.HELPDESK_PROFILE,    PwmSetting.HELPDESK_PROFILE_QUERY_MATCH),
-    ForgottenPassword   (false, PwmSettingCategory.RECOVERY_PROFILE,    PwmSetting.RECOVERY_PROFILE_QUERY_MATCH),
-    NewUser             (false, PwmSettingCategory.NEWUSER_PROFILE,     null),
-    UpdateAttributes    (true,  PwmSettingCategory.UPDATE_PROFILE,      PwmSetting.UPDATE_PROFILE_QUERY_MATCH),
-    DeleteAccount(true,  PwmSettingCategory.DELETE_ACCOUNT_PROFILE, PwmSetting.DELETE_ACCOUNT_PERMISSION),
-    ;
-    
+public enum ProfileType
+{
+    Helpdesk( true, PwmSettingCategory.HELPDESK_PROFILE, PwmSetting.HELPDESK_PROFILE_QUERY_MATCH ),
+    ForgottenPassword( false, PwmSettingCategory.RECOVERY_PROFILE, PwmSetting.RECOVERY_PROFILE_QUERY_MATCH ),
+    NewUser( false, PwmSettingCategory.NEWUSER_PROFILE, null ),
+    UpdateAttributes( true, PwmSettingCategory.UPDATE_PROFILE, PwmSetting.UPDATE_PROFILE_QUERY_MATCH ),
+    DeleteAccount( true, PwmSettingCategory.DELETE_ACCOUNT_PROFILE, PwmSetting.DELETE_ACCOUNT_PERMISSION ),;
+
     private final boolean authenticated;
     private final PwmSettingCategory category;
     private final PwmSetting queryMatch;
 
-    ProfileType(final boolean authenticated, final PwmSettingCategory category, final PwmSetting queryMatch) {
+    ProfileType( final boolean authenticated, final PwmSettingCategory category, final PwmSetting queryMatch )
+    {
         this.authenticated = authenticated;
         this.category = category;
         this.queryMatch = queryMatch;
     }
 
-    public boolean isAuthenticated() {
+    public boolean isAuthenticated( )
+    {
         return authenticated;
     }
 
-    public PwmSettingCategory getCategory() {
+    public PwmSettingCategory getCategory( )
+    {
         return category;
     }
 
-    public PwmSetting getQueryMatch() {
+    public PwmSetting getQueryMatch( )
+    {
         return queryMatch;
     }
 }

+ 13 - 9
server/src/main/java/password/pwm/config/profile/ProfileUtility.java

@@ -36,9 +36,10 @@ import password.pwm.util.logging.PwmLogger;
 import java.util.List;
 import java.util.Map;
 
-public class ProfileUtility {
-    private static final PwmLogger LOGGER = PwmLogger.forClass(ProfileUtility.class);
-    
+public class ProfileUtility
+{
+    private static final PwmLogger LOGGER = PwmLogger.forClass( ProfileUtility.class );
+
     public static String discoverProfileIDforUser(
             final PwmApplication pwmApplication,
             final SessionLabel sessionLabel,
@@ -47,20 +48,23 @@ public class ProfileUtility {
     )
             throws PwmUnrecoverableException
     {
-        final Map<String,Profile> profileMap = pwmApplication.getConfig().profileMap(profileType);
-        for (final Profile profile : profileMap.values()) {
+        final Map<String, Profile> profileMap = pwmApplication.getConfig().profileMap( profileType );
+        for ( final Profile profile : profileMap.values() )
+        {
             final List<UserPermission> queryMatches = profile.getPermissionMatches();
-            final boolean match = LdapPermissionTester.testUserPermissions(pwmApplication, sessionLabel, userIdentity, queryMatches);
-            if (match) {
+            final boolean match = LdapPermissionTester.testUserPermissions( pwmApplication, sessionLabel, userIdentity, queryMatches );
+            if ( match )
+            {
                 return profile.getIdentifier();
             }
         }
         return null;
     }
 
-    public static List<String> profileIDsForCategory(final Configuration configuration, final PwmSettingCategory pwmSettingCategory) {
+    public static List<String> profileIDsForCategory( final Configuration configuration, final PwmSettingCategory pwmSettingCategory )
+    {
         final PwmSetting profileSetting = pwmSettingCategory.getProfileSetting();
-        return configuration.readSettingAsStringArray(profileSetting);
+        return configuration.readSettingAsStringArray( profileSetting );
     }
 
 

+ 249 - 164
server/src/main/java/password/pwm/config/profile/PwmPasswordPolicy.java

@@ -27,8 +27,8 @@ import com.novell.ldapchai.ChaiPasswordRule;
 import com.novell.ldapchai.util.DefaultChaiPasswordPolicy;
 import com.novell.ldapchai.util.PasswordRuleHelper;
 import com.novell.ldapchai.util.StringHelper;
-import password.pwm.config.value.data.UserPermission;
 import password.pwm.config.option.ADPolicyComplexity;
+import password.pwm.config.value.data.UserPermission;
 import password.pwm.health.HealthMessage;
 import password.pwm.health.HealthRecord;
 import password.pwm.util.java.JavaHelper;
@@ -54,9 +54,10 @@ import java.util.regex.PatternSyntaxException;
 /**
  * @author Jason D. Rivard
  */
-public class PwmPasswordPolicy implements Profile,Serializable {
+public class PwmPasswordPolicy implements Profile, Serializable
+{
 
-    private static final PwmLogger LOGGER = PwmLogger.forClass(PwmPasswordPolicy.class);
+    private static final PwmLogger LOGGER = PwmLogger.forClass( PwmPasswordPolicy.class );
 
     private static final PwmPasswordPolicy DEFAULT_POLICY;
 
@@ -71,33 +72,42 @@ public class PwmPasswordPolicy implements Profile,Serializable {
     public static PwmPasswordPolicy createPwmPasswordPolicy(
             final Map<String, String> policyMap,
             final ChaiPasswordPolicy chaiPasswordPolicy
-    ) {
-        return new PwmPasswordPolicy(policyMap, chaiPasswordPolicy);
+    )
+    {
+        return new PwmPasswordPolicy( policyMap, chaiPasswordPolicy );
     }
 
-    public String getIdentifier() {
+    public String getIdentifier( )
+    {
         return profileID;
     }
 
-    public String getDisplayName(final Locale locale) {
+    public String getDisplayName( final Locale locale )
+    {
         return getIdentifier();
     }
 
-    static {
+    static
+    {
         PwmPasswordPolicy newDefaultPolicy = null;
-        try {
+        try
+        {
             final Map<String, String> defaultPolicyMap = new HashMap<>();
-            for (final PwmPasswordRule rule : PwmPasswordRule.values()) {
-                defaultPolicyMap.put(rule.getKey(), rule.getDefaultValue());
+            for ( final PwmPasswordRule rule : PwmPasswordRule.values() )
+            {
+                defaultPolicyMap.put( rule.getKey(), rule.getDefaultValue() );
             }
-            newDefaultPolicy = createPwmPasswordPolicy(defaultPolicyMap, null);
-        } catch (Throwable t) {
-            LOGGER.fatal("error initializing PwmPasswordPolicy class: " + t.getMessage(), t);
+            newDefaultPolicy = createPwmPasswordPolicy( defaultPolicyMap, null );
+        }
+        catch ( Throwable t )
+        {
+            LOGGER.fatal( "error initializing PwmPasswordPolicy class: " + t.getMessage(), t );
         }
         DEFAULT_POLICY = newDefaultPolicy;
     }
 
-    public static PwmPasswordPolicy defaultPolicy() {
+    public static PwmPasswordPolicy defaultPolicy( )
+    {
         return DEFAULT_POLICY;
     }
 
@@ -105,123 +115,150 @@ public class PwmPasswordPolicy implements Profile,Serializable {
     private PwmPasswordPolicy(
             final Map<String, String> policyMap,
             final ChaiPasswordPolicy chaiPasswordPolicy
-    ) {
-        if (policyMap != null) {
-            this.policyMap.putAll(policyMap);
+    )
+    {
+        if ( policyMap != null )
+        {
+            this.policyMap.putAll( policyMap );
         }
-        if (chaiPasswordPolicy != null) {
-            if (Boolean.parseBoolean(chaiPasswordPolicy.getValue(ChaiPasswordRule.ADComplexity))) {
-                this.policyMap.put(PwmPasswordRule.ADComplexityLevel.getKey(), ADPolicyComplexity.AD2003.toString());
-            } else if (Boolean.parseBoolean(chaiPasswordPolicy.getValue(ChaiPasswordRule.ADComplexity2008))) {
-                this.policyMap.put(PwmPasswordRule.ADComplexityLevel.getKey(), ADPolicyComplexity.AD2008.toString());
+        if ( chaiPasswordPolicy != null )
+        {
+            if ( Boolean.parseBoolean( chaiPasswordPolicy.getValue( ChaiPasswordRule.ADComplexity ) ) )
+            {
+                this.policyMap.put( PwmPasswordRule.ADComplexityLevel.getKey(), ADPolicyComplexity.AD2003.toString() );
+            }
+            else if ( Boolean.parseBoolean( chaiPasswordPolicy.getValue( ChaiPasswordRule.ADComplexity2008 ) ) )
+            {
+                this.policyMap.put( PwmPasswordRule.ADComplexityLevel.getKey(), ADPolicyComplexity.AD2008.toString() );
             }
         }
         this.chaiPasswordPolicy = chaiPasswordPolicy;
     }
 
     @Override
-    public String toString() {
-        return "PwmPasswordPolicy" + ": " + JsonUtil.serialize(this);
+    public String toString( )
+    {
+        return "PwmPasswordPolicy" + ": " + JsonUtil.serialize( this );
     }
 
-    public ChaiPasswordPolicy getChaiPasswordPolicy() {
+    public ChaiPasswordPolicy getChaiPasswordPolicy( )
+    {
         return chaiPasswordPolicy;
     }
 
-    public RuleHelper getRuleHelper() {
-        return new RuleHelper(this);
+    public RuleHelper getRuleHelper( )
+    {
+        return new RuleHelper( this );
     }
 
-    public String getValue(final PwmPasswordRule rule) {
-        return policyMap.get(rule.getKey());
+    public String getValue( final PwmPasswordRule rule )
+    {
+        return policyMap.get( rule.getKey() );
     }
 
-    public void setProfileID(final String profileID) {
+    public void setProfileID( final String profileID )
+    {
         this.profileID = profileID;
     }
 
-    public List<UserPermission> getUserPermissions() {
+    public List<UserPermission> getUserPermissions( )
+    {
         return userPermissions;
     }
 
-    public void setUserPermissions(final List<UserPermission> userPermissions) {
+    public void setUserPermissions( final List<UserPermission> userPermissions )
+    {
         this.userPermissions = userPermissions;
     }
 
-    public String getRuleText() {
+    public String getRuleText( )
+    {
         return ruleText;
     }
 
-    public void setRuleText(final String ruleText) {
+    public void setRuleText( final String ruleText )
+    {
         this.ruleText = ruleText;
     }
 
-    public PwmPasswordPolicy merge(final PwmPasswordPolicy otherPolicy) {
-        if (otherPolicy == null) {
+    public PwmPasswordPolicy merge( final PwmPasswordPolicy otherPolicy )
+    {
+        if ( otherPolicy == null )
+        {
             return this;
         }
 
         final Map<String, String> newPasswordPolicies = new HashMap<>();
 
-        for (final PwmPasswordRule rule : PwmPasswordRule.values()) {
+        for ( final PwmPasswordRule rule : PwmPasswordRule.values() )
+        {
             final String ruleKey = rule.getKey();
-            if (this.policyMap.containsKey(ruleKey) || otherPolicy.policyMap.containsKey(ruleKey)) {
+            if ( this.policyMap.containsKey( ruleKey ) || otherPolicy.policyMap.containsKey( ruleKey ) )
+            {
 
-                switch (rule) {
+                switch ( rule )
+                {
                     case DisallowedValues:
                     case DisallowedAttributes:
                     case RegExMatch:
                     case RegExNoMatch:
                     case CharGroupsValues:
-                        final String seperator = (rule == PwmPasswordRule.RegExMatch || rule == PwmPasswordRule.RegExNoMatch) ? ";;;" : "\n";
+                        final String seperator = ( rule == PwmPasswordRule.RegExMatch || rule == PwmPasswordRule.RegExNoMatch ) ? ";;;" : "\n";
                         final Set<String> combinedSet = new HashSet<>();
-                        combinedSet.addAll(StringHelper.tokenizeString(this.policyMap.get(rule.getKey()), seperator));
-                        combinedSet.addAll(StringHelper.tokenizeString(otherPolicy.policyMap.get(rule.getKey()), seperator));
-                        newPasswordPolicies.put(ruleKey, StringHelper.stringCollectionToString(combinedSet, seperator));
+                        combinedSet.addAll( StringHelper.tokenizeString( this.policyMap.get( rule.getKey() ), seperator ) );
+                        combinedSet.addAll( StringHelper.tokenizeString( otherPolicy.policyMap.get( rule.getKey() ), seperator ) );
+                        newPasswordPolicies.put( ruleKey, StringHelper.stringCollectionToString( combinedSet, seperator ) );
                         break;
 
                     case ChangeMessage:
-                        final String thisChangeMessage = getValue(PwmPasswordRule.ChangeMessage);
-                        if (thisChangeMessage == null || thisChangeMessage.length() < 1) {
-                            newPasswordPolicies.put(ruleKey, otherPolicy.getValue(PwmPasswordRule.ChangeMessage));
-                        } else {
-                            newPasswordPolicies.put(ruleKey, getValue(PwmPasswordRule.ChangeMessage));
+                        final String thisChangeMessage = getValue( PwmPasswordRule.ChangeMessage );
+                        if ( thisChangeMessage == null || thisChangeMessage.length() < 1 )
+                        {
+                            newPasswordPolicies.put( ruleKey, otherPolicy.getValue( PwmPasswordRule.ChangeMessage ) );
+                        }
+                        else
+                        {
+                            newPasswordPolicies.put( ruleKey, getValue( PwmPasswordRule.ChangeMessage ) );
                         }
                         break;
 
                     case ExpirationInterval:
-                        final String expirationIntervalLocalValue = StringUtil.defaultString(policyMap.get(ruleKey), rule.getDefaultValue());
-                        final String expirationIntervalOtherValue = StringUtil.defaultString(otherPolicy.policyMap.get(ruleKey), rule.getDefaultValue());
-                        newPasswordPolicies.put(ruleKey, mergeMin(expirationIntervalLocalValue, expirationIntervalOtherValue));
+                        final String expirationIntervalLocalValue = StringUtil.defaultString( policyMap.get( ruleKey ), rule.getDefaultValue() );
+                        final String expirationIntervalOtherValue = StringUtil.defaultString( otherPolicy.policyMap.get( ruleKey ), rule.getDefaultValue() );
+                        newPasswordPolicies.put( ruleKey, mergeMin( expirationIntervalLocalValue, expirationIntervalOtherValue ) );
                         break;
 
                     case MinimumLifetime:
-                        final String minimumLifetimeLocalValue = StringUtil.defaultString(policyMap.get(ruleKey), rule.getDefaultValue());
-                        final String minimumLifetimeOtherValue = StringUtil.defaultString(otherPolicy.policyMap.get(ruleKey), rule.getDefaultValue());
-                        newPasswordPolicies.put(ruleKey, mergeMin(minimumLifetimeLocalValue, minimumLifetimeOtherValue));
+                        final String minimumLifetimeLocalValue = StringUtil.defaultString( policyMap.get( ruleKey ), rule.getDefaultValue() );
+                        final String minimumLifetimeOtherValue = StringUtil.defaultString( otherPolicy.policyMap.get( ruleKey ), rule.getDefaultValue() );
+                        newPasswordPolicies.put( ruleKey, mergeMin( minimumLifetimeLocalValue, minimumLifetimeOtherValue ) );
                         break;
 
                     default:
-                        final String localValueString = StringUtil.defaultString(policyMap.get(ruleKey), rule.getDefaultValue());
-                        final String otherValueString = StringUtil.defaultString(otherPolicy.policyMap.get(ruleKey), rule.getDefaultValue());
+                        final String localValueString = StringUtil.defaultString( policyMap.get( ruleKey ), rule.getDefaultValue() );
+                        final String otherValueString = StringUtil.defaultString( otherPolicy.policyMap.get( ruleKey ), rule.getDefaultValue() );
 
-                        switch (rule.getRuleType()) {
+                        switch ( rule.getRuleType() )
+                        {
                             case MIN:
-                                newPasswordPolicies.put(ruleKey, mergeMin(localValueString, otherValueString));
+                                newPasswordPolicies.put( ruleKey, mergeMin( localValueString, otherValueString ) );
                                 break;
 
                             case MAX:
-                                newPasswordPolicies.put(ruleKey, mergeMax(localValueString, otherValueString));
+                                newPasswordPolicies.put( ruleKey, mergeMax( localValueString, otherValueString ) );
                                 break;
 
                             case BOOLEAN:
-                                final boolean localValue = StringHelper.convertStrToBoolean(localValueString);
-                                final boolean otherValue = StringHelper.convertStrToBoolean(otherValueString);
+                                final boolean localValue = StringHelper.convertStrToBoolean( localValueString );
+                                final boolean otherValue = StringHelper.convertStrToBoolean( otherValueString );
 
-                                if (rule.isPositiveBooleanMerge()) {
-                                    newPasswordPolicies.put(ruleKey, String.valueOf(localValue || otherValue));
-                                } else {
-                                    newPasswordPolicies.put(ruleKey, String.valueOf(localValue && otherValue));
+                                if ( rule.isPositiveBooleanMerge() )
+                                {
+                                    newPasswordPolicies.put( ruleKey, String.valueOf( localValue || otherValue ) );
+                                }
+                                else
+                                {
+                                    newPasswordPolicies.put( ruleKey, String.valueOf( localValue && otherValue ) );
                                 }
                                 break;
 
@@ -234,74 +271,96 @@ public class PwmPasswordPolicy implements Profile,Serializable {
         }
 
         final ChaiPasswordPolicy backingPolicy = this.chaiPasswordPolicy != null ? chaiPasswordPolicy : otherPolicy.chaiPasswordPolicy;
-        final PwmPasswordPolicy returnPolicy = createPwmPasswordPolicy(newPasswordPolicies, backingPolicy);
-        final String newRuleText = (ruleText != null && !ruleText.isEmpty()) ? ruleText : otherPolicy.ruleText;
-        returnPolicy.setRuleText(newRuleText);
+        final PwmPasswordPolicy returnPolicy = createPwmPasswordPolicy( newPasswordPolicies, backingPolicy );
+        final String newRuleText = ( ruleText != null && !ruleText.isEmpty() ) ? ruleText : otherPolicy.ruleText;
+        returnPolicy.setRuleText( newRuleText );
         return returnPolicy;
     }
 
-    protected static String mergeMin(final String value1, final String value2) {
-        final int iValue1 = StringHelper.convertStrToInt(value1, 0);
-        final int iValue2 = StringHelper.convertStrToInt(value2, 0);
+    protected static String mergeMin( final String value1, final String value2 )
+    {
+        final int iValue1 = StringHelper.convertStrToInt( value1, 0 );
+        final int iValue2 = StringHelper.convertStrToInt( value2, 0 );
 
         // take the largest value
         return iValue1 > iValue2 ? value1 : value2;
     }
 
-    protected static String mergeMax(final String value1, final String value2) {
-        final int iValue1 = StringHelper.convertStrToInt(value1, 0);
-        final int iValue2 = StringHelper.convertStrToInt(value2, 0);
+    protected static String mergeMax( final String value1, final String value2 )
+    {
+        final int iValue1 = StringHelper.convertStrToInt( value1, 0 );
+        final int iValue2 = StringHelper.convertStrToInt( value2, 0 );
 
         final String returnValue;
 
         // if one of the values is zero, take the other one.
-        if (iValue1 == 0 || iValue2 == 0) {
+        if ( iValue1 == 0 || iValue2 == 0 )
+        {
             returnValue = iValue1 > iValue2 ? value1 : value2;
 
             // else take the smaller value
-        } else {
+        }
+        else
+        {
             returnValue = iValue1 < iValue2 ? value1 : value2;
         }
 
         return returnValue;
     }
 
-    public static PwmPasswordPolicy createPwmPasswordPolicy(final Map<String, String> policyMap) {
-        return createPwmPasswordPolicy(policyMap, null);
+    public static PwmPasswordPolicy createPwmPasswordPolicy( final Map<String, String> policyMap )
+    {
+        return createPwmPasswordPolicy( policyMap, null );
     }
 
-    public static class RuleHelper {
-        public enum Flag { KeepThresholds }
+    public static class RuleHelper
+    {
+        public enum Flag
+        {
+            KeepThresholds
+        }
 
         private final PwmPasswordPolicy passwordPolicy;
         private final PasswordRuleHelper chaiRuleHelper;
 
-        public RuleHelper(final PwmPasswordPolicy passwordPolicy) {
+        public RuleHelper( final PwmPasswordPolicy passwordPolicy )
+        {
             this.passwordPolicy = passwordPolicy;
-            chaiRuleHelper = DefaultChaiPasswordPolicy.createDefaultChaiPasswordPolicy(passwordPolicy.policyMap).getRuleHelper();
+            chaiRuleHelper = DefaultChaiPasswordPolicy.createDefaultChaiPasswordPolicy( passwordPolicy.policyMap ).getRuleHelper();
         }
 
-        public List<String> getDisallowedValues() {
+        public List<String> getDisallowedValues( )
+        {
             return chaiRuleHelper.getDisallowedValues();
         }
 
-        public List<String> getDisallowedAttributes(final Flag ... flags) {
+        public List<String> getDisallowedAttributes( final Flag... flags )
+        {
             final List<String> disallowedAttributes = chaiRuleHelper.getDisallowedAttributes();
 
-            if (JavaHelper.enumArrayContainsValue(flags, Flag.KeepThresholds)) {
+            if ( JavaHelper.enumArrayContainsValue( flags, Flag.KeepThresholds ) )
+            {
                 return disallowedAttributes;
-            } else {
+            }
+            else
+            {
                 // Strip off any thresholds from attribute (specified as: "attributeName:N", where N is a numeric value).
                 final List<String> strippedDisallowedAttributes = new ArrayList<String>();
 
-                if (disallowedAttributes != null) {
-                    for (final String disallowedAttribute : disallowedAttributes) {
-                        if (disallowedAttribute != null) {
-                            final int indexOfColon = disallowedAttribute.indexOf(':');
-                            if (indexOfColon > 0) {
-                                strippedDisallowedAttributes.add(disallowedAttribute.substring(0, indexOfColon));
-                            } else {
-                                strippedDisallowedAttributes.add(disallowedAttribute);
+                if ( disallowedAttributes != null )
+                {
+                    for ( final String disallowedAttribute : disallowedAttributes )
+                    {
+                        if ( disallowedAttribute != null )
+                        {
+                            final int indexOfColon = disallowedAttribute.indexOf( ':' );
+                            if ( indexOfColon > 0 )
+                            {
+                                strippedDisallowedAttributes.add( disallowedAttribute.substring( 0, indexOfColon ) );
+                            }
+                            else
+                            {
+                                strippedDisallowedAttributes.add( disallowedAttribute );
                             }
                         }
                     }
@@ -311,70 +370,86 @@ public class PwmPasswordPolicy implements Profile,Serializable {
             }
         }
 
-        public List<Pattern> getRegExMatch(final MacroMachine macroMachine) {
-            return readRegExSetting(PwmPasswordRule.RegExMatch, macroMachine);
+        public List<Pattern> getRegExMatch( final MacroMachine macroMachine )
+        {
+            return readRegExSetting( PwmPasswordRule.RegExMatch, macroMachine );
         }
 
-        public List<Pattern> getRegExNoMatch(final MacroMachine macroMachine) {
-            return readRegExSetting(PwmPasswordRule.RegExNoMatch, macroMachine);
+        public List<Pattern> getRegExNoMatch( final MacroMachine macroMachine )
+        {
+            return readRegExSetting( PwmPasswordRule.RegExNoMatch, macroMachine );
         }
 
-        public List<Pattern> getCharGroupValues() {
-            return readRegExSetting(PwmPasswordRule.CharGroupsValues, null);
+        public List<Pattern> getCharGroupValues( )
+        {
+            return readRegExSetting( PwmPasswordRule.CharGroupsValues, null );
         }
 
 
-        public int readIntValue(final PwmPasswordRule rule) {
+        public int readIntValue( final PwmPasswordRule rule )
+        {
             if (
-                    (rule.getRuleType() != ChaiPasswordRule.RuleType.MIN) &&
-                            (rule.getRuleType() != ChaiPasswordRule.RuleType.MAX) &&
-                            (rule.getRuleType() != ChaiPasswordRule.RuleType.NUMERIC)
-                    ) {
-                throw new IllegalArgumentException("attempt to read non-numeric rule value as int for rule " + rule);
+                    ( rule.getRuleType() != ChaiPasswordRule.RuleType.MIN )
+                            && ( rule.getRuleType() != ChaiPasswordRule.RuleType.MAX )
+                            && ( rule.getRuleType() != ChaiPasswordRule.RuleType.NUMERIC )
+                    )
+            {
+                throw new IllegalArgumentException( "attempt to read non-numeric rule value as int for rule " + rule );
             }
 
-            final String value = passwordPolicy.policyMap.get(rule.getKey());
-            final int defaultValue = StringHelper.convertStrToInt(rule.getDefaultValue(), 0);
-            return StringHelper.convertStrToInt(value, defaultValue);
+            final String value = passwordPolicy.policyMap.get( rule.getKey() );
+            final int defaultValue = StringHelper.convertStrToInt( rule.getDefaultValue(), 0 );
+            return StringHelper.convertStrToInt( value, defaultValue );
         }
 
-        public boolean readBooleanValue(final PwmPasswordRule rule) {
-            if (rule.getRuleType() != ChaiPasswordRule.RuleType.BOOLEAN) {
-                throw new IllegalArgumentException("attempt to read non-boolean rule value as boolean for rule " + rule);
+        public boolean readBooleanValue( final PwmPasswordRule rule )
+        {
+            if ( rule.getRuleType() != ChaiPasswordRule.RuleType.BOOLEAN )
+            {
+                throw new IllegalArgumentException( "attempt to read non-boolean rule value as boolean for rule " + rule );
             }
 
-            final String value = passwordPolicy.policyMap.get(rule.getKey());
-            return StringHelper.convertStrToBoolean(value);
+            final String value = passwordPolicy.policyMap.get( rule.getKey() );
+            return StringHelper.convertStrToBoolean( value );
         }
 
-        private List<Pattern> readRegExSetting(final PwmPasswordRule rule, final MacroMachine macroMachine) {
-            final String input = passwordPolicy.policyMap.get(rule.getKey());
+        private List<Pattern> readRegExSetting( final PwmPasswordRule rule, final MacroMachine macroMachine )
+        {
+            final String input = passwordPolicy.policyMap.get( rule.getKey() );
 
-            return readRegExSetting(rule, macroMachine, input);
+            return readRegExSetting( rule, macroMachine, input );
         }
 
-        List<Pattern> readRegExSetting(final PwmPasswordRule rule, final MacroMachine macroMachine, final String input) {
-            if (input == null) {
+        List<Pattern> readRegExSetting( final PwmPasswordRule rule, final MacroMachine macroMachine, final String input )
+        {
+            if ( input == null )
+            {
                 return Collections.emptyList();
             }
 
-            final String separator = (rule == PwmPasswordRule.RegExMatch || rule == PwmPasswordRule.RegExNoMatch) ? ";;;" : "\n";
-            final List<String> values = new ArrayList<>(StringHelper.tokenizeString(input, separator));
+            final String separator = ( rule == PwmPasswordRule.RegExMatch || rule == PwmPasswordRule.RegExNoMatch ) ? ";;;" : "\n";
+            final List<String> values = new ArrayList<>( StringHelper.tokenizeString( input, separator ) );
             final List<Pattern> patterns = new ArrayList<>();
 
-            for (final String value : values) {
-                if (value != null && value.length() > 0) {
+            for ( final String value : values )
+            {
+                if ( value != null && value.length() > 0 )
+                {
                     String valueToCompile = value;
 
-                    if (macroMachine != null && readBooleanValue(PwmPasswordRule.AllowMacroInRegExSetting)) {
-                        valueToCompile = macroMachine.expandMacros(value);
+                    if ( macroMachine != null && readBooleanValue( PwmPasswordRule.AllowMacroInRegExSetting ) )
+                    {
+                        valueToCompile = macroMachine.expandMacros( value );
                     }
 
-                    try {
-                        final Pattern loopPattern = Pattern.compile(valueToCompile);
-                        patterns.add(loopPattern);
-                    } catch (PatternSyntaxException e) {
-                        LOGGER.warn("reading password rule value '" + valueToCompile + "' for rule " + rule.getKey() + " is not a valid regular expression " + e.getMessage());
+                    try
+                    {
+                        final Pattern loopPattern = Pattern.compile( valueToCompile );
+                        patterns.add( loopPattern );
+                    }
+                    catch ( PatternSyntaxException e )
+                    {
+                        LOGGER.warn( "reading password rule value '" + valueToCompile + "' for rule " + rule.getKey() + " is not a valid regular expression " + e.getMessage() );
                     }
                 }
             }
@@ -382,74 +457,84 @@ public class PwmPasswordPolicy implements Profile,Serializable {
             return patterns;
         }
 
-        public String getChangeMessage() {
-            final String changeMessage = passwordPolicy.getValue(PwmPasswordRule.ChangeMessage);
+        public String getChangeMessage( )
+        {
+            final String changeMessage = passwordPolicy.getValue( PwmPasswordRule.ChangeMessage );
             return changeMessage == null ? "" : changeMessage;
         }
 
-        public ADPolicyComplexity getADComplexityLevel() {
-            final String strLevel = passwordPolicy.getValue(PwmPasswordRule.ADComplexityLevel);
-            if (strLevel == null || strLevel.isEmpty()) {
+        public ADPolicyComplexity getADComplexityLevel( )
+        {
+            final String strLevel = passwordPolicy.getValue( PwmPasswordRule.ADComplexityLevel );
+            if ( strLevel == null || strLevel.isEmpty() )
+            {
                 return ADPolicyComplexity.NONE;
             }
-            return ADPolicyComplexity.valueOf(strLevel);
+            return ADPolicyComplexity.valueOf( strLevel );
         }
     }
 
-    public Map<String, String> getPolicyMap() {
-        return Collections.unmodifiableMap(policyMap);
+    public Map<String, String> getPolicyMap( )
+    {
+        return Collections.unmodifiableMap( policyMap );
     }
 
     @Override
-    public ProfileType profileType() {
+    public ProfileType profileType( )
+    {
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public List<UserPermission> getPermissionMatches() {
+    public List<UserPermission> getPermissionMatches( )
+    {
         throw new UnsupportedOperationException();
     }
 
-    public List<HealthRecord> health(final Locale locale) {
+    public List<HealthRecord> health( final Locale locale )
+    {
         final RuleHelper ruleHelper = this.getRuleHelper();
         final List<HealthRecord> returnList = new ArrayList<>();
         final Map<PwmPasswordRule, PwmPasswordRule> rulePairs = new LinkedHashMap<>();
-        rulePairs.put(PwmPasswordRule.MinimumLength, PwmPasswordRule.MaximumLength);
-        rulePairs.put(PwmPasswordRule.MinimumLowerCase, PwmPasswordRule.MaximumLowerCase);
-        rulePairs.put(PwmPasswordRule.MinimumUpperCase, PwmPasswordRule.MaximumUpperCase);
-        rulePairs.put(PwmPasswordRule.MinimumNumeric, PwmPasswordRule.MaximumNumeric);
-        rulePairs.put(PwmPasswordRule.MinimumSpecial, PwmPasswordRule.MaximumSpecial);
-        rulePairs.put(PwmPasswordRule.MinimumAlpha, PwmPasswordRule.MaximumAlpha);
-        rulePairs.put(PwmPasswordRule.MinimumNonAlpha, PwmPasswordRule.MaximumNonAlpha);
-        rulePairs.put(PwmPasswordRule.MinimumUnique, PwmPasswordRule.MaximumUnique);
-
-        for (final Map.Entry<PwmPasswordRule, PwmPasswordRule> entry : rulePairs.entrySet()) {
+        rulePairs.put( PwmPasswordRule.MinimumLength, PwmPasswordRule.MaximumLength );
+        rulePairs.put( PwmPasswordRule.MinimumLowerCase, PwmPasswordRule.MaximumLowerCase );
+        rulePairs.put( PwmPasswordRule.MinimumUpperCase, PwmPasswordRule.MaximumUpperCase );
+        rulePairs.put( PwmPasswordRule.MinimumNumeric, PwmPasswordRule.MaximumNumeric );
+        rulePairs.put( PwmPasswordRule.MinimumSpecial, PwmPasswordRule.MaximumSpecial );
+        rulePairs.put( PwmPasswordRule.MinimumAlpha, PwmPasswordRule.MaximumAlpha );
+        rulePairs.put( PwmPasswordRule.MinimumNonAlpha, PwmPasswordRule.MaximumNonAlpha );
+        rulePairs.put( PwmPasswordRule.MinimumUnique, PwmPasswordRule.MaximumUnique );
+
+        for ( final Map.Entry<PwmPasswordRule, PwmPasswordRule> entry : rulePairs.entrySet() )
+        {
             final PwmPasswordRule minRule = entry.getKey();
             final PwmPasswordRule maxRule = entry.getValue();
 
-            final int minValue = ruleHelper.readIntValue(minRule);
-            final int maxValue = ruleHelper.readIntValue(maxRule);
-            if (maxValue > 0 && minValue > maxValue) {
-                final String detailMsg = minRule.getLabel(locale, null) + " (" + minValue + ")"
+            final int minValue = ruleHelper.readIntValue( minRule );
+            final int maxValue = ruleHelper.readIntValue( maxRule );
+            if ( maxValue > 0 && minValue > maxValue )
+            {
+                final String detailMsg = minRule.getLabel( locale, null ) + " (" + minValue + ")"
                         + " > "
-                        + maxRule.getLabel(locale, null) + " (" + maxValue + ")";
-                returnList.add(HealthRecord.forMessage(HealthMessage.Config_PasswordPolicyProblem, profileID, detailMsg));
+                        + maxRule.getLabel( locale, null ) + " (" + maxValue + ")";
+                returnList.add( HealthRecord.forMessage( HealthMessage.Config_PasswordPolicyProblem, profileID, detailMsg ) );
             }
         }
 
         {
-            final int minValue = ruleHelper.readIntValue(PwmPasswordRule.CharGroupsMinMatch);
+            final int minValue = ruleHelper.readIntValue( PwmPasswordRule.CharGroupsMinMatch );
             final List<Pattern> ruleGroups = ruleHelper.getCharGroupValues();
             final int maxValue = ruleGroups == null ? 0 : ruleGroups.size();
 
-            if (maxValue > 0 && minValue > maxValue) {
-                final String detailMsg = PwmPasswordRule.CharGroupsValues.getLabel(locale, null) + " (" + minValue + ")"
+            if ( maxValue > 0 && minValue > maxValue )
+            {
+                final String detailMsg = PwmPasswordRule.CharGroupsValues.getLabel( locale, null ) + " (" + minValue + ")"
                         + " > "
-                        + PwmPasswordRule.CharGroupsMinMatch.getLabel(locale, null) + " (" + maxValue + ")";
-                returnList.add(HealthRecord.forMessage(HealthMessage.Config_PasswordPolicyProblem, profileID, detailMsg));
+                        + PwmPasswordRule.CharGroupsMinMatch.getLabel( locale, null ) + " (" + maxValue + ")";
+                returnList.add( HealthRecord.forMessage( HealthMessage.Config_PasswordPolicyProblem, profileID, detailMsg ) );
             }
         }
 
-        return Collections.unmodifiableList(returnList);
+        return Collections.unmodifiableList( returnList );
     }
 }

+ 403 - 83
server/src/main/java/password/pwm/config/profile/PwmPasswordRule.java

@@ -36,78 +36,368 @@ import java.util.MissingResourceException;
 import java.util.Set;
 
 /**
- * Password rules
+ * Password rules.
  *
  * @author Jason D. Rivard
  */
-public enum PwmPasswordRule {
-
-    // rules from chai policy rules:
-    // pwm name                 chai name (if any)                         pwm setting (if any)                                     // chai password rule type                // default value                                         // when merging, using positive-boolean rule
-    PolicyEnabled               (ChaiPasswordRule.PolicyEnabled            ,null                                                    ,ChaiPasswordRule.PolicyEnabled           .getRuleType(), ChaiPasswordRule.PolicyEnabled           .getDefaultValue(),true),
-    MinimumLength               (ChaiPasswordRule.MinimumLength            ,PwmSetting.PASSWORD_POLICY_MINIMUM_LENGTH               ,ChaiPasswordRule.MinimumLength           .getRuleType(), ChaiPasswordRule.MinimumLength           .getDefaultValue(),false),
-    MaximumLength               (ChaiPasswordRule.MaximumLength            ,PwmSetting.PASSWORD_POLICY_MAXIMUM_LENGTH               ,ChaiPasswordRule.MaximumLength           .getRuleType(), ChaiPasswordRule.MaximumLength           .getDefaultValue(),false),
-    MinimumUpperCase            (ChaiPasswordRule.MinimumUpperCase         ,PwmSetting.PASSWORD_POLICY_MINIMUM_UPPERCASE            ,ChaiPasswordRule.MinimumUpperCase        .getRuleType(), ChaiPasswordRule.MinimumUpperCase        .getDefaultValue(),false),
-    MaximumUpperCase            (ChaiPasswordRule.MaximumUpperCase         ,PwmSetting.PASSWORD_POLICY_MAXIMUM_UPPERCASE            ,ChaiPasswordRule.MaximumUpperCase        .getRuleType(), ChaiPasswordRule.MaximumUpperCase        .getDefaultValue(),false),
-    MinimumLowerCase            (ChaiPasswordRule.MinimumLowerCase         ,PwmSetting.PASSWORD_POLICY_MINIMUM_LOWERCASE            ,ChaiPasswordRule.MinimumLowerCase        .getRuleType(), ChaiPasswordRule.MinimumLowerCase        .getDefaultValue(),false),
-    MaximumLowerCase            (ChaiPasswordRule.MaximumLowerCase         ,PwmSetting.PASSWORD_POLICY_MAXIMUM_LOWERCASE            ,ChaiPasswordRule.MaximumLowerCase        .getRuleType(), ChaiPasswordRule.MaximumLowerCase        .getDefaultValue(),false),
-    AllowNumeric                (ChaiPasswordRule.AllowNumeric             ,PwmSetting.PASSWORD_POLICY_ALLOW_NUMERIC                ,ChaiPasswordRule.AllowNumeric            .getRuleType(), ChaiPasswordRule.AllowNumeric            .getDefaultValue(),false),
-    MinimumNumeric              (ChaiPasswordRule.MinimumNumeric           ,PwmSetting.PASSWORD_POLICY_MINIMUM_NUMERIC              ,ChaiPasswordRule.MinimumNumeric          .getRuleType(), ChaiPasswordRule.MinimumNumeric          .getDefaultValue(),false),
-    MaximumNumeric              (ChaiPasswordRule.MaximumNumeric           ,PwmSetting.PASSWORD_POLICY_MAXIMUM_NUMERIC              ,ChaiPasswordRule.MaximumNumeric          .getRuleType(), ChaiPasswordRule.MaximumNumeric          .getDefaultValue(),false),
-    MinimumUnique               (ChaiPasswordRule.MinimumUnique            ,PwmSetting.PASSWORD_POLICY_MINIMUM_UNIQUE               ,ChaiPasswordRule.MinimumUnique           .getRuleType(), ChaiPasswordRule.MinimumUnique           .getDefaultValue(),false),
-    MaximumUnique               (ChaiPasswordRule.MaximumUnique            ,null                                                    ,ChaiPasswordRule.MaximumUnique           .getRuleType(), ChaiPasswordRule.MaximumUnique           .getDefaultValue(),false),
-    AllowFirstCharNumeric       (ChaiPasswordRule.AllowFirstCharNumeric    ,PwmSetting.PASSWORD_POLICY_ALLOW_FIRST_CHAR_NUMERIC     ,ChaiPasswordRule.AllowFirstCharNumeric   .getRuleType(), ChaiPasswordRule.AllowFirstCharNumeric   .getDefaultValue(),false),
-    AllowLastCharNumeric        (ChaiPasswordRule.AllowLastCharNumeric     ,PwmSetting.PASSWORD_POLICY_ALLOW_LAST_CHAR_NUMERIC      ,ChaiPasswordRule.AllowLastCharNumeric    .getRuleType(), ChaiPasswordRule.AllowLastCharNumeric    .getDefaultValue(),false),
-    AllowSpecial                (ChaiPasswordRule.AllowSpecial             ,PwmSetting.PASSWORD_POLICY_ALLOW_SPECIAL                ,ChaiPasswordRule.AllowSpecial            .getRuleType(), ChaiPasswordRule.AllowSpecial            .getDefaultValue(),false),
-    MinimumSpecial              (ChaiPasswordRule.MinimumSpecial           ,PwmSetting.PASSWORD_POLICY_MINIMUM_SPECIAL              ,ChaiPasswordRule.MinimumSpecial          .getRuleType(), ChaiPasswordRule.MinimumSpecial          .getDefaultValue(),false),
-    MaximumSpecial              (ChaiPasswordRule.MaximumSpecial           ,PwmSetting.PASSWORD_POLICY_MAXIMUM_SPECIAL              ,ChaiPasswordRule.MaximumSpecial          .getRuleType(), ChaiPasswordRule.MaximumSpecial          .getDefaultValue(),false),
-    AllowFirstCharSpecial       (ChaiPasswordRule.AllowFirstCharSpecial    ,PwmSetting.PASSWORD_POLICY_ALLOW_FIRST_CHAR_SPECIAL     ,ChaiPasswordRule.AllowFirstCharSpecial   .getRuleType(), ChaiPasswordRule.AllowFirstCharSpecial   .getDefaultValue(),false),
-    AllowLastCharSpecial        (ChaiPasswordRule.AllowLastCharSpecial     ,PwmSetting.PASSWORD_POLICY_ALLOW_LAST_CHAR_SPECIAL      ,ChaiPasswordRule.AllowLastCharSpecial    .getRuleType(), ChaiPasswordRule.AllowLastCharSpecial    .getDefaultValue(),false),
-    MaximumRepeat               (ChaiPasswordRule.MaximumRepeat            ,PwmSetting.PASSWORD_POLICY_MAXIMUM_REPEAT               ,ChaiPasswordRule.MaximumRepeat           .getRuleType(), ChaiPasswordRule.MaximumRepeat           .getDefaultValue(),false),
-    MaximumSequentialRepeat     (ChaiPasswordRule.MaximumSequentialRepeat  ,PwmSetting.PASSWORD_POLICY_MAXIMUM_SEQUENTIAL_REPEAT    ,ChaiPasswordRule.MaximumSequentialRepeat .getRuleType(), ChaiPasswordRule.MaximumSequentialRepeat .getDefaultValue(),false),
-    ChangeMessage               (ChaiPasswordRule.ChangeMessage            ,PwmSetting.PASSWORD_POLICY_CHANGE_MESSAGE               ,ChaiPasswordRule.ChangeMessage           .getRuleType(), ChaiPasswordRule.ChangeMessage           .getDefaultValue(),false),
-    ExpirationInterval          (ChaiPasswordRule.ExpirationInterval       ,null                                                    ,ChaiPasswordRule.ExpirationInterval      .getRuleType(), ChaiPasswordRule.ExpirationInterval      .getDefaultValue(),false),
-    MinimumLifetime             (ChaiPasswordRule.MinimumLifetime          ,PwmSetting.PASSWORD_POLICY_MINIMUM_LIFETIME             ,ChaiPasswordRule.MinimumLifetime         .getRuleType(), ChaiPasswordRule.MinimumLifetime         .getDefaultValue(),false),
-    CaseSensitive               (ChaiPasswordRule.CaseSensitive            ,null                                                    ,ChaiPasswordRule.CaseSensitive           .getRuleType(), ChaiPasswordRule.CaseSensitive           .getDefaultValue(),true),
-    EnforceAtLogin              (ChaiPasswordRule.EnforceAtLogin           ,null                                                    ,ChaiPasswordRule.EnforceAtLogin          .getRuleType(), ChaiPasswordRule.EnforceAtLogin          .getDefaultValue(),false),
-    ChallengeResponseEnabled    (ChaiPasswordRule.ChallengeResponseEnabled ,null                                                    ,ChaiPasswordRule.ChallengeResponseEnabled.getRuleType(), ChaiPasswordRule.ChallengeResponseEnabled.getDefaultValue(),false),
-    UniqueRequired              (ChaiPasswordRule.UniqueRequired           ,null                                                    ,ChaiPasswordRule.UniqueRequired          .getRuleType(), ChaiPasswordRule.UniqueRequired          .getDefaultValue(),true),
-    DisallowedValues            (ChaiPasswordRule.DisallowedValues         ,PwmSetting.PASSWORD_POLICY_DISALLOWED_VALUES            ,ChaiPasswordRule.DisallowedValues        .getRuleType(), ChaiPasswordRule.DisallowedValues        .getDefaultValue(),false),
-    DisallowedAttributes        (ChaiPasswordRule.DisallowedAttributes     ,PwmSetting.PASSWORD_POLICY_DISALLOWED_ATTRIBUTES        ,ChaiPasswordRule.DisallowedAttributes    .getRuleType(), ChaiPasswordRule.DisallowedAttributes    .getDefaultValue(),false),
-    DisallowCurrent             (null                                      ,PwmSetting.PASSWORD_POLICY_DISALLOW_CURRENT             ,ChaiPasswordRule.RuleType.BOOLEAN        ,"false"                                                 ,true),
-    AllowUserChange             (ChaiPasswordRule.AllowUserChange          ,null                                                    ,ChaiPasswordRule.AllowUserChange         .getRuleType(), ChaiPasswordRule.AllowUserChange         .getDefaultValue(),true),
-    AllowAdminChange            (ChaiPasswordRule.AllowAdminChange         ,null                                                    ,ChaiPasswordRule.AllowAdminChange        .getRuleType(), ChaiPasswordRule.AllowAdminChange        .getDefaultValue(),true),
-    ADComplexityMaxViolations   (ChaiPasswordRule.ADComplexityMaxViolation ,PwmSetting.PASSWORD_POLICY_AD_COMPLEXITY_MAX_VIOLATIONS ,ChaiPasswordRule.ADComplexityMaxViolation.getRuleType(), ChaiPasswordRule.ADComplexityMaxViolation.getDefaultValue(),false),
+public enum PwmPasswordRule
+{
+    PolicyEnabled(
+            ChaiPasswordRule.PolicyEnabled,
+            null,
+            ChaiPasswordRule.PolicyEnabled.getRuleType(),
+            ChaiPasswordRule.PolicyEnabled.getDefaultValue(),
+            true ),
+
+    MinimumLength(
+            ChaiPasswordRule.MinimumLength,
+            PwmSetting.PASSWORD_POLICY_MINIMUM_LENGTH,
+            ChaiPasswordRule.MinimumLength.getRuleType(),
+            ChaiPasswordRule.MinimumLength.getDefaultValue(),
+            false ),
+
+    MaximumLength(
+            ChaiPasswordRule.MaximumLength,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_LENGTH,
+            ChaiPasswordRule.MaximumLength.getRuleType(),
+            ChaiPasswordRule.MaximumLength.getDefaultValue(),
+            false ),
+
+    MinimumUpperCase(
+            ChaiPasswordRule.MinimumUpperCase,
+            PwmSetting.PASSWORD_POLICY_MINIMUM_UPPERCASE,
+            ChaiPasswordRule.MinimumUpperCase.getRuleType(),
+            ChaiPasswordRule.MinimumUpperCase.getDefaultValue(),
+            false ),
+
+    MaximumUpperCase(
+            ChaiPasswordRule.MaximumUpperCase,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_UPPERCASE,
+            ChaiPasswordRule.MaximumUpperCase.getRuleType(),
+            ChaiPasswordRule.MaximumUpperCase.getDefaultValue(),
+            false ),
+
+    MinimumLowerCase(
+            ChaiPasswordRule.MinimumLowerCase,
+            PwmSetting.PASSWORD_POLICY_MINIMUM_LOWERCASE,
+            ChaiPasswordRule.MinimumLowerCase.getRuleType(),
+            ChaiPasswordRule.MinimumLowerCase.getDefaultValue(),
+            false ),
+
+    MaximumLowerCase(
+            ChaiPasswordRule.MaximumLowerCase,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_LOWERCASE,
+            ChaiPasswordRule.MaximumLowerCase.getRuleType(),
+            ChaiPasswordRule.MaximumLowerCase.getDefaultValue(),
+            false ),
+
+    AllowNumeric(
+            ChaiPasswordRule.AllowNumeric,
+            PwmSetting.PASSWORD_POLICY_ALLOW_NUMERIC,
+            ChaiPasswordRule.AllowNumeric.getRuleType(),
+            ChaiPasswordRule.AllowNumeric.getDefaultValue(),
+            false ),
+
+    MinimumNumeric(
+            ChaiPasswordRule.MinimumNumeric,
+            PwmSetting.PASSWORD_POLICY_MINIMUM_NUMERIC,
+            ChaiPasswordRule.MinimumNumeric.getRuleType(),
+            ChaiPasswordRule.MinimumNumeric.getDefaultValue(),
+            false ),
+
+    MaximumNumeric(
+            ChaiPasswordRule.MaximumNumeric,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_NUMERIC,
+            ChaiPasswordRule.MaximumNumeric.getRuleType(),
+            ChaiPasswordRule.MaximumNumeric.getDefaultValue(),
+            false ),
+
+    MinimumUnique(
+            ChaiPasswordRule.MinimumUnique,
+            PwmSetting.PASSWORD_POLICY_MINIMUM_UNIQUE,
+            ChaiPasswordRule.MinimumUnique.getRuleType(),
+            ChaiPasswordRule.MinimumUnique.getDefaultValue(),
+            false ),
+
+    MaximumUnique(
+            ChaiPasswordRule.MaximumUnique,
+            null,
+            ChaiPasswordRule.MaximumUnique.getRuleType(),
+            ChaiPasswordRule.MaximumUnique.getDefaultValue(),
+            false ),
+
+    AllowFirstCharNumeric(
+            ChaiPasswordRule.AllowFirstCharNumeric,
+            PwmSetting.PASSWORD_POLICY_ALLOW_FIRST_CHAR_NUMERIC,
+            ChaiPasswordRule.AllowFirstCharNumeric.getRuleType(),
+            ChaiPasswordRule.AllowFirstCharNumeric.getDefaultValue(),
+            false ),
+
+    AllowLastCharNumeric(
+            ChaiPasswordRule.AllowLastCharNumeric,
+            PwmSetting.PASSWORD_POLICY_ALLOW_LAST_CHAR_NUMERIC,
+            ChaiPasswordRule.AllowLastCharNumeric.getRuleType(),
+            ChaiPasswordRule.AllowLastCharNumeric.getDefaultValue(),
+            false ),
+
+    AllowSpecial(
+            ChaiPasswordRule.AllowSpecial,
+            PwmSetting.PASSWORD_POLICY_ALLOW_SPECIAL,
+            ChaiPasswordRule.AllowSpecial.getRuleType(),
+            ChaiPasswordRule.AllowSpecial.getDefaultValue(),
+            false ),
+
+    MinimumSpecial(
+            ChaiPasswordRule.MinimumSpecial,
+            PwmSetting.PASSWORD_POLICY_MINIMUM_SPECIAL,
+            ChaiPasswordRule.MinimumSpecial.getRuleType(),
+            ChaiPasswordRule.MinimumSpecial.getDefaultValue(),
+            false ),
+
+    MaximumSpecial(
+            ChaiPasswordRule.MaximumSpecial,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_SPECIAL,
+            ChaiPasswordRule.MaximumSpecial.getRuleType(),
+            ChaiPasswordRule.MaximumSpecial.getDefaultValue(),
+            false ),
+
+    AllowFirstCharSpecial(
+            ChaiPasswordRule.AllowFirstCharSpecial,
+            PwmSetting.PASSWORD_POLICY_ALLOW_FIRST_CHAR_SPECIAL,
+            ChaiPasswordRule.AllowFirstCharSpecial.getRuleType(),
+            ChaiPasswordRule.AllowFirstCharSpecial.getDefaultValue(),
+            false ),
+
+    AllowLastCharSpecial(
+            ChaiPasswordRule.AllowLastCharSpecial,
+            PwmSetting.PASSWORD_POLICY_ALLOW_LAST_CHAR_SPECIAL,
+            ChaiPasswordRule.AllowLastCharSpecial.getRuleType(),
+            ChaiPasswordRule.AllowLastCharSpecial.getDefaultValue(),
+            false ),
+
+    MaximumRepeat(
+            ChaiPasswordRule.MaximumRepeat,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_REPEAT,
+            ChaiPasswordRule.MaximumRepeat.getRuleType(),
+            ChaiPasswordRule.MaximumRepeat.getDefaultValue(),
+            false ),
+
+    MaximumSequentialRepeat(
+            ChaiPasswordRule.MaximumSequentialRepeat,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_SEQUENTIAL_REPEAT,
+            ChaiPasswordRule.MaximumSequentialRepeat.getRuleType(),
+            ChaiPasswordRule.MaximumSequentialRepeat.getDefaultValue(),
+            false ),
+
+    ChangeMessage(
+            ChaiPasswordRule.ChangeMessage,
+            PwmSetting.PASSWORD_POLICY_CHANGE_MESSAGE,
+            ChaiPasswordRule.ChangeMessage.getRuleType(),
+            ChaiPasswordRule.ChangeMessage.getDefaultValue(),
+            false ),
+
+    ExpirationInterval(
+            ChaiPasswordRule.ExpirationInterval,
+            null,
+            ChaiPasswordRule.ExpirationInterval.getRuleType(),
+            ChaiPasswordRule.ExpirationInterval.getDefaultValue(),
+            false ),
+
+    MinimumLifetime(
+            ChaiPasswordRule.MinimumLifetime,
+            PwmSetting.PASSWORD_POLICY_MINIMUM_LIFETIME,
+            ChaiPasswordRule.MinimumLifetime.getRuleType(),
+            ChaiPasswordRule.MinimumLifetime.getDefaultValue(),
+            false ),
+
+    CaseSensitive(
+            ChaiPasswordRule.CaseSensitive,
+            null,
+            ChaiPasswordRule.CaseSensitive.getRuleType(),
+            ChaiPasswordRule.CaseSensitive.getDefaultValue(),
+            true ),
+
+    EnforceAtLogin(
+            ChaiPasswordRule.EnforceAtLogin,
+            null,
+            ChaiPasswordRule.EnforceAtLogin.getRuleType(),
+            ChaiPasswordRule.EnforceAtLogin.getDefaultValue(),
+            false ),
+
+    ChallengeResponseEnabled(
+            ChaiPasswordRule.ChallengeResponseEnabled,
+            null,
+            ChaiPasswordRule.ChallengeResponseEnabled.getRuleType(),
+            ChaiPasswordRule.ChallengeResponseEnabled.getDefaultValue(),
+            false ),
+
+    UniqueRequired(
+            ChaiPasswordRule.UniqueRequired,
+            null,
+            ChaiPasswordRule.UniqueRequired.getRuleType(),
+            ChaiPasswordRule.UniqueRequired.getDefaultValue(),
+            true ),
+
+    DisallowedValues(
+            ChaiPasswordRule.DisallowedValues,
+            PwmSetting.PASSWORD_POLICY_DISALLOWED_VALUES,
+            ChaiPasswordRule.DisallowedValues.getRuleType(),
+            ChaiPasswordRule.DisallowedValues.getDefaultValue(),
+            false ),
+
+    DisallowedAttributes(
+            ChaiPasswordRule.DisallowedAttributes,
+            PwmSetting.PASSWORD_POLICY_DISALLOWED_ATTRIBUTES,
+            ChaiPasswordRule.DisallowedAttributes.getRuleType(),
+            ChaiPasswordRule.DisallowedAttributes.getDefaultValue(),
+            false ),
+
+    DisallowCurrent(
+            null,
+            PwmSetting.PASSWORD_POLICY_DISALLOW_CURRENT,
+            ChaiPasswordRule.RuleType.BOOLEAN,
+            "false",
+            true ),
+
+    AllowUserChange(
+            ChaiPasswordRule.AllowUserChange,
+            null,
+            ChaiPasswordRule.AllowUserChange.getRuleType(),
+            ChaiPasswordRule.AllowUserChange.getDefaultValue(),
+            true ),
+
+    AllowAdminChange(
+            ChaiPasswordRule.AllowAdminChange,
+            null,
+            ChaiPasswordRule.AllowAdminChange.getRuleType(),
+            ChaiPasswordRule.AllowAdminChange.getDefaultValue(),
+            true ),
+
+    ADComplexityMaxViolations(
+            ChaiPasswordRule.ADComplexityMaxViolation,
+            PwmSetting.PASSWORD_POLICY_AD_COMPLEXITY_MAX_VIOLATIONS,
+            ChaiPasswordRule.ADComplexityMaxViolation.getRuleType(),
+            ChaiPasswordRule.ADComplexityMaxViolation.getDefaultValue(),
+            false ),
+
 
     // pwm specific rules
-    ADComplexityLevel           (null                                      ,PwmSetting.PASSWORD_POLICY_AD_COMPLEXITY_LEVEL          ,ChaiPasswordRule.RuleType.OTHER, "NONE",false), // value will be imported indirectly from chai rule
-    MaximumOldChars             (null                                      ,PwmSetting.PASSWORD_POLICY_MAXIMUM_OLD_PASSWORD_CHARS   ,ChaiPasswordRule.RuleType.NUMERIC, "",false),
-    RegExMatch                  (null                                      ,PwmSetting.PASSWORD_POLICY_REGULAR_EXPRESSION_MATCH     ,ChaiPasswordRule.RuleType.OTHER, "",false),
-    RegExNoMatch                (null                                      ,PwmSetting.PASSWORD_POLICY_REGULAR_EXPRESSION_NOMATCH   ,ChaiPasswordRule.RuleType.OTHER, "",false),
-    MinimumAlpha                (null                                      ,PwmSetting.PASSWORD_POLICY_MINIMUM_ALPHA                ,ChaiPasswordRule.RuleType.MIN, "0",false),
-    MaximumAlpha                (null                                      ,PwmSetting.PASSWORD_POLICY_MAXIMUM_ALPHA                ,ChaiPasswordRule.RuleType.MAX, "0",false),
-    MinimumNonAlpha             (null                                      ,PwmSetting.PASSWORD_POLICY_MINIMUM_NON_ALPHA            ,ChaiPasswordRule.RuleType.MIN, "0",false),
-    MaximumNonAlpha             (null                                      ,PwmSetting.PASSWORD_POLICY_MAXIMUM_NON_ALPHA            ,ChaiPasswordRule.RuleType.MAX, "0",false),
-    EnableWordlist              (null                                      ,PwmSetting.PASSWORD_POLICY_ENABLE_WORDLIST              ,ChaiPasswordRule.RuleType.BOOLEAN, "true", true),
-    MinimumStrength             (null                                      ,PwmSetting.PASSWORD_POLICY_MINIMUM_STRENGTH             ,ChaiPasswordRule.RuleType.MIN, "0", false),
-    MaximumConsecutive          (null                                      ,PwmSetting.PASSWORD_POLICY_MAXIMUM_CONSECUTIVE          ,ChaiPasswordRule.RuleType.MIN, "0", false),
-    CharGroupsMinMatch          (null                                      ,PwmSetting.PASSWORD_POLICY_CHAR_GROUPS_MIN_MATCH        ,ChaiPasswordRule.RuleType.MIN, "0",false),
-    CharGroupsValues            (null                                      ,PwmSetting.PASSWORD_POLICY_CHAR_GROUPS                  ,ChaiPasswordRule.RuleType.OTHER, "",false),
-
-    AllowMacroInRegExSetting    (                                           AppProperty.ALLOW_MACRO_IN_REGEX_SETTING                ,ChaiPasswordRule.RuleType.BOOLEAN, "true", false), 
-    ;
-
-    private static final PwmLogger LOGGER = PwmLogger.forClass(PwmPasswordRule.class);
-
-    static {
-        try {
+    // value will be imported indirectly from chai rule
+    ADComplexityLevel(
+            null,
+            PwmSetting.PASSWORD_POLICY_AD_COMPLEXITY_LEVEL,
+            ChaiPasswordRule.RuleType.OTHER,
+            "NONE",
+            false ),
+
+    MaximumOldChars(
+            null,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_OLD_PASSWORD_CHARS,
+            ChaiPasswordRule.RuleType.NUMERIC,
+            "",
+            false ),
+
+    RegExMatch(
+            null,
+            PwmSetting.PASSWORD_POLICY_REGULAR_EXPRESSION_MATCH,
+            ChaiPasswordRule.RuleType.OTHER,
+            "",
+            false ),
+
+    RegExNoMatch(
+            null,
+            PwmSetting.PASSWORD_POLICY_REGULAR_EXPRESSION_NOMATCH,
+            ChaiPasswordRule.RuleType.OTHER,
+            "",
+            false
+    ),
+
+    MinimumAlpha(
+            null,
+            PwmSetting.PASSWORD_POLICY_MINIMUM_ALPHA,
+            ChaiPasswordRule.RuleType.MIN,
+            "0",
+            false ),
+
+    MaximumAlpha(
+            null,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_ALPHA,
+            ChaiPasswordRule.RuleType.MAX,
+            "0",
+            false
+    ),
+
+    MinimumNonAlpha(
+            null,
+            PwmSetting.PASSWORD_POLICY_MINIMUM_NON_ALPHA,
+            ChaiPasswordRule.RuleType.MIN,
+            "0",
+            false ),
+
+    MaximumNonAlpha(
+            null,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_NON_ALPHA,
+            ChaiPasswordRule.RuleType.MAX,
+            "0",
+            false ),
+
+    EnableWordlist(
+            null,
+            PwmSetting.PASSWORD_POLICY_ENABLE_WORDLIST,
+            ChaiPasswordRule.RuleType.BOOLEAN,
+            "true",
+            true ),
+
+    MinimumStrength(
+            null,
+            PwmSetting.PASSWORD_POLICY_MINIMUM_STRENGTH,
+            ChaiPasswordRule.RuleType.MIN,
+            "0",
+            false ),
+
+    MaximumConsecutive(
+            null,
+            PwmSetting.PASSWORD_POLICY_MAXIMUM_CONSECUTIVE,
+            ChaiPasswordRule.RuleType.MIN,
+            "0",
+            false ),
+
+    CharGroupsMinMatch(
+            null,
+            PwmSetting.PASSWORD_POLICY_CHAR_GROUPS_MIN_MATCH,
+            ChaiPasswordRule.RuleType.MIN,
+            "0",
+            false ),
+
+    CharGroupsValues(
+            null,
+            PwmSetting.PASSWORD_POLICY_CHAR_GROUPS,
+            ChaiPasswordRule.RuleType.OTHER,
+            "",
+            false ),
+
+    AllowMacroInRegExSetting(
+            AppProperty.ALLOW_MACRO_IN_REGEX_SETTING,
+            ChaiPasswordRule.RuleType.BOOLEAN,
+            "true",
+            false ),;
+
+    private static final PwmLogger LOGGER = PwmLogger.forClass( PwmPasswordRule.class );
+
+    static
+    {
+        try
+        {
             final Set<String> keys = new HashSet<>();
-            for (final PwmSetting setting : PwmSetting.values()) {
-                keys.add(setting.getKey());
+            for ( final PwmSetting setting : PwmSetting.values() )
+            {
+                keys.add( setting.getKey() );
             }
             assert keys.size() == PwmSetting.values().length;
-        } catch (Throwable t) {
-            LOGGER.fatal("error initializing PwmPasswordRule class: " + t.getMessage(),t);
+        }
+        catch ( Throwable t )
+        {
+            LOGGER.fatal( "error initializing PwmPasswordRule class: " + t.getMessage(), t );
         }
     }
 
@@ -118,7 +408,14 @@ public enum PwmPasswordRule {
     private final String defaultValue;
     private final boolean positiveBooleanMerge;
 
-    PwmPasswordRule(final ChaiPasswordRule chaiPasswordRule, final PwmSetting pwmSetting, final ChaiPasswordRule.RuleType ruleType, final String defaultValue, final boolean positiveBooleanMerge) {
+    PwmPasswordRule(
+            final ChaiPasswordRule chaiPasswordRule,
+            final PwmSetting pwmSetting,
+            final ChaiPasswordRule.RuleType ruleType,
+            final String defaultValue,
+            final boolean positiveBooleanMerge
+    )
+    {
         this.pwmSetting = pwmSetting;
         this.chaiPasswordRule = chaiPasswordRule;
         this.appProperty = null;
@@ -127,7 +424,13 @@ public enum PwmPasswordRule {
         this.positiveBooleanMerge = positiveBooleanMerge;
     }
 
-    PwmPasswordRule(final AppProperty appProperty, final ChaiPasswordRule.RuleType ruleType, final String defaultValue, final boolean positiveBooleanMerge) {
+    PwmPasswordRule(
+            final AppProperty appProperty,
+            final ChaiPasswordRule.RuleType ruleType,
+            final String defaultValue,
+            final boolean positiveBooleanMerge
+    )
+    {
         this.pwmSetting = null;
         this.chaiPasswordRule = null;
         this.appProperty = appProperty;
@@ -136,47 +439,60 @@ public enum PwmPasswordRule {
         this.positiveBooleanMerge = positiveBooleanMerge;
     }
 
-    public String getKey() {
-        if (chaiPasswordRule != null) {
+    public String getKey( )
+    {
+        if ( chaiPasswordRule != null )
+        {
             return chaiPasswordRule.getKey();
         }
-        if (pwmSetting       != null) {
+        if ( pwmSetting != null )
+        {
             return pwmSetting.getKey();
         }
-        if (appProperty      != null) {
+        if ( appProperty != null )
+        {
             return appProperty.getKey();
         }
 
         return this.name();
     }
 
-    public PwmSetting getPwmSetting() {
+    public PwmSetting getPwmSetting( )
+    {
         return pwmSetting;
     }
 
-    public AppProperty getAppProperty() {
+    public AppProperty getAppProperty( )
+    {
         return appProperty;
     }
 
-    public ChaiPasswordRule.RuleType getRuleType() {
+    public ChaiPasswordRule.RuleType getRuleType( )
+    {
         return ruleType;
     }
 
-    public String getDefaultValue() {
+    public String getDefaultValue( )
+    {
         return defaultValue;
     }
 
-    public boolean isPositiveBooleanMerge() {
+    public boolean isPositiveBooleanMerge( )
+    {
         return positiveBooleanMerge;
     }
 
-    public static PwmPasswordRule forKey(final String key) {
-        if (key == null) {
+    public static PwmPasswordRule forKey( final String key )
+    {
+        if ( key == null )
+        {
             return null;
         }
 
-        for (final PwmPasswordRule rule : values()) {
-            if (key.equals(rule.getKey())) {
+        for ( final PwmPasswordRule rule : values() )
+        {
+            if ( key.equals( rule.getKey() ) )
+            {
                 return rule;
             }
         }
@@ -184,11 +500,15 @@ public enum PwmPasswordRule {
         return null;
     }
 
-    public String getLabel(final Locale locale, final Configuration config) {
+    public String getLabel( final Locale locale, final Configuration config )
+    {
         final String key = "Rule_" + this.toString();
-        try {
-            return LocaleHelper.getLocalizedMessage(locale, key, config, Message.class);
-        } catch (MissingResourceException e) {
+        try
+        {
+            return LocaleHelper.getLocalizedMessage( locale, key, config, Message.class );
+        }
+        catch ( MissingResourceException e )
+        {
             return "MissingKey-" + key;
         }
     }

+ 28 - 20
server/src/main/java/password/pwm/config/profile/UpdateAttributesProfile.java

@@ -32,46 +32,54 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
-public class UpdateAttributesProfile extends AbstractProfile implements Profile {
+public class UpdateAttributesProfile extends AbstractProfile implements Profile
+{
 
     private static final ProfileType PROFILE_TYPE = ProfileType.UpdateAttributes;
 
-    protected UpdateAttributesProfile(final String identifier, final Map<PwmSetting, StoredValue> storedValueMap) {
-        super(identifier, storedValueMap);
+    protected UpdateAttributesProfile( final String identifier, final Map<PwmSetting, StoredValue> storedValueMap )
+    {
+        super( identifier, storedValueMap );
     }
 
-    public static UpdateAttributesProfile makeFromStoredConfiguration(final StoredConfiguration storedConfiguration, final String identifier) {
-        final Map<PwmSetting,StoredValue> valueMap = makeValueMap(storedConfiguration, identifier, PROFILE_TYPE.getCategory());
-        return new UpdateAttributesProfile(identifier, valueMap);
+    public static UpdateAttributesProfile makeFromStoredConfiguration( final StoredConfiguration storedConfiguration, final String identifier )
+    {
+        final Map<PwmSetting, StoredValue> valueMap = makeValueMap( storedConfiguration, identifier, PROFILE_TYPE.getCategory() );
+        return new UpdateAttributesProfile( identifier, valueMap );
 
     }
 
     @Override
-    public String getDisplayName(final Locale locale)
+    public String getDisplayName( final Locale locale )
     {
         return this.getIdentifier();
     }
 
     @Override
-    public ProfileType profileType() {
+    public ProfileType profileType( )
+    {
         return PROFILE_TYPE;
     }
 
-    public TimeDuration getTokenDurationEmail(final Configuration configuration) {
-        final long duration = readSettingAsLong(PwmSetting.UPDATE_PROFILE_TOKEN_LIFETIME_EMAIL);
-        if (duration < 1) {
-            final long defaultDuration = configuration.readSettingAsLong(PwmSetting.TOKEN_LIFETIME);
-            return new TimeDuration(defaultDuration, TimeUnit.SECONDS);
+    public TimeDuration getTokenDurationEmail( final Configuration configuration )
+    {
+        final long duration = readSettingAsLong( PwmSetting.UPDATE_PROFILE_TOKEN_LIFETIME_EMAIL );
+        if ( duration < 1 )
+        {
+            final long defaultDuration = configuration.readSettingAsLong( PwmSetting.TOKEN_LIFETIME );
+            return new TimeDuration( defaultDuration, TimeUnit.SECONDS );
         }
-        return new TimeDuration(duration, TimeUnit.SECONDS);
+        return new TimeDuration( duration, TimeUnit.SECONDS );
     }
 
-    public TimeDuration getTokenDurationSMS(final Configuration configuration) {
-        final long duration = readSettingAsLong(PwmSetting.UPDATE_PROFILE_TOKEN_LIFETIME_SMS);
-        if (duration < 1) {
-            final long defaultDuration = configuration.readSettingAsLong(PwmSetting.TOKEN_LIFETIME);
-            return new TimeDuration(defaultDuration, TimeUnit.SECONDS);
+    public TimeDuration getTokenDurationSMS( final Configuration configuration )
+    {
+        final long duration = readSettingAsLong( PwmSetting.UPDATE_PROFILE_TOKEN_LIFETIME_SMS );
+        if ( duration < 1 )
+        {
+            final long defaultDuration = configuration.readSettingAsLong( PwmSetting.TOKEN_LIFETIME );
+            return new TimeDuration( defaultDuration, TimeUnit.SECONDS );
         }
-        return new TimeDuration(duration, TimeUnit.SECONDS);
+        return new TimeDuration( duration, TimeUnit.SECONDS );
     }
 }

+ 7 - 6
server/src/main/java/password/pwm/config/stored/ConfigChangeLog.java

@@ -27,14 +27,15 @@ import password.pwm.config.StoredValue;
 import java.util.Collection;
 import java.util.Locale;
 
-public interface ConfigChangeLog {
-    boolean isModified();
+public interface ConfigChangeLog
+{
+    boolean isModified( );
 
-    String changeLogAsDebugString(Locale locale, boolean asHtml);
+    String changeLogAsDebugString( Locale locale, boolean asHtml );
 
-    void updateChangeLog(StoredConfigReference reference, StoredValue newValue);
+    void updateChangeLog( StoredConfigReference reference, StoredValue newValue );
 
-    void updateChangeLog( StoredConfigReference reference,  StoredValue currentValue,  StoredValue newValue);
+    void updateChangeLog( StoredConfigReference reference, StoredValue currentValue, StoredValue newValue );
 
-    Collection<StoredConfigReference> changedValues();
+    Collection<StoredConfigReference> changedValues( );
 }

+ 64 - 43
server/src/main/java/password/pwm/config/stored/ConfigChangeLogImpl.java

@@ -33,32 +33,39 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.TreeMap;
 
-public class ConfigChangeLogImpl implements Serializable, ConfigChangeLog {
-    private final Map<StoredConfigReference,StoredValue> changeLog = new LinkedHashMap<>();
-    private final Map<StoredConfigReference,StoredValue> originalValue = new LinkedHashMap<>();
+public class ConfigChangeLogImpl implements Serializable, ConfigChangeLog
+{
+    private final Map<StoredConfigReference, StoredValue> changeLog = new LinkedHashMap<>();
+    private final Map<StoredConfigReference, StoredValue> originalValue = new LinkedHashMap<>();
     private final transient StorageEngine storedConfiguration;
 
-    public ConfigChangeLogImpl(final StorageEngine storageEngine) {
+    public ConfigChangeLogImpl( final StorageEngine storageEngine )
+    {
         this.storedConfiguration = storageEngine;
     }
 
     @Override
-    public boolean isModified() {
+    public boolean isModified( )
+    {
         return !changeLog.isEmpty();
     }
 
     @Override
-    public String changeLogAsDebugString(final Locale locale, final boolean asHtml) {
-        final Map<String,String> outputMap = new TreeMap<>();
+    public String changeLogAsDebugString( final Locale locale, final boolean asHtml )
+    {
+        final Map<String, String> outputMap = new TreeMap<>();
 
-        for (final StoredConfigReference configReference : changeLog.keySet()) {
-            switch (configReference.getRecordType()) {
-                case SETTING: {
-                    final PwmSetting pwmSetting = PwmSetting.forKey(configReference.getRecordID());
-                    final StoredValue currentValue = storedConfiguration.read(configReference);
-                    final String keyName = pwmSetting.toMenuLocationDebug(configReference.getProfileID(), locale);
-                    final String debugValue = currentValue.toDebugString(locale);
-                    outputMap.put(keyName,debugValue);
+        for ( final StoredConfigReference configReference : changeLog.keySet() )
+        {
+            switch ( configReference.getRecordType() )
+            {
+                case SETTING:
+                {
+                    final PwmSetting pwmSetting = PwmSetting.forKey( configReference.getRecordID() );
+                    final StoredValue currentValue = storedConfiguration.read( configReference );
+                    final String keyName = pwmSetting.toMenuLocationDebug( configReference.getProfileID(), locale );
+                    final String debugValue = currentValue.toDebugString( locale );
+                    outputMap.put( keyName, debugValue );
                 }
                 break;
 
@@ -81,24 +88,31 @@ public class ConfigChangeLogImpl implements Serializable, ConfigChangeLog {
             }
         }
         final StringBuilder output = new StringBuilder();
-        if (outputMap.isEmpty()) {
-            output.append("No setting changes.");
-        } else {
-            for (final Map.Entry<String,String> entry  : outputMap.entrySet()) {
+        if ( outputMap.isEmpty() )
+        {
+            output.append( "No setting changes." );
+        }
+        else
+        {
+            for ( final Map.Entry<String, String> entry : outputMap.entrySet() )
+            {
                 final String keyName = entry.getKey();
                 final String value = entry.getValue();
-                if (asHtml) {
-                    output.append("<div class=\"changeLogKey\">");
-                    output.append(keyName);
-                    output.append("</div><div class=\"changeLogValue\">");
-                    output.append(StringUtil.escapeHtml(value));
-                    output.append("</div>");
-                } else {
-                    output.append(keyName);
-                    output.append("\n");
-                    output.append(" Value: ");
-                    output.append(value);
-                    output.append("\n");
+                if ( asHtml )
+                {
+                    output.append( "<div class=\"changeLogKey\">" );
+                    output.append( keyName );
+                    output.append( "</div><div class=\"changeLogValue\">" );
+                    output.append( StringUtil.escapeHtml( value ) );
+                    output.append( "</div>" );
+                }
+                else
+                {
+                    output.append( keyName );
+                    output.append( "\n" );
+                    output.append( " Value: " );
+                    output.append( value );
+                    output.append( "\n" );
                 }
             }
         }
@@ -106,26 +120,33 @@ public class ConfigChangeLogImpl implements Serializable, ConfigChangeLog {
     }
 
     @Override
-    public void updateChangeLog(final StoredConfigReference reference, final StoredValue newValue) {
-        changeLog.put(reference,newValue);
-        originalValue.put(reference, null);
+    public void updateChangeLog( final StoredConfigReference reference, final StoredValue newValue )
+    {
+        changeLog.put( reference, newValue );
+        originalValue.put( reference, null );
     }
 
     @Override
-    public void updateChangeLog(final StoredConfigReference reference, final StoredValue currentValue, final StoredValue newValue) {
-        if (originalValue.containsKey(reference)) {
-            if (newValue.equals(originalValue.get(reference))) {
-                originalValue.remove(reference);
-                changeLog.remove(reference);
+    public void updateChangeLog( final StoredConfigReference reference, final StoredValue currentValue, final StoredValue newValue )
+    {
+        if ( originalValue.containsKey( reference ) )
+        {
+            if ( newValue.equals( originalValue.get( reference ) ) )
+            {
+                originalValue.remove( reference );
+                changeLog.remove( reference );
             }
-        } else {
-            originalValue.put(reference, currentValue);
-            changeLog.put(reference, newValue);
+        }
+        else
+        {
+            originalValue.put( reference, currentValue );
+            changeLog.put( reference, newValue );
         }
     }
 
     @Override
-    public Collection<StoredConfigReference> changedValues() {
+    public Collection<StoredConfigReference> changedValues( )
+    {
         return changeLog.keySet();
     }
 }

+ 11 - 12
server/src/main/java/password/pwm/config/stored/ConfigurationProperty.java

@@ -22,25 +22,24 @@
 
 package password.pwm.config.stored;
 
-public enum ConfigurationProperty {
-    CONFIG_IS_EDITABLE("configIsEditable"),
-    CONFIG_EPOCH("configEpoch"),
-    LDAP_TEMPLATE("configTemplate"),
-    NOTES("notes"),
-    PASSWORD_HASH("configPasswordHash"),
-    CONFIG_ON_START("saveConfigOnStart"),
-    MODIFIFICATION_TIMESTAMP("modificationTimestamp"),
-
-    ;
+public enum ConfigurationProperty
+{
+    CONFIG_IS_EDITABLE( "configIsEditable" ),
+    CONFIG_EPOCH( "configEpoch" ),
+    LDAP_TEMPLATE( "configTemplate" ),
+    NOTES( "notes" ),
+    PASSWORD_HASH( "configPasswordHash" ),
+    CONFIG_ON_START( "saveConfigOnStart" ),
+    MODIFIFICATION_TIMESTAMP( "modificationTimestamp" ),;
 
     private final String key;
 
-    ConfigurationProperty(final String key)
+    ConfigurationProperty( final String key )
     {
         this.key = key;
     }
 
-    public String getKey()
+    public String getKey( )
     {
         return key;
     }

+ 143 - 83
server/src/main/java/password/pwm/config/stored/ConfigurationReader.java

@@ -55,8 +55,9 @@ import java.util.List;
  *
  * @author Jason D. Rivard
  */
-public class ConfigurationReader {
-    private static final PwmLogger LOGGER = PwmLogger.getLogger(ConfigurationReader.class.getName());
+public class ConfigurationReader
+{
+    private static final PwmLogger LOGGER = PwmLogger.getLogger( ConfigurationReader.class.getName() );
 
     private final File configFile;
     private final String configFileChecksum;
@@ -70,95 +71,129 @@ public class ConfigurationReader {
 
     private volatile boolean saveInProgress;
 
-    public ConfigurationReader(final File configFile) throws PwmUnrecoverableException {
+    public ConfigurationReader( final File configFile ) throws PwmUnrecoverableException
+    {
         this.configFile = configFile;
 
-        this.configFileChecksum = readFileChecksum(configFile);
-        try {
+        this.configFileChecksum = readFileChecksum( configFile );
+        try
+        {
             this.storedConfiguration = readStoredConfig();
             this.configFileError = null;
-        } catch (PwmUnrecoverableException e) {
+        }
+        catch ( PwmUnrecoverableException e )
+        {
             this.configFileError = e.getErrorInformation();
-            LOGGER.warn("error reading configuration file: " + e.getMessage());
+            LOGGER.warn( "error reading configuration file: " + e.getMessage() );
         }
 
-        if (storedConfiguration == null) {
+        if ( storedConfiguration == null )
+        {
             this.storedConfiguration = StoredConfigurationImpl.newStoredConfiguration();
         }
 
-        LOGGER.debug("configuration mode: " + configMode);
+        LOGGER.debug( "configuration mode: " + configMode );
     }
 
-    public PwmApplicationMode getConfigMode() {
+    public PwmApplicationMode getConfigMode( )
+    {
         return configMode;
     }
 
-    public StoredConfigurationImpl getStoredConfiguration() {
+    public StoredConfigurationImpl getStoredConfiguration( )
+    {
         return storedConfiguration;
     }
 
-    public Configuration getConfiguration() throws PwmUnrecoverableException {
-        if (configuration == null) {
+    public Configuration getConfiguration( ) throws PwmUnrecoverableException
+    {
+        if ( configuration == null )
+        {
             final StoredConfigurationImpl newStoredConfig = this.storedConfiguration == null
                     ? StoredConfigurationImpl.newStoredConfiguration()
                     : this.storedConfiguration;
-            configuration = new Configuration(newStoredConfig);
-            if (storedConfiguration != null) {
+            configuration = new Configuration( newStoredConfig );
+            if ( storedConfiguration != null )
+            {
                 storedConfiguration.lock();
             }
         }
         return configuration;
     }
 
-    private StoredConfigurationImpl readStoredConfig() throws PwmUnrecoverableException {
-        LOGGER.debug("loading configuration file: " + configFile);
+    private StoredConfigurationImpl readStoredConfig( ) throws PwmUnrecoverableException
+    {
+        LOGGER.debug( "loading configuration file: " + configFile );
 
         configurationReadTime = new Date();
 
-        if (!configFile.exists()) {
-            LOGGER.warn("configuration file '" + configFile.getAbsolutePath() + "' does not exist");
+        if ( !configFile.exists() )
+        {
+            LOGGER.warn( "configuration file '" + configFile.getAbsolutePath() + "' does not exist" );
             return null;
         }
 
         final Instant startTime = Instant.now();
         final InputStream theFileData;
-        try {
-            final byte[] contents = FileUtils.readFileToByteArray(configFile);
-            theFileData = new ByteArrayInputStream(contents);
-        } catch (Exception e) {
+        try
+        {
+            final byte[] contents = FileUtils.readFileToByteArray( configFile );
+            theFileData = new ByteArrayInputStream( contents );
+        }
+        catch ( Exception e )
+        {
             final String errorMsg = "unable to read configuration file: " + e.getMessage();
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,null,new String[]{errorMsg});
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.CONFIG_FORMAT_ERROR, null, new String[]
+                    {
+                            errorMsg,
+                    }
+            );
             this.configMode = PwmApplicationMode.ERROR;
-            throw new PwmUnrecoverableException(errorInformation);
+            throw new PwmUnrecoverableException( errorInformation );
         }
 
         final StoredConfigurationImpl storedConfiguration;
-        try {
-            storedConfiguration = StoredConfigurationImpl.fromXml(theFileData);
+        try
+        {
+            storedConfiguration = StoredConfigurationImpl.fromXml( theFileData );
             //restoredConfiguration = (new NGStoredConfigurationFactory()).fromXml(theFileData);
-        } catch (PwmUnrecoverableException e) {
+        }
+        catch ( PwmUnrecoverableException e )
+        {
             final String errorMsg = "unable to parse configuration file: " + e.getMessage();
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,null,new String[]{errorMsg});
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.CONFIG_FORMAT_ERROR, null, new String[]
+                    {
+                            errorMsg,
+                    }
+            );
             this.configMode = PwmApplicationMode.ERROR;
-            throw new PwmUnrecoverableException(errorInformation);
+            throw new PwmUnrecoverableException( errorInformation );
         }
 
         final List<String> validationErrorMsgs = storedConfiguration.validateValues();
-        if (validationErrorMsgs != null && !validationErrorMsgs.isEmpty()) {
-            final String errorMsg = "value error in config file, please investigate: " + validationErrorMsgs.get(0);
-            final ErrorInformation errorInformation = new ErrorInformation(PwmError.CONFIG_FORMAT_ERROR,null,new String[]{errorMsg});
+        if ( validationErrorMsgs != null && !validationErrorMsgs.isEmpty() )
+        {
+            final String errorMsg = "value error in config file, please investigate: " + validationErrorMsgs.get( 0 );
+            final ErrorInformation errorInformation = new ErrorInformation( PwmError.CONFIG_FORMAT_ERROR, null, new String[]
+                    {
+                            errorMsg,
+                    }
+                    );
             this.configMode = PwmApplicationMode.ERROR;
-            throw new PwmUnrecoverableException(errorInformation);
+            throw new PwmUnrecoverableException( errorInformation );
         }
 
-        final String configIsEditable = storedConfiguration.readConfigProperty(ConfigurationProperty.CONFIG_IS_EDITABLE);
-        if (PwmConstants.TRIAL_MODE || (configIsEditable != null && "true".equalsIgnoreCase(configIsEditable))) {
+        final String configIsEditable = storedConfiguration.readConfigProperty( ConfigurationProperty.CONFIG_IS_EDITABLE );
+        if ( PwmConstants.TRIAL_MODE || ( configIsEditable != null && "true".equalsIgnoreCase( configIsEditable ) ) )
+        {
             this.configMode = PwmApplicationMode.CONFIGURATION;
-        } else {
+        }
+        else
+        {
             this.configMode = PwmApplicationMode.RUNNING;
         }
 
-        LOGGER.debug("configuration reading/parsing complete in " + TimeDuration.fromCurrent(startTime).asLongString());
+        LOGGER.debug( "configuration reading/parsing complete in " + TimeDuration.fromCurrent( startTime ).asLongString() );
 
         return storedConfiguration;
     }
@@ -172,95 +207,120 @@ public class ConfigurationReader {
     {
         File backupDirectory = null;
         int backupRotations = 0;
-        if (pwmApplication != null) {
-            final Configuration configuration = new Configuration(storedConfiguration);
-            final String backupDirSetting = configuration.readAppProperty(AppProperty.BACKUP_LOCATION);
-            if (backupDirSetting != null && backupDirSetting.length() > 0) {
+        if ( pwmApplication != null )
+        {
+            final Configuration configuration = new Configuration( storedConfiguration );
+            final String backupDirSetting = configuration.readAppProperty( AppProperty.BACKUP_LOCATION );
+            if ( backupDirSetting != null && backupDirSetting.length() > 0 )
+            {
                 final File pwmPath = pwmApplication.getPwmEnvironment().getApplicationPath();
-                backupDirectory = FileSystemUtility.figureFilepath(backupDirSetting, pwmPath);
+                backupDirectory = FileSystemUtility.figureFilepath( backupDirSetting, pwmPath );
             }
-            backupRotations = Integer.parseInt(configuration.readAppProperty(AppProperty.BACKUP_CONFIG_COUNT));
+            backupRotations = Integer.parseInt( configuration.readAppProperty( AppProperty.BACKUP_CONFIG_COUNT ) );
         }
 
 
-        { // increment the config epoch
-            String epochStrValue = storedConfiguration.readConfigProperty(ConfigurationProperty.CONFIG_EPOCH);
-            try {
-                final BigInteger epochValue = epochStrValue == null || epochStrValue.length() < 0 ? BigInteger.ZERO : new BigInteger(epochStrValue);
-                epochStrValue = epochValue.add(BigInteger.ONE).toString();
-            } catch (Exception e) {
-                LOGGER.error(sessionLabel, "error trying to parse previous config epoch property: " + e.getMessage());
+        {
+            // increment the config epoch
+            String epochStrValue = storedConfiguration.readConfigProperty( ConfigurationProperty.CONFIG_EPOCH );
+            try
+            {
+                final BigInteger epochValue = epochStrValue == null || epochStrValue.length() < 0 ? BigInteger.ZERO : new BigInteger( epochStrValue );
+                epochStrValue = epochValue.add( BigInteger.ONE ).toString();
+            }
+            catch ( Exception e )
+            {
+                LOGGER.error( sessionLabel, "error trying to parse previous config epoch property: " + e.getMessage() );
                 epochStrValue = "0";
             }
-            storedConfiguration.writeConfigProperty(ConfigurationProperty.CONFIG_EPOCH, epochStrValue);
+            storedConfiguration.writeConfigProperty( ConfigurationProperty.CONFIG_EPOCH, epochStrValue );
         }
 
-        if (backupDirectory != null && !backupDirectory.exists()) {
-            if (!backupDirectory.mkdirs()) {
-                throw new PwmOperationalException(new ErrorInformation(PwmError.ERROR_UNKNOWN,"unable to create backup directory structure '" + backupDirectory.toString() + "'"));
+        if ( backupDirectory != null && !backupDirectory.exists() )
+        {
+            if ( !backupDirectory.mkdirs() )
+            {
+                throw new PwmOperationalException( new ErrorInformation( PwmError.ERROR_UNKNOWN,
+                        "unable to create backup directory structure '" + backupDirectory.toString() + "'" ) );
             }
         }
 
-        try {
-            final File tempWriteFile = new File(configFile.getAbsoluteFile() + ".new");
-            LOGGER.info(sessionLabel, "beginning write to configuration file " + tempWriteFile);
+        try
+        {
+            final File tempWriteFile = new File( configFile.getAbsoluteFile() + ".new" );
+            LOGGER.info( sessionLabel, "beginning write to configuration file " + tempWriteFile );
             saveInProgress = true;
 
-            try (FileOutputStream fileOutputStream = new FileOutputStream(tempWriteFile, false)) {
-                storedConfiguration.toXml(fileOutputStream);
+            try ( FileOutputStream fileOutputStream = new FileOutputStream( tempWriteFile, false ) )
+            {
+                storedConfiguration.toXml( fileOutputStream );
             }
 
-            LOGGER.info("saved configuration " + JsonUtil.serialize(storedConfiguration.toJsonDebugObject()));
-            if (pwmApplication != null) {
+            LOGGER.info( "saved configuration " + JsonUtil.serialize( storedConfiguration.toJsonDebugObject() ) );
+            if ( pwmApplication != null )
+            {
                 final String actualChecksum = storedConfiguration.settingChecksum();
-                pwmApplication.writeAppAttribute(PwmApplication.AppAttribute.CONFIG_HASH, actualChecksum);
+                pwmApplication.writeAppAttribute( PwmApplication.AppAttribute.CONFIG_HASH, actualChecksum );
             }
 
-            LOGGER.trace("renaming file " + tempWriteFile.getAbsolutePath() + " to " + configFile.getAbsolutePath());
-            try {
-                Files.move(tempWriteFile.toPath(), configFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
-            } catch (Exception e) {
+            LOGGER.trace( "renaming file " + tempWriteFile.getAbsolutePath() + " to " + configFile.getAbsolutePath() );
+            try
+            {
+                Files.move( tempWriteFile.toPath(), configFile.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE );
+            }
+            catch ( Exception e )
+            {
                 final String errorMsg = "unable to rename temporary save file from " + tempWriteFile.getAbsolutePath()
                         + " to " + configFile.getAbsolutePath() + "; error: " + e.getMessage();
-                throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_UNKNOWN, errorMsg));
+                throw new PwmUnrecoverableException( new ErrorInformation( PwmError.ERROR_UNKNOWN, errorMsg ) );
             }
 
-            if (backupDirectory != null) {
+            if ( backupDirectory != null )
+            {
                 final String configFileName = configFile.getName();
                 final String backupFilePath = backupDirectory.getAbsolutePath() + File.separatorChar + configFileName + "-backup";
-                final File backupFile = new File(backupFilePath);
-                FileSystemUtility.rotateBackups(backupFile, backupRotations);
-                try (FileOutputStream fileOutputStream = new FileOutputStream(backupFile, false)) {
-                    storedConfiguration.toXml(fileOutputStream);
+                final File backupFile = new File( backupFilePath );
+                FileSystemUtility.rotateBackups( backupFile, backupRotations );
+                try ( FileOutputStream fileOutputStream = new FileOutputStream( backupFile, false ) )
+                {
+                    storedConfiguration.toXml( fileOutputStream );
                 }
             }
-        } finally {
+        }
+        finally
+        {
             saveInProgress = false;
         }
     }
 
-    public boolean modifiedSinceLoad() {
-        final String currentChecksum = readFileChecksum(configFile);
-        return !currentChecksum.equals(configFileChecksum);
+    public boolean modifiedSinceLoad( )
+    {
+        final String currentChecksum = readFileChecksum( configFile );
+        return !currentChecksum.equals( configFileChecksum );
     }
 
-    private static String readFileChecksum(final File file) {
-        if (!file.exists()) {
+    private static String readFileChecksum( final File file )
+    {
+        if ( !file.exists() )
+        {
             return "";
         }
 
-        return String.valueOf(file.lastModified() + String.valueOf(file.length()));
+        return String.valueOf( file.lastModified() + String.valueOf( file.length() ) );
     }
 
-    public ErrorInformation getConfigFileError() {
+    public ErrorInformation getConfigFileError( )
+    {
         return configFileError;
     }
 
-    public File getConfigFile() {
+    public File getConfigFile( )
+    {
         return configFile;
     }
 
-    public boolean isSaveInProgress() {
+    public boolean isSaveInProgress( )
+    {
         return saveInProgress;
     }
 }

+ 62 - 38
server/src/main/java/password/pwm/config/stored/NGStorageEngineImpl.java

@@ -30,7 +30,8 @@ import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-class NGStorageEngineImpl implements StorageEngine {
+class NGStorageEngineImpl implements StorageEngine
+{
     private final Map<StoredConfigReference, StoredValue> values = new TreeMap<>();
     private final Map<StoredConfigReference, ValueMetaData> metaValues = new TreeMap<>();
     private final ConfigChangeLog changeLog;
@@ -41,79 +42,102 @@ class NGStorageEngineImpl implements StorageEngine {
     NGStorageEngineImpl(
             final Map<StoredConfigReference, StoredValue> values,
             final Map<StoredConfigReference, ValueMetaData> metaValues
-    ) {
-        this.values.putAll(values);
-        this.metaValues.putAll(metaValues);
-        changeLog = new ConfigChangeLogImpl(this);
+    )
+    {
+        this.values.putAll( values );
+        this.metaValues.putAll( metaValues );
+        changeLog = new ConfigChangeLogImpl( this );
     }
 
-    public ConfigChangeLog changeLog() {
+    public ConfigChangeLog changeLog( )
+    {
         return changeLog;
     }
 
-    public StoredValue read(final StoredConfigReference storedConfigReference) {
+    public StoredValue read( final StoredConfigReference storedConfigReference )
+    {
         bigLock.readLock().lock();
-        try {
-            return values.get(storedConfigReference);
-        } finally {
+        try
+        {
+            return values.get( storedConfigReference );
+        }
+        finally
+        {
             bigLock.readLock().unlock();
         }
     }
 
-    public ValueMetaData readMetaData(final StoredConfigReference storedConfigReference) {
-        return metaValues.get(storedConfigReference);
+    public ValueMetaData readMetaData( final StoredConfigReference storedConfigReference )
+    {
+        return metaValues.get( storedConfigReference );
     }
 
-    public void write(final StoredConfigReference reference, final StoredValue value, final UserIdentity userIdentity)
+    public void write( final StoredConfigReference reference, final StoredValue value, final UserIdentity userIdentity )
     {
         checkWriteLock();
         bigLock.writeLock().lock();
-        try {
-            if (values.containsKey(reference)) {
-                changeLog.updateChangeLog(reference, values.get(reference), value);
-            } else {
-                changeLog.updateChangeLog(reference, value);
+        try
+        {
+            if ( values.containsKey( reference ) )
+            {
+                changeLog.updateChangeLog( reference, values.get( reference ), value );
+            }
+            else
+            {
+                changeLog.updateChangeLog( reference, value );
             }
-            values.put(reference, value);
-            final ValueMetaData valueMetaData = new ValueMetaData(Instant.now(), userIdentity);
-            metaValues.put(reference, valueMetaData);
-        } finally {
+            values.put( reference, value );
+            final ValueMetaData valueMetaData = new ValueMetaData( Instant.now(), userIdentity );
+            metaValues.put( reference, valueMetaData );
+        }
+        finally
+        {
             bigLock.writeLock().unlock();
         }
     }
 
-    public void reset(final StoredConfigReference reference, final UserIdentity userIdentity)
+    public void reset( final StoredConfigReference reference, final UserIdentity userIdentity )
     {
         checkWriteLock();
         bigLock.writeLock().lock();
-        try {
-            if (values.containsKey(reference)) {
-                changeLog.updateChangeLog(reference, values.get(reference), null);
-            } else {
-                changeLog.updateChangeLog(reference, null);
+        try
+        {
+            if ( values.containsKey( reference ) )
+            {
+                changeLog.updateChangeLog( reference, values.get( reference ), null );
+            }
+            else
+            {
+                changeLog.updateChangeLog( reference, null );
             }
-            values.remove(reference);
-            if (metaValues.containsKey(reference)) {
-                final ValueMetaData valueMetaData = new ValueMetaData(Instant.now(), userIdentity);
-                metaValues.put(reference, valueMetaData);
+            values.remove( reference );
+            if ( metaValues.containsKey( reference ) )
+            {
+                final ValueMetaData valueMetaData = new ValueMetaData( Instant.now(), userIdentity );
+                metaValues.put( reference, valueMetaData );
             }
-        } finally {
+        }
+        finally
+        {
             bigLock.writeLock().unlock();
         }
     }
 
-    private void checkWriteLock()
+    private void checkWriteLock( )
     {
-        if (writeLocked) {
-            throw new IllegalStateException("attempt to modify writeLock configuration");
+        if ( writeLocked )
+        {
+            throw new IllegalStateException( "attempt to modify writeLock configuration" );
         }
     }
 
-    public boolean isWriteLocked() {
+    public boolean isWriteLocked( )
+    {
         return writeLocked;
     }
 
-    public void writeLock() {
+    public void writeLock( )
+    {
         writeLocked = true;
     }
 }

+ 59 - 39
server/src/main/java/password/pwm/config/stored/NGStoredConfiguration.java

@@ -35,91 +35,102 @@ import password.pwm.util.secure.PwmSecurityKey;
 import java.time.Instant;
 import java.util.Map;
 
-class NGStoredConfiguration implements StoredConfiguration {
-    private static final PwmLogger LOGGER = PwmLogger.forClass(NGStoredConfiguration.class);
+class NGStoredConfiguration implements StoredConfiguration
+{
+    private static final PwmLogger LOGGER = PwmLogger.forClass( NGStoredConfiguration.class );
     private final PwmSecurityKey configurationSecurityKey;
     private final StorageEngine engine;
 
     NGStoredConfiguration(
             final Map<StoredConfigReference, StoredValue> values,
             final Map<StoredConfigReference, ValueMetaData> metaValues,
-            final PwmSecurityKey pwmSecurityKey)
+            final PwmSecurityKey pwmSecurityKey )
     {
-        engine = new NGStorageEngineImpl(values, metaValues);
+        engine = new NGStorageEngineImpl( values, metaValues );
         configurationSecurityKey = pwmSecurityKey;
     }
 
-    public String readConfigProperty(final ConfigurationProperty configurationProperty) {
+    public String readConfigProperty( final ConfigurationProperty configurationProperty )
+    {
         final StoredConfigReference storedConfigReference = new StoredConfigReferenceBean(
                 StoredConfigReference.RecordType.PROPERTY,
                 configurationProperty.getKey(),
                 null
         );
-        final StoredValue storedValue = engine.read(storedConfigReference);
-        if (storedValue == null | !(storedValue instanceof StringValue)) {
+        final StoredValue storedValue = engine.read( storedConfigReference );
+        if ( storedValue == null | !( storedValue instanceof StringValue ) )
+        {
             return null;
         }
-        return (String) storedValue.toNativeObject();
+        return ( String ) storedValue.toNativeObject();
     }
 
-    public void writeConfigProperty(final ConfigurationProperty configurationProperty, final String value)
+    public void writeConfigProperty( final ConfigurationProperty configurationProperty, final String value )
     {
         final StoredConfigReference storedConfigReference = new StoredConfigReferenceBean(
                 StoredConfigReference.RecordType.PROPERTY,
                 configurationProperty.getKey(),
                 null
         );
-        final StoredValue storedValue = new StringValue(value);
-        engine.write(storedConfigReference, storedValue, null);
+        final StoredValue storedValue = new StringValue( value );
+        engine.write( storedConfigReference, storedValue, null );
     }
 
-    public void resetSetting(final PwmSetting setting, final String profileID, final UserIdentity userIdentity) {
+    public void resetSetting( final PwmSetting setting, final String profileID, final UserIdentity userIdentity )
+    {
         final StoredConfigReference storedConfigReference = new StoredConfigReferenceBean(
                 StoredConfigReference.RecordType.SETTING,
                 setting.getKey(),
                 profileID
         );
-        engine.reset(storedConfigReference, userIdentity);
+        engine.reset( storedConfigReference, userIdentity );
     }
 
-    public boolean isDefaultValue(final PwmSetting setting) {
-        return isDefaultValue(setting, null);
+    public boolean isDefaultValue( final PwmSetting setting )
+    {
+        return isDefaultValue( setting, null );
     }
 
-    public boolean isDefaultValue(final PwmSetting setting, final String profileID) {
+    public boolean isDefaultValue( final PwmSetting setting, final String profileID )
+    {
         final StoredConfigReference storedConfigReference = new StoredConfigReferenceBean(
                 StoredConfigReference.RecordType.SETTING,
                 setting.getKey(),
                 profileID
         );
-        final StoredValue value = engine.read(storedConfigReference);
+        final StoredValue value = engine.read( storedConfigReference );
         return value == null;
     }
 
-    public StoredValue readSetting(final PwmSetting setting) {
-        return readSetting(setting, null);
+    public StoredValue readSetting( final PwmSetting setting )
+    {
+        return readSetting( setting, null );
     }
 
-    public StoredValue readSetting(final PwmSetting setting, final String profileID) {
+    public StoredValue readSetting( final PwmSetting setting, final String profileID )
+    {
         final StoredConfigReference storedConfigReference = new StoredConfigReferenceBean(
                 StoredConfigReference.RecordType.SETTING,
                 setting.getKey(),
                 profileID
         );
-        return engine.read(storedConfigReference);
+        return engine.read( storedConfigReference );
     }
 
-    public void copyProfileID(final PwmSettingCategory category, final String sourceID, final String destinationID, final UserIdentity userIdentity)
-            throws PwmUnrecoverableException {
-        throw new IllegalStateException("not implemented"); //@todo
+    public void copyProfileID( final PwmSettingCategory category, final String sourceID, final String destinationID, final UserIdentity userIdentity )
+            throws PwmUnrecoverableException
+    {
+        //@todo
+        throw new IllegalStateException( "not implemented" );
     }
 
     public void writeSetting(
             final PwmSetting setting,
             final StoredValue value,
             final UserIdentity userIdentity
-    ) throws PwmUnrecoverableException {
-        writeSetting(setting, null, value, userIdentity);
+    ) throws PwmUnrecoverableException
+    {
+        writeSetting( setting, null, value, userIdentity );
     }
 
     public void writeSetting(
@@ -135,41 +146,50 @@ class NGStoredConfiguration implements StoredConfiguration {
                 setting.getKey(),
                 profileID
         );
-        engine.write(storedConfigReference, value, userIdentity);
+        engine.write( storedConfigReference, value, userIdentity );
     }
 
     @Override
-    public PwmSecurityKey getKey() throws PwmUnrecoverableException {
+    public PwmSecurityKey getKey( ) throws PwmUnrecoverableException
+    {
         return configurationSecurityKey;
     }
 
     @Override
-    public boolean isLocked() {
+    public boolean isLocked( )
+    {
         return engine.isWriteLocked();
     }
 
     @Override
-    public void lock() {
+    public void lock( )
+    {
         engine.writeLock();
     }
 
     @Override
-    public ValueMetaData readSettingMetadata(final PwmSetting setting, final String profileID) {
+    public ValueMetaData readSettingMetadata( final PwmSetting setting, final String profileID )
+    {
         final StoredConfigReference storedConfigReference = new StoredConfigReferenceBean(
                 StoredConfigReference.RecordType.SETTING,
                 setting.getKey(),
                 profileID
         );
-        return engine.readMetaData(storedConfigReference);
+        return engine.readMetaData( storedConfigReference );
     }
 
-    public Instant modifyTime() {
-        final String modifyTimeString = readConfigProperty(ConfigurationProperty.MODIFIFICATION_TIMESTAMP);
-        if (modifyTimeString != null) {
-            try {
-                return JavaHelper.parseIsoToInstant((modifyTimeString));
-            } catch (Exception e) {
-                LOGGER.error("error parsing last modified timestamp property: " + e.getMessage());
+    public Instant modifyTime( )
+    {
+        final String modifyTimeString = readConfigProperty( ConfigurationProperty.MODIFIFICATION_TIMESTAMP );
+        if ( modifyTimeString != null )
+        {
+            try
+            {
+                return JavaHelper.parseIsoToInstant( ( modifyTimeString ) );
+            }
+            catch ( Exception e )
+            {
+                LOGGER.error( "error parsing last modified timestamp property: " + e.getMessage() );
             }
         }
         return null;

+ 88 - 62
server/src/main/java/password/pwm/config/stored/NGStoredConfigurationFactory.java

@@ -42,43 +42,52 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 
 
-public class NGStoredConfigurationFactory {
-    private static final PwmLogger LOGGER = PwmLogger.forClass(NGStoredConfigurationFactory.class);
+public class NGStoredConfigurationFactory
+{
+    private static final PwmLogger LOGGER = PwmLogger.forClass( NGStoredConfigurationFactory.class );
 
     //@Override
-    public NGStoredConfiguration fromXml(final InputStream inputStream) throws PwmUnrecoverableException {
-        return XmlEngine.fromXmlImpl(inputStream);
+    public NGStoredConfiguration fromXml( final InputStream inputStream ) throws PwmUnrecoverableException
+    {
+        return XmlEngine.fromXmlImpl( inputStream );
     }
 
     //@Override
-    public void toXml(final OutputStream outputStream) {
+    public void toXml( final OutputStream outputStream )
+    {
     }
 
-    private static class XmlEngine {
+    private static class XmlEngine
+    {
 
-        static NGStoredConfiguration fromXmlImpl(final InputStream inputStream)
+        static NGStoredConfiguration fromXmlImpl( final InputStream inputStream )
                 throws PwmUnrecoverableException
         {
             final Map<StoredConfigReference, StoredValue> values = new LinkedHashMap<>();
             final Map<StoredConfigReference, ValueMetaData> metaData = new LinkedHashMap<>();
 
-            final Document inputDocument = XmlUtil.parseXml(inputStream);
+            final Document inputDocument = XmlUtil.parseXml( inputStream );
             final Element rootElement = inputDocument.getRootElement();
 
-            final PwmSecurityKey pwmSecurityKey = readSecurityKey(rootElement);
+            final PwmSecurityKey pwmSecurityKey = readSecurityKey( rootElement );
 
-            final Element settingsElement = rootElement.getChild(StoredConfiguration.XML_ELEMENT_SETTINGS);
+            final Element settingsElement = rootElement.getChild( StoredConfiguration.XML_ELEMENT_SETTINGS );
 
-            for (final Element loopElement : settingsElement.getChildren()) {
-                if (StoredConfiguration.XML_ELEMENT_PROPERTIES.equals(loopElement.getName())) {
-                    for (final Element propertyElement : loopElement.getChildren(StoredConfiguration.XML_ELEMENT_PROPERTY)) {
-                        readInterestingElement(propertyElement, pwmSecurityKey, values, metaData);
+            for ( final Element loopElement : settingsElement.getChildren() )
+            {
+                if ( StoredConfiguration.XML_ELEMENT_PROPERTIES.equals( loopElement.getName() ) )
+                {
+                    for ( final Element propertyElement : loopElement.getChildren( StoredConfiguration.XML_ELEMENT_PROPERTY ) )
+                    {
+                        readInterestingElement( propertyElement, pwmSecurityKey, values, metaData );
                     }
-                } else {
-                    readInterestingElement(loopElement, pwmSecurityKey, values, metaData);
+                }
+                else
+                {
+                    readInterestingElement( loopElement, pwmSecurityKey, values, metaData );
                 }
             }
-            return new NGStoredConfiguration(values, metaData, readSecurityKey(rootElement));
+            return new NGStoredConfiguration( values, metaData, readSecurityKey( rootElement ) );
         }
 
         static void readInterestingElement(
@@ -88,37 +97,40 @@ public class NGStoredConfigurationFactory {
                 final Map<StoredConfigReference, ValueMetaData> metaData
         )
         {
-            final StoredConfigReference reference = referenceForElement(loopElement);
-            if (reference != null) {
-                switch (reference.getRecordType()) {
+            final StoredConfigReference reference = referenceForElement( loopElement );
+            if ( reference != null )
+            {
+                switch ( reference.getRecordType() )
+                {
                     case SETTING:
                     {
-                        final StoredValue storedValue = readSettingValue(reference, loopElement, pwmSecurityKey);
-                        values.put(reference, storedValue);
+                        final StoredValue storedValue = readSettingValue( reference, loopElement, pwmSecurityKey );
+                        values.put( reference, storedValue );
                     }
                     break;
 
                     case PROPERTY:
                     {
-                        final StoredValue storedValue = readPropertyValue(reference, loopElement);
+                        final StoredValue storedValue = readPropertyValue( reference, loopElement );
                     }
                     break;
 
                     default:
-                        throw new IllegalArgumentException("unimplemented setting recordtype in reader");
+                        throw new IllegalArgumentException( "unimplemented setting recordtype in reader" );
                 }
-                final ValueMetaData valueMetaData = readValueMetaData(loopElement);
-                if (valueMetaData != null) {
-                    metaData.put(reference, valueMetaData);
+                final ValueMetaData valueMetaData = readValueMetaData( loopElement );
+                if ( valueMetaData != null )
+                {
+                    metaData.put( reference, valueMetaData );
                 }
             }
         }
 
-        static PwmSecurityKey readSecurityKey(final Element rootElement)
+        static PwmSecurityKey readSecurityKey( final Element rootElement )
                 throws PwmUnrecoverableException
         {
-            final String createTime = rootElement.getAttributeValue(StoredConfiguration.XML_ATTRIBUTE_CREATE_TIME);
-            return new PwmSecurityKey(createTime + "StoredConfiguration");
+            final String createTime = rootElement.getAttributeValue( StoredConfiguration.XML_ATTRIBUTE_CREATE_TIME );
+            return new PwmSecurityKey( createTime + "StoredConfiguration" );
         }
 
         static StoredValue readSettingValue(
@@ -128,17 +140,24 @@ public class NGStoredConfigurationFactory {
         )
         {
             final String key = storedConfigReference.getRecordID();
-            final PwmSetting pwmSetting = PwmSetting.forKey(key);
-
-            if (pwmSetting == null) {
-                LOGGER.debug("ignoring setting for unknown key: " + key);
-            } else {
-                LOGGER.trace("parsing setting key=" + key + ", profile=" + storedConfigReference.getProfileID());
-                if (settingElement.getChild(StoredConfiguration.XML_ELEMENT_DEFAULT) != null) {
-                    try {
-                        return ValueFactory.fromXmlValues(pwmSetting, settingElement, pwmSecurityKey);
-                    } catch (IllegalStateException e) {
-                        LOGGER.error("error parsing configuration setting " + storedConfigReference + ", error: " + e.getMessage());
+            final PwmSetting pwmSetting = PwmSetting.forKey( key );
+
+            if ( pwmSetting == null )
+            {
+                LOGGER.debug( "ignoring setting for unknown key: " + key );
+            }
+            else
+            {
+                LOGGER.trace( "parsing setting key=" + key + ", profile=" + storedConfigReference.getProfileID() );
+                if ( settingElement.getChild( StoredConfiguration.XML_ELEMENT_DEFAULT ) != null )
+                {
+                    try
+                    {
+                        return ValueFactory.fromXmlValues( pwmSetting, settingElement, pwmSecurityKey );
+                    }
+                    catch ( IllegalStateException e )
+                    {
+                        LOGGER.error( "error parsing configuration setting " + storedConfigReference + ", error: " + e.getMessage() );
                     }
                 }
             }
@@ -152,18 +171,21 @@ public class NGStoredConfigurationFactory {
         {
             final String key = storedConfigReference.getRecordID();
 
-            LOGGER.trace("parsing property key=" + key + ", profile=" + storedConfigReference.getProfileID());
-            if (settingElement.getChild(StoredConfiguration.XML_ELEMENT_DEFAULT) != null) {
-                return new StringValue(settingElement.getValue());
+            LOGGER.trace( "parsing property key=" + key + ", profile=" + storedConfigReference.getProfileID() );
+            if ( settingElement.getChild( StoredConfiguration.XML_ELEMENT_DEFAULT ) != null )
+            {
+                return new StringValue( settingElement.getValue() );
             }
             return null;
         }
 
-        static StoredConfigReference referenceForElement(final Element settingElement) {
-            final String key = settingElement.getAttributeValue(StoredConfiguration.XML_ATTRIBUTE_KEY);
-            final String profileID = readProfileID(settingElement);
+        static StoredConfigReference referenceForElement( final Element settingElement )
+        {
+            final String key = settingElement.getAttributeValue( StoredConfiguration.XML_ATTRIBUTE_KEY );
+            final String profileID = readProfileID( settingElement );
             final StoredConfigReference.RecordType recordType;
-            switch (settingElement.getName()) {
+            switch ( settingElement.getName() )
+            {
                 case StoredConfiguration.XML_ELEMENT_SETTING:
                     recordType = StoredConfigReference.RecordType.SETTING;
                     break;
@@ -177,7 +199,7 @@ public class NGStoredConfigurationFactory {
                     break;
 
                 default:
-                    LOGGER.warn("unrecognized xml element " + settingElement.getName() + " in configuration");
+                    LOGGER.warn( "unrecognized xml element " + settingElement.getName() + " in configuration" );
                     return null;
             }
 
@@ -189,30 +211,34 @@ public class NGStoredConfigurationFactory {
             );
         }
 
-        static String readProfileID(final Element settingElement) {
-            final String profileIDStr = settingElement.getAttributeValue(StoredConfiguration.XML_ATTRIBUTE_PROFILE);
-            return  profileIDStr != null && !profileIDStr.isEmpty() ? profileIDStr : null;
+        static String readProfileID( final Element settingElement )
+        {
+            final String profileIDStr = settingElement.getAttributeValue( StoredConfiguration.XML_ATTRIBUTE_PROFILE );
+            return profileIDStr != null && !profileIDStr.isEmpty() ? profileIDStr : null;
         }
 
-        static ValueMetaData readValueMetaData(final Element element)
+        static ValueMetaData readValueMetaData( final Element element )
         {
-            final String modifyDateStr = element.getAttributeValue(StoredConfiguration.XML_ATTRIBUTE_MODIFY_TIME);
+            final String modifyDateStr = element.getAttributeValue( StoredConfiguration.XML_ATTRIBUTE_MODIFY_TIME );
             Instant modifyDate = null;
-            try {
+            try
+            {
                 modifyDate = modifyDateStr == null || modifyDateStr.isEmpty()
                         ? null
-                        : JavaHelper.parseIsoToInstant(modifyDateStr);
-            } catch (Exception e) {
-                LOGGER.warn("error parsing stored date: " +  e.getMessage());
+                        : JavaHelper.parseIsoToInstant( modifyDateStr );
+            }
+            catch ( Exception e )
+            {
+                LOGGER.warn( "error parsing stored date: " + e.getMessage() );
             }
-            final String modifyUser = element.getAttributeValue(StoredConfiguration.XML_ATTRIBUTE_MODIFY_USER);
-            final String modifyUserProfile = element.getAttributeValue(StoredConfiguration.XML_ATTRIBUTE_MODIFY_USER_PROFILE);
+            final String modifyUser = element.getAttributeValue( StoredConfiguration.XML_ATTRIBUTE_MODIFY_USER );
+            final String modifyUserProfile = element.getAttributeValue( StoredConfiguration.XML_ATTRIBUTE_MODIFY_USER_PROFILE );
             final UserIdentity userIdentity;
             userIdentity = modifyUser != null
-                    ? new UserIdentity(modifyUser, modifyUserProfile)
+                    ? new UserIdentity( modifyUser, modifyUserProfile )
                     : null;
 
-            return new ValueMetaData(modifyDate, userIdentity);
+            return new ValueMetaData( modifyDate, userIdentity );
         }
     }
 

+ 9 - 8
server/src/main/java/password/pwm/config/stored/StorageEngine.java

@@ -25,18 +25,19 @@ package password.pwm.config.stored;
 import password.pwm.bean.UserIdentity;
 import password.pwm.config.StoredValue;
 
-interface StorageEngine {
-    StoredValue read(StoredConfigReference storedConfigReference);
+interface StorageEngine
+{
+    StoredValue read( StoredConfigReference storedConfigReference );
 
-    void write(StoredConfigReference storedConfigReference, StoredValue value, UserIdentity userIdentity);
+    void write( StoredConfigReference storedConfigReference, StoredValue value, UserIdentity userIdentity );
 
-    void reset(StoredConfigReference storedConfigReference, UserIdentity userIdentity);
+    void reset( StoredConfigReference storedConfigReference, UserIdentity userIdentity );
 
-    boolean isWriteLocked();
+    boolean isWriteLocked( );
 
-    void writeLock();
+    void writeLock( );
 
-    ValueMetaData readMetaData(StoredConfigReference storedConfigReference);
+    ValueMetaData readMetaData( StoredConfigReference storedConfigReference );
 
-    ConfigChangeLog changeLog();
+    ConfigChangeLog changeLog( );
 }

+ 7 - 5
server/src/main/java/password/pwm/config/stored/StoredConfigReference.java

@@ -24,14 +24,16 @@ package password.pwm.config.stored;
 
 import java.io.Serializable;
 
-public interface StoredConfigReference extends Serializable, Comparable {
-    RecordType getRecordType();
+public interface StoredConfigReference extends Serializable, Comparable
+{
+    RecordType getRecordType( );
 
-    String getRecordID();
+    String getRecordID( );
 
-    String getProfileID();
+    String getProfileID( );
 
-    enum RecordType {
+    enum RecordType
+    {
         SETTING,
         LOCALE_BUNDLE,
         PROPERTY,

+ 27 - 16
server/src/main/java/password/pwm/config/stored/StoredConfigReferenceBean.java

@@ -24,18 +24,22 @@ package password.pwm.config.stored;
 
 import java.io.Serializable;
 
-class StoredConfigReferenceBean implements StoredConfigReference, Serializable, Comparable {
+class StoredConfigReferenceBean implements StoredConfigReference, Serializable, Comparable
+{
     private RecordType recordType;
     private String recordID;
     private String profileID;
 
-    StoredConfigReferenceBean(final RecordType type, final String recordID, final String profileID) {
-        if (type == null) {
-            throw new NullPointerException("recordType can not be null");
+    StoredConfigReferenceBean( final RecordType type, final String recordID, final String profileID )
+    {
+        if ( type == null )
+        {
+            throw new NullPointerException( "recordType can not be null" );
         }
 
-        if (recordID == null) {
-            throw new NullPointerException("recordID can not be null");
+        if ( recordID == null )
+        {
+            throw new NullPointerException( "recordID can not be null" );
         }
 
         this.recordType = type;
@@ -43,43 +47,50 @@ class StoredConfigReferenceBean implements StoredConfigReference, Serializable,
         this.profileID = profileID;
     }
 
-    public RecordType getRecordType() {
+    public RecordType getRecordType( )
+    {
         return recordType;
     }
 
-    public String getRecordID() {
+    public String getRecordID( )
+    {
         return recordID;
     }
 
     @Override
-    public String getProfileID() {
+    public String getProfileID( )
+    {
         return profileID;
     }
 
     @Override
-    public boolean equals(final Object o) {
+    public boolean equals( final Object o )
+    {
         return o != null
                 && o instanceof StoredConfigReference
-                && toString().equals(o.toString());
+                && toString().equals( o.toString() );
 
     }
 
     @Override
-    public int hashCode() {
+    public int hashCode( )
+    {
         return toString().hashCode();
     }
 
     @Override
-    public String toString() {
+    public String toString( )
+    {
         return this.getRecordType().toString()
                 + "-"
-                + (this.getProfileID() == null ? "" : this.getProfileID())
+                + ( this.getProfileID() == null ? "" : this.getProfileID() )
                 + "-"
                 + this.getRecordID();
     }
 
     @Override
-    public int compareTo(final Object o) {
-        return toString().compareTo(o.toString());
+    public int compareTo( final Object o )
+    {
+        return toString().compareTo( o.toString() );
     }
 }

+ 14 - 13
server/src/main/java/password/pwm/config/stored/StoredConfiguration.java

@@ -31,7 +31,8 @@ import password.pwm.util.secure.PwmSecurityKey;
 
 import java.time.Instant;
 
-public interface StoredConfiguration {
+public interface StoredConfiguration
+{
     String XML_ELEMENT_ROOT = "PwmConfiguration";
     String XML_ELEMENT_PROPERTIES = "properties";
     String XML_ELEMENT_PROPERTY = "property";
@@ -54,34 +55,34 @@ public interface StoredConfiguration {
     String XML_ATTRIBUTE_BUNDLE = "bundle";
 
 
-    PwmSecurityKey getKey() throws PwmUnrecoverableException;
+    PwmSecurityKey getKey( ) throws PwmUnrecoverableException;
 
-    Instant modifyTime();
+    Instant modifyTime( );
 
-    boolean isLocked();
+    boolean isLocked( );
 
-    String readConfigProperty(ConfigurationProperty propertyName);
+    String readConfigProperty( ConfigurationProperty propertyName );
 
     void writeConfigProperty(
             ConfigurationProperty propertyName,
             String value
     );
 
-    void lock();
+    void lock( );
 
-    ValueMetaData readSettingMetadata( PwmSetting setting,  String profileID);
+    ValueMetaData readSettingMetadata( PwmSetting setting, String profileID );
 
-    void resetSetting(PwmSetting setting, String profileID, UserIdentity userIdentity);
+    void resetSetting( PwmSetting setting, String profileID, UserIdentity userIdentity );
 
-    boolean isDefaultValue(PwmSetting setting);
+    boolean isDefaultValue( PwmSetting setting );
 
-    boolean isDefaultValue(PwmSetting setting, String profileID);
+    boolean isDefaultValue( PwmSetting setting, String profileID );
 
-    StoredValue readSetting(PwmSetting setting);
+    StoredValue readSetting( PwmSetting setting );
 
-    StoredValue readSetting(PwmSetting setting, String profileID);
+    StoredValue readSetting( PwmSetting setting, String profileID );
 
-    void copyProfileID(PwmSettingCategory category, String sourceID, String destinationID, UserIdentity userIdentity)
+    void copyProfileID( PwmSettingCategory category, String sourceID, String destinationID, UserIdentity userIdentity )
             throws PwmUnrecoverableException;
 
     void writeSetting(

+ 4 - 3
server/src/main/java/password/pwm/config/stored/StoredConfigurationFactory.java

@@ -27,8 +27,9 @@ import password.pwm.error.PwmUnrecoverableException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
-interface StoredConfigurationFactory {
-    StoredConfiguration fromXml( InputStream inputStream) throws PwmUnrecoverableException;
+interface StoredConfigurationFactory
+{
+    StoredConfiguration fromXml( InputStream inputStream ) throws PwmUnrecoverableException;
 
-    void toXml( OutputStream outputStream);
+    void toXml( OutputStream outputStream );
 }

File diff suppressed because it is too large
+ 492 - 322
server/src/main/java/password/pwm/config/stored/StoredConfigurationImpl.java


+ 4 - 3
server/src/main/java/password/pwm/config/stored/StoredConfigurationProvider.java

@@ -27,8 +27,9 @@ import password.pwm.error.PwmUnrecoverableException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
-interface StoredConfigurationProvider {
-    StoredConfiguration fromXml( InputStream inputStream) throws PwmUnrecoverableException;
+interface StoredConfigurationProvider
+{
+    StoredConfiguration fromXml( InputStream inputStream ) throws PwmUnrecoverableException;
 
-    void toXml( OutputStream outputStream);
+    void toXml( OutputStream outputStream );
 }

+ 60 - 41
server/src/main/java/password/pwm/config/stored/StoredConfigurationUtil.java

@@ -35,24 +35,29 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.TreeMap;
 
-public abstract class StoredConfigurationUtil {
+public abstract class StoredConfigurationUtil
+{
     public static List<String> profilesForSetting
-            (final PwmSetting pwmSetting,
-             final StoredConfiguration storedConfiguration
+            ( final PwmSetting pwmSetting,
+              final StoredConfiguration storedConfiguration
             )
     {
-        if (!pwmSetting.getCategory().hasProfiles() && pwmSetting.getSyntax() != PwmSettingSyntax.PROFILE) {
-            throw new IllegalArgumentException("cannot build profile list for non-profile setting " + pwmSetting.toString());
+        if ( !pwmSetting.getCategory().hasProfiles() && pwmSetting.getSyntax() != PwmSettingSyntax.PROFILE )
+        {
+            throw new IllegalArgumentException( "cannot build profile list for non-profile setting " + pwmSetting.toString() );
         }
 
         final PwmSetting profileSetting;
-        if (pwmSetting.getSyntax() == PwmSettingSyntax.PROFILE) {
+        if ( pwmSetting.getSyntax() == PwmSettingSyntax.PROFILE )
+        {
             profileSetting = pwmSetting;
-        } else {
+        }
+        else
+        {
             profileSetting = pwmSetting.getCategory().getProfileSetting();
         }
 
-        return profilesForProfileSetting(profileSetting, storedConfiguration);
+        return profilesForProfileSetting( profileSetting, storedConfiguration );
     }
 
     public static List<String> profilesForCategory(
@@ -62,7 +67,7 @@ public abstract class StoredConfigurationUtil {
     {
         final PwmSetting profileSetting = category.getProfileSetting();
 
-        return profilesForProfileSetting(profileSetting, storedConfiguration);
+        return profilesForProfileSetting( profileSetting, storedConfiguration );
     }
 
     private static List<String> profilesForProfileSetting(
@@ -70,62 +75,74 @@ public abstract class StoredConfigurationUtil {
             final StoredConfiguration storedConfiguration
     )
     {
-        if (!pwmSetting.getCategory().hasProfiles() && pwmSetting.getSyntax() != PwmSettingSyntax.PROFILE) {
-            throw new IllegalArgumentException("cannot build profile list for non-profile setting " + pwmSetting.toString());
+        if ( !pwmSetting.getCategory().hasProfiles() && pwmSetting.getSyntax() != PwmSettingSyntax.PROFILE )
+        {
+            throw new IllegalArgumentException( "cannot build profile list for non-profile setting " + pwmSetting.toString() );
         }
 
         final PwmSetting profileSetting;
-        if (pwmSetting.getSyntax() == PwmSettingSyntax.PROFILE) {
+        if ( pwmSetting.getSyntax() == PwmSettingSyntax.PROFILE )
+        {
             profileSetting = pwmSetting;
-        } else {
+        }
+        else
+        {
             profileSetting = pwmSetting.getCategory().getProfileSetting();
         }
 
-        final Object nativeObject = storedConfiguration.readSetting(profileSetting).toNativeObject();
-        final List<String> settingValues = (List<String>)nativeObject;
+        final Object nativeObject = storedConfiguration.readSetting( profileSetting ).toNativeObject();
+        final List<String> settingValues = ( List<String> ) nativeObject;
         final LinkedList<String> profiles = new LinkedList<>();
-        profiles.addAll(settingValues);
-        for (final Iterator<String> iterator = profiles.iterator(); iterator.hasNext(); ) {
+        profiles.addAll( settingValues );
+        for ( final Iterator<String> iterator = profiles.iterator(); iterator.hasNext(); )
+        {
             final String profile = iterator.next();
-            if (profile == null || profile.length() < 1) {
+            if ( profile == null || profile.length() < 1 )
+            {
                 iterator.remove();
             }
         }
-        return Collections.unmodifiableList(profiles);
+        return Collections.unmodifiableList( profiles );
 
     }
 
 
-
-
-
-    public static List<StoredConfigReference> modifiedSettings(final StoredConfiguration storedConfiguration) {
+    public static List<StoredConfigReference> modifiedSettings( final StoredConfiguration storedConfiguration )
+    {
         final List<StoredConfigReference> returnObj = new ArrayList<>();
 
-        for (final PwmSetting setting : PwmSetting.values()) {
-            if (setting.getSyntax() != PwmSettingSyntax.PROFILE && !setting.getCategory().hasProfiles()) {
-                if (!storedConfiguration.isDefaultValue(setting, null)) {
+        for ( final PwmSetting setting : PwmSetting.values() )
+        {
+            if ( setting.getSyntax() != PwmSettingSyntax.PROFILE && !setting.getCategory().hasProfiles() )
+            {
+                if ( !storedConfiguration.isDefaultValue( setting, null ) )
+                {
                     final StoredConfigReference storedConfigReference = new StoredConfigReferenceBean(
                             StoredConfigReference.RecordType.SETTING,
                             setting.getKey(),
                             null
                     );
-                    returnObj.add(storedConfigReference);
+                    returnObj.add( storedConfigReference );
                 }
             }
         }
 
-        for (final PwmSettingCategory category : PwmSettingCategory.values()) {
-            if (category.hasProfiles()) {
-                for (final String profileID : profilesForSetting(category.getProfileSetting(), storedConfiguration)) {
-                    for (final PwmSetting setting : category.getSettings()) {
-                        if (!storedConfiguration.isDefaultValue(setting, profileID)) {
+        for ( final PwmSettingCategory category : PwmSettingCategory.values() )
+        {
+            if ( category.hasProfiles() )
+            {
+                for ( final String profileID : profilesForSetting( category.getProfileSetting(), storedConfiguration ) )
+                {
+                    for ( final PwmSetting setting : category.getSettings() )
+                    {
+                        if ( !storedConfiguration.isDefaultValue( setting, profileID ) )
+                        {
                             final StoredConfigReference storedConfigReference = new StoredConfigReferenceBean(
                                     StoredConfigReference.RecordType.SETTING,
                                     setting.getKey(),
                                     profileID
                             );
-                            returnObj.add(storedConfigReference);
+                            returnObj.add( storedConfigReference );
                         }
                     }
                 }
@@ -135,15 +152,17 @@ public abstract class StoredConfigurationUtil {
         return returnObj;
     }
 
-    public static Serializable toJsonDebugObject(final StoredConfiguration storedConfiguration)
+    public static Serializable toJsonDebugObject( final StoredConfiguration storedConfiguration )
     {
-        final TreeMap<String,Object> outputObject = new TreeMap<>();
-
-        for (final StoredConfigReference storedConfigReference : modifiedSettings(storedConfiguration)) {
-            final PwmSetting setting = PwmSetting.forKey(storedConfigReference.getRecordID());
-            if (setting != null) {
-                final StoredValue value = storedConfiguration.readSetting(setting, storedConfigReference.getProfileID());
-                outputObject.put(setting.getKey(), value.toDebugJsonObject(null));
+        final TreeMap<String, Object> outputObject = new TreeMap<>();
+
+        for ( final StoredConfigReference storedConfigReference : modifiedSettings( storedConfiguration ) )
+        {
+            final PwmSetting setting = PwmSetting.forKey( storedConfigReference.getRecordID() );
+            if ( setting != null )
+            {
+                final StoredValue value = storedConfiguration.readSetting( setting, storedConfigReference.getProfileID() );
+                outputObject.put( setting.getKey(), value.toDebugJsonObject( null ) );
             }
         }
         return outputObject;

+ 6 - 4
server/src/main/java/password/pwm/config/stored/ValueMetaData.java

@@ -27,21 +27,23 @@ import password.pwm.bean.UserIdentity;
 import java.io.Serializable;
 import java.time.Instant;
 
-public class ValueMetaData implements Serializable {
+public class ValueMetaData implements Serializable
+{
     private Instant modifyDate;
     private UserIdentity userIdentity;
 
-    public ValueMetaData(final Instant modifyDate, final UserIdentity userIdentity) {
+    public ValueMetaData( final Instant modifyDate, final UserIdentity userIdentity )
+    {
         this.modifyDate = modifyDate;
         this.userIdentity = userIdentity;
     }
 
-    public Instant getModifyDate()
+    public Instant getModifyDate( )
     {
         return modifyDate;
     }
 
-    public UserIdentity getUserIdentity()
+    public UserIdentity getUserIdentity( )
     {
         return userIdentity;
     }

+ 16 - 11
server/src/main/java/password/pwm/config/value/AbstractValue.java

@@ -31,34 +31,39 @@ import password.pwm.util.secure.SecureEngine;
 import java.io.Serializable;
 import java.util.Locale;
 
-public abstract class AbstractValue implements StoredValue {
-    public String toString() {
-        return toDebugString(null);
+public abstract class AbstractValue implements StoredValue
+{
+    public String toString( )
+    {
+        return toDebugString( null );
     }
 
     @Override
-    public String toDebugString(final Locale locale) {
-        return JsonUtil.serialize((Serializable) this.toNativeObject(), JsonUtil.Flag.PrettyPrint);
+    public String toDebugString( final Locale locale )
+    {
+        return JsonUtil.serialize( ( Serializable ) this.toNativeObject(), JsonUtil.Flag.PrettyPrint );
     }
 
     @Override
-    public Serializable toDebugJsonObject(final Locale locale) {
-        return (Serializable)this.toNativeObject();
+    public Serializable toDebugJsonObject( final Locale locale )
+    {
+        return ( Serializable ) this.toNativeObject();
     }
 
-    public boolean requiresStoredUpdate()
+    public boolean requiresStoredUpdate( )
     {
         return false;
     }
 
     @Override
-    public int currentSyntaxVersion()
+    public int currentSyntaxVersion( )
     {
         return 0;
     }
 
     @Override
-    public String valueHash() throws PwmUnrecoverableException {
-        return SecureEngine.hash(JsonUtil.serialize((Serializable) this.toNativeObject()), PwmConstants.SETTING_CHECKSUM_HASH_METHOD);
+    public String valueHash( ) throws PwmUnrecoverableException
+    {
+        return SecureEngine.hash( JsonUtil.serialize( ( Serializable ) this.toNativeObject() ), PwmConstants.SETTING_CHECKSUM_HASH_METHOD );
     }
 }

Some files were not shown because too many files changed in this diff