diff --git a/docbook/reference/en/en-US/modules/security-vulnerabilities.xml b/docbook/reference/en/en-US/modules/security-vulnerabilities.xml index d7fadb008d..b2a3882144 100755 --- a/docbook/reference/en/en-US/modules/security-vulnerabilities.xml +++ b/docbook/reference/en/en-US/modules/security-vulnerabilities.xml @@ -130,8 +130,8 @@ A password has to match all policies. The password policies that can be configured are hash iterations, length, digits, lowercase, uppercase, special characters, not username, regex patterns, password history and force expired password update. Force expired password update policy forces or requires password updates after specified span of time. Password history policy - restricts a user from resetting his password to N old expired passwords. Multiple regex patterns, separated by comma, - can be specified in regex pattern policy. If there's more than one regex added, password has to match all fully. + restricts a user from resetting his password to N old expired passwords. Multiple regex patterns can be specified. + If there's more than one regex added, password has to match all fully. Increasing number of Hash Iterations (n) does not worsen anything (and certainly not the cipher) and it greatly increases the resistance to dictionary attacks. However the drawback to increasing n is that it has some cost (CPU usage, energy, delay) for the legitimate parties. Increasing n also slightly increases the odds that a random password gives the same result as the right diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js index 95d80a344f..4027a85b73 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js @@ -414,6 +414,14 @@ module.controller('RealmPasswordPolicyCtrl', function($scope, Realm, realm, $htt if (!$scope.policy) { $scope.policy = []; } + if (policy.name === 'regexPattern') { + for (var i in $scope.allPolicies) { + var p = $scope.allPolicies[i]; + if (p.name === 'regexPattern') { + $scope.allPolicies[i] = { name: 'regexPattern', value: '' }; + } + } + } $scope.policy.push(policy); } diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js index e8c93d6240..d1abe26cd6 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/services.js @@ -1063,7 +1063,7 @@ module.factory('PasswordPolicy', function() { upperCase: "Minimal number (integer type) of uppercase characters in password. Default value is 1.", specialChars: "Minimal number (integer type) of special characters in password. Default value is 1.", notUsername: "Block passwords that are equal to the username", - regexPatterns: "Block passwords that do not match all of the regex patterns (string type).", + regexPattern: "Block passwords that do not match the regex pattern (string type).", passwordHistory: "Block passwords that are equal to previous passwords. Default value is 3.", forceExpiredPasswordChange: "Force password change when password credential is expired. Default value is 365 days." } @@ -1076,7 +1076,7 @@ module.factory('PasswordPolicy', function() { { name: 'upperCase', value: 1 }, { name: 'specialChars', value: 1 }, { name: 'notUsername', value: 1 }, - { name: 'regexPatterns', value: ''}, + { name: 'regexPattern', value: ''}, { name: 'passwordHistory', value: 3 }, { name: 'forceExpiredPasswordChange', value: 365 } ]; @@ -1094,7 +1094,7 @@ module.factory('PasswordPolicy', function() { for (var i = 0; i < policyArray.length; i ++){ var policyToken = policyArray[i]; - if(policyToken.indexOf('regexPatterns') === 0) { + if(policyToken.indexOf('regexPattern') === 0) { re = /(\w+)\((.*)\)/; policyEntry = re.exec(policyToken); if (null !== policyEntry) { @@ -1134,6 +1134,25 @@ module.factory('PasswordPolicy', function() { return p; }); +module.filter('removeSelectedPolicies', function() { + return function(policies, selectedPolicies) { + var result = []; + for(var i in policies) { + var policy = policies[i]; + var policyAvailable = true; + for(var j in selectedPolicies) { + if(policy.name === selectedPolicies[j].name && policy.name !== 'regexPattern') { + policyAvailable = false; + } + } + if(policyAvailable) { + result.push(policy); + } + } + return result; + } +}); + module.factory('IdentityProvider', function($resource) { return $resource(authUrl + '/admin/realms/:realm/identity-provider/instances/:alias', { realm : '@realm', diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/password-policy.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/password-policy.html index ff4e0f7f15..2da9b0d0c4 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/password-policy.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/password-policy.html @@ -7,12 +7,12 @@
@@ -51,4 +51,4 @@
- |
---|