This commit is contained in:
Bill Burke 2014-05-20 16:49:25 -04:00
parent fcca9dd90a
commit 0137918701
2 changed files with 13 additions and 2 deletions

View file

@ -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: ''

View file

@ -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();
}