admin rest api example

This commit is contained in:
Bill Burke committed 2014-05-23 18:20:55 -04:00
1 parent 29070cec77
commit e4232c73c6
31 files changed
+556 -36

No files matched your search

@@ -198,7 +198,7 @@ module.controller('ApplicationInstallationCtrl', function($scope, realm, applica
module.controller('ApplicationDetailCtrl', function($scope, realm, application, Application, $location, Dialog, Notifications) {
console.log('ApplicationDetailCtrl');
$scope.clientTypes = [
$scope.accessTypes = [
"confidential",
"public",
"bearer-only"
@@ -208,28 +208,27 @@ module.controller('ApplicationDetailCtrl', function($scope, realm, application,
$scope.create = !application.name;
if (!$scope.create) {
$scope.application= angular.copy(application);
$scope.clientType = $scope.clientTypes[0];
$scope.accessType = $scope.accessTypes[0];
if (application.bearerOnly) {
$scope.clientType = $scope.clientTypes[2];
$scope.accessType = $scope.accessTypes[2];
} else if (application.publicClient) {
$scope.clientType = $scope.clientTypes[1];
$scope.accessType = $scope.accessTypes[1];
}
} else {
$scope.application = { enabled: true };
$scope.application.webOrigins = [];
$scope.application.redirectUris = [];
$scope.clientType = $scope.clientTypes[0];
$scope.accessType = $scope.accessTypes[0];
}
$scope.changeClientType = function() {
console.log('Client Type: ' + $scope.clientType);
if ($scope.clientType == "confidential") {
$scope.changeAccessType = function() {
if ($scope.accessType == "confidential") {
$scope.application.bearerOnly = false;
$scope.application.publicClient = false;
} else if ($scope.clientType == "public") {
} else if ($scope.accessType == "public") {
$scope.application.bearerOnly = false;
$scope.application.publicClient = true;
} else if ($scope.clientType == "bearer-only") {
} else if ($scope.accessType == "bearer-only") {
$scope.application.bearerOnly = true;
$scope.application.publicClient = false;
}
@@ -77,16 +77,15 @@ module.controller('OAuthClientDetailCtrl', function($scope, realm, oauth, OAuthC
$scope.realm = realm;
$scope.create = !oauth.id;
$scope.clientTypes = [
$scope.accessTypes = [
"confidential",
"public"
];
$scope.changeClientType = function() {
console.log('Client Type: ' + $scope.clientType);
if ($scope.clientType == "confidential") {
$scope.changeAccessType = function() {
if ($scope.accessType == "confidential") {
$scope.oauth.publicClient = false;
} else if ($scope.clientType == "public") {
} else if ($scope.accessType == "public") {
$scope.oauth.publicClient = true;
}
};
@@ -94,15 +93,15 @@ module.controller('OAuthClientDetailCtrl', function($scope, realm, oauth, OAuthC
if (!$scope.create) {
$scope.oauth= angular.copy(oauth);
$scope.clientType = $scope.clientTypes[0];
$scope.accessType = $scope.accessTypes[0];
if (oauth.publicClient) {
$scope.clientType = $scope.clientTypes[1];
$scope.accessType = $scope.accessTypes[1];
}
} else {
$scope.oauth = { enabled: true };
$scope.oauth.webOrigins = [];
$scope.oauth.redirectUris = [];
$scope.clientType = $scope.clientTypes[0];
$scope.accessType = $scope.accessTypes[0];
}
$scope.$watch(function() {
@@ -133,7 +132,7 @@ module.controller('OAuthClientDetailCtrl', function($scope, realm, oauth, OAuthC
}
$scope.save = function() {
if (!$scope.oauth.redirectUris || $scope.oauth.redirectUris.length == 0) {
if (!$scope.oauth.directGrantsOnly && (!$scope.oauth.redirectUris || $scope.oauth.redirectUris.length == 0)) {
Notifications.error("You must specify at least one redirect uri");
} else {
if ($scope.create) {
@@ -42,13 +42,13 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="clientType">Client Type</label>
<label class="col-sm-2 control-label" for="accessType">Access Type</label>
<div class="col-sm-4">
<div class="select-kc">
<select id="clientType"
ng-change="changeClientType()"
ng-model="clientType"
ng-options="cType for cType in clientTypes">
<select id="accessType"
ng-change="changeAccessType()"
ng-model="accessType"
ng-options="aType for aType in accessTypes">
</select>
</div>
</div>
@@ -41,18 +41,24 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="clientType">Client Type</label>
<label class="col-sm-2 control-label" for="accessType">Access Type</label>
<div class="col-sm-4">
<div class="select-kc">
<select id="clientType"
ng-change="changeClientType()"
ng-model="clientType"
ng-options="cType for cType in clientTypes">
<select id="accessType"
ng-change="changeAccessType()"
ng-model="accessType"
ng-options="aType for aType in accessTypes">
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="form-group clearfix block">
<label class="col-sm-2 control-label" for="directGrantsOnly">Direct Grants Only</label>
<div class="col-sm-4">
<input ng-model="oauth.directGrantsOnly" name="directGrantsOnly" id="directGrantsOnly" onoffswitch />
</div>
</div>
<div class="form-group" data-ng-hide="oauth.directGrantsOnly">
<label class="col-sm-2 control-label" for="newRedirectUri">Redirect URI <span class="required" data-ng-show="create">*</span></label>
<div class="col-sm-4 multiple" ng-repeat="redirectUri in oauth.redirectUris">
<div class="input-group kc-item-deletable">
@@ -75,7 +81,7 @@
</div>
</div>
</div>
<div class="form-group">
<div class="form-group" data-ng-hide="create">
<label class="col-sm-2 control-label" for="newWebOrigin">Web Origin</label>
<div class="col-sm-4 multiple" ng-repeat="webOrigin in oauth.webOrigins">
<div class="input-group kc-item-deletable">
@@ -67,7 +67,7 @@
</div>
</div>
<div class="form-group">
<label for="passwordCredentialGrantAllowed" class="col-sm-2 control-label">Password Credential Grant</label>
<label for="passwordCredentialGrantAllowed" class="col-sm-2 control-label">Direct Grant API</label>
<div class="col-sm-4">
<input ng-model="realm.passwordCredentialGrantAllowedpasswordCredentialGrantAllowed" name="passwordCredentialGrantAllowed" id="passwordCredentialGrantAllowed" onoffswitch />
</div>