diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/TimePolicyManagementTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/TimePolicyManagementTest.java index 9abc570546..9f810c3bb2 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/TimePolicyManagementTest.java +++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authorization/TimePolicyManagementTest.java @@ -77,6 +77,13 @@ public class TimePolicyManagementTest extends AbstractAuthorizationSettingsTest TimePolicy actual = authorizationPage.authorizationTabs().policies().name(expected.getName()); assertPolicy(expected, actual); + + expected.setNotBefore(""); + expected.setNotOnOrAfter(""); + + authorizationPage.navigateTo(); + authorizationPage.authorizationTabs().policies().update(expected.getName(), expected); + assertAlertSuccess(); } @Test diff --git a/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-controller.js b/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-controller.js index 1120131713..e61b014a80 100644 --- a/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-controller.js +++ b/themes/src/main/resources/theme/base/admin/resources/js/authz/authz-controller.js @@ -1985,6 +1985,16 @@ module.controller('ResourceServerPolicyJSDetailCtrl', function($scope, $route, $ }); module.controller('ResourceServerPolicyTimeDetailCtrl', function($scope, $route, $location, realm, PolicyController, client) { + + function clearEmptyStrings() { + if ($scope.policy.notBefore != undefined && $scope.policy.notBefore.trim() == '') { + $scope.policy.notBefore = null; + } + if ($scope.policy.notOnOrAfter != undefined && $scope.policy.notOnOrAfter.trim() == '') { + $scope.policy.notOnOrAfter = null; + } + } + PolicyController.onInit({ getPolicyType : function() { return "time"; @@ -2028,6 +2038,7 @@ module.controller('ResourceServerPolicyTimeDetailCtrl', function($scope, $route, }, onUpdate : function() { + clearEmptyStrings(); delete $scope.policy.config; }, @@ -2035,6 +2046,7 @@ module.controller('ResourceServerPolicyTimeDetailCtrl', function($scope, $route, }, onCreate : function() { + clearEmptyStrings(); delete $scope.policy.config; } }, realm, client, $scope);