diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/applications.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/applications.js index ff4a8eb45f..bff3774d05 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/applications.js +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/applications.js @@ -195,7 +195,7 @@ module.controller('ApplicationInstallationCtrl', function($scope, realm, applica }); -module.controller('ApplicationDetailCtrl', function($scope, realm, application, Application, $location, Dialog, Notifications) { +module.controller('ApplicationDetailCtrl', function($scope, $document, realm, application, Application, $location, Dialog, Notifications) { console.log('ApplicationDetailCtrl'); $scope.clientTypes = [ @@ -267,6 +267,17 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application, if (!$scope.application.bearerOnly && (!$scope.application.redirectUris || $scope.application.redirectUris.length == 0)) { Notifications.error("You must specify at least one redirect uri"); } else { + // automatically add redirects to web origins + var parser = $document.createElement('a'); + var originSet = {}; + for (var i = 0; i < $scope.application.redirectUris.length; i++) { + parser.href = $scope.application.redirectUris[i]; + var origin = href.protocol + "//" + href.host; + originSet[origin] = true; + } + for (var key in originSet) { + $scope.application.webOrigins.push(key); + } Application.save({ realm: realm.realm, application: '' diff --git a/services/src/main/java/org/keycloak/services/resources/TokenService.java b/services/src/main/java/org/keycloak/services/resources/TokenService.java index 37b665da9e..b9d1291dc1 100755 --- a/services/src/main/java/org/keycloak/services/resources/TokenService.java +++ b/services/src/main/java/org/keycloak/services/resources/TokenService.java @@ -531,7 +531,7 @@ public class TokenService { @OPTIONS @Produces("application/json") public Response accessCodeToTokenPreflight() { - logger.info("cors request from: " + request.getHttpHeaders().getRequestHeaders().getFirst("Origin")); + logger.debugv("cors request from: {0}" , request.getHttpHeaders().getRequestHeaders().getFirst("Origin")); return Cors.add(request, Response.ok()).auth().preflight().build(); }