At least one redirect_uri must be available for oauthClients and applications, which are not bearer-only
This commit is contained in:
parent
37327be521
commit
e600d7c449
2 changed files with 35 additions and 31 deletions
|
@ -263,10 +263,10 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.save = function() {
|
$scope.save = function() {
|
||||||
if ($scope.create) {
|
if (!$scope.application.bearerOnly && (!$scope.application.redirectUris || $scope.application.redirectUris.length == 0)) {
|
||||||
if (!$scope.application.bearerOnly && (!$scope.application.redirectUris || $scope.application.redirectUris.length == 0)) {
|
Notifications.error("You must specify at least one redirect uri");
|
||||||
Notifications.error("You must specify at least one redirect uri");
|
} else {
|
||||||
} else {
|
if ($scope.create) {
|
||||||
Application.save({
|
Application.save({
|
||||||
realm: realm.realm,
|
realm: realm.realm,
|
||||||
application: ''
|
application: ''
|
||||||
|
@ -277,16 +277,16 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
|
||||||
$location.url("/realms/" + realm.realm + "/applications/" + id);
|
$location.url("/realms/" + realm.realm + "/applications/" + id);
|
||||||
Notifications.success("The application has been created.");
|
Notifications.success("The application has been created.");
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
Application.update({
|
||||||
|
realm : realm.realm,
|
||||||
|
application : application.name
|
||||||
|
}, $scope.application, function() {
|
||||||
|
$scope.changed = false;
|
||||||
|
application = angular.copy($scope.application);
|
||||||
|
Notifications.success("Your changes have been saved to the application.");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Application.update({
|
|
||||||
realm : realm.realm,
|
|
||||||
application : application.name
|
|
||||||
}, $scope.application, function() {
|
|
||||||
$scope.changed = false;
|
|
||||||
application = angular.copy($scope.application);
|
|
||||||
Notifications.success("Your changes have been saved to the application.");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -133,25 +133,29 @@ module.controller('OAuthClientDetailCtrl', function($scope, realm, oauth, OAuthC
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.save = function() {
|
$scope.save = function() {
|
||||||
if ($scope.create) {
|
if (!$scope.oauth.bearerOnly && (!$scope.oauth.redirectUris || $scope.oauth.redirectUris.length == 0)) {
|
||||||
OAuthClient.save({
|
Notifications.error("You must specify at least one redirect uri");
|
||||||
realm: realm.realm
|
|
||||||
}, $scope.oauth, function (data, headers) {
|
|
||||||
$scope.changed = false;
|
|
||||||
var l = headers().location;
|
|
||||||
var id = l.substring(l.lastIndexOf("/") + 1);
|
|
||||||
$location.url("/realms/" + realm.realm + "/oauth-clients/" + id);
|
|
||||||
Notifications.success("The oauth client has been created.");
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
OAuthClient.update({
|
if ($scope.create) {
|
||||||
realm : realm.realm,
|
OAuthClient.save({
|
||||||
id : oauth.id
|
realm: realm.realm
|
||||||
}, $scope.oauth, function() {
|
}, $scope.oauth, function (data, headers) {
|
||||||
$scope.changed = false;
|
$scope.changed = false;
|
||||||
oauth = angular.copy($scope.oauth);
|
var l = headers().location;
|
||||||
Notifications.success("Your changes have been saved to the oauth client.");
|
var id = l.substring(l.lastIndexOf("/") + 1);
|
||||||
});
|
$location.url("/realms/" + realm.realm + "/oauth-clients/" + id);
|
||||||
|
Notifications.success("The oauth client has been created.");
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
OAuthClient.update({
|
||||||
|
realm : realm.realm,
|
||||||
|
id : oauth.id
|
||||||
|
}, $scope.oauth, function() {
|
||||||
|
$scope.changed = false;
|
||||||
|
oauth = angular.copy($scope.oauth);
|
||||||
|
Notifications.success("Your changes have been saved to the oauth client.");
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue