client type selection
This commit is contained in:
parent
599faa3cb5
commit
8f29bf0a5a
5 changed files with 73 additions and 19 deletions
|
@ -217,16 +217,43 @@ module.controller('ApplicationInstallationCtrl', function($scope, realm, applica
|
||||||
module.controller('ApplicationDetailCtrl', function($scope, realm, application, Application, $location, Dialog, Notifications) {
|
module.controller('ApplicationDetailCtrl', function($scope, realm, application, Application, $location, Dialog, Notifications) {
|
||||||
console.log('ApplicationDetailCtrl');
|
console.log('ApplicationDetailCtrl');
|
||||||
|
|
||||||
|
$scope.clientTypes = [
|
||||||
|
"confidential",
|
||||||
|
"public",
|
||||||
|
"bearer-only"
|
||||||
|
];
|
||||||
|
|
||||||
$scope.realm = realm;
|
$scope.realm = realm;
|
||||||
$scope.create = !application.name;
|
$scope.create = !application.name;
|
||||||
if (!$scope.create) {
|
if (!$scope.create) {
|
||||||
$scope.application= angular.copy(application);
|
$scope.application= angular.copy(application);
|
||||||
|
$scope.clientType = $scope.clientTypes[0];
|
||||||
|
if (application.bearerOnly) {
|
||||||
|
$scope.clientType = $scope.clientTypes[2];
|
||||||
|
} else if (application.publicClient) {
|
||||||
|
$scope.clientType = $scope.clientTypes[1];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$scope.application = {};
|
$scope.application = {};
|
||||||
$scope.application.webOrigins = [];
|
$scope.application.webOrigins = [];
|
||||||
$scope.application.redirectUris = [];
|
$scope.application.redirectUris = [];
|
||||||
|
$scope.clientType = $scope.clientTypes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.changeClientType = function() {
|
||||||
|
console.log('Client Type: ' + $scope.clientType);
|
||||||
|
if ($scope.clientType == "confidential") {
|
||||||
|
$scope.application.bearerOnly = false;
|
||||||
|
$scope.application.publicClient = false;
|
||||||
|
} else if ($scope.clientType == "public") {
|
||||||
|
$scope.application.bearerOnly = false;
|
||||||
|
$scope.application.publicClient = true;
|
||||||
|
} else if ($scope.clientType == "bearer-only") {
|
||||||
|
$scope.application.bearerOnly = true;
|
||||||
|
$scope.application.publicClient = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$scope.$watch(function() {
|
$scope.$watch(function() {
|
||||||
return $location.path();
|
return $location.path();
|
||||||
}, function() {
|
}, function() {
|
||||||
|
|
|
@ -76,12 +76,33 @@ module.controller('OAuthClientListCtrl', function($scope, realm, oauthClients, O
|
||||||
module.controller('OAuthClientDetailCtrl', function($scope, realm, oauth, OAuthClient, $location, Dialog, Notifications) {
|
module.controller('OAuthClientDetailCtrl', function($scope, realm, oauth, OAuthClient, $location, Dialog, Notifications) {
|
||||||
$scope.realm = realm;
|
$scope.realm = realm;
|
||||||
$scope.create = !oauth.id;
|
$scope.create = !oauth.id;
|
||||||
|
|
||||||
|
$scope.clientTypes = [
|
||||||
|
"confidential",
|
||||||
|
"public"
|
||||||
|
];
|
||||||
|
|
||||||
|
$scope.changeClientType = function() {
|
||||||
|
console.log('Client Type: ' + $scope.clientType);
|
||||||
|
if ($scope.clientType == "confidential") {
|
||||||
|
$scope.oauth.publicClient = false;
|
||||||
|
} else if ($scope.clientType == "public") {
|
||||||
|
$scope.oauth.publicClient = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
if (!$scope.create) {
|
if (!$scope.create) {
|
||||||
$scope.oauth= angular.copy(oauth);
|
$scope.oauth= angular.copy(oauth);
|
||||||
|
$scope.clientType = $scope.clientTypes[0];
|
||||||
|
if (oauth.publicClient) {
|
||||||
|
$scope.clientType = $scope.clientTypes[1];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$scope.oauth = {};
|
$scope.oauth = {};
|
||||||
$scope.oauth.webOrigins = [];
|
$scope.oauth.webOrigins = [];
|
||||||
$scope.oauth.redirectUris = [];
|
$scope.oauth.redirectUris = [];
|
||||||
|
$scope.clientType = $scope.clientTypes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.$watch(function() {
|
$scope.$watch(function() {
|
||||||
|
|
|
@ -39,16 +39,16 @@
|
||||||
<input ng-model="application.enabled" name="enabled" id="enabled" onoffswitch />
|
<input ng-model="application.enabled" name="enabled" id="enabled" onoffswitch />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group clearfix block" data-ng-show="!application.publicClient">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="bearerOnly">Bearer Only</label>
|
<label class="col-sm-2 control-label" for="clientType">Client Type</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input ng-model="application.bearerOnly" name="bearerOnly" id="bearerOnly" onoffswitch />
|
<div class="select-kc">
|
||||||
</div>
|
<select id="clientType"
|
||||||
</div>
|
ng-change="changeClientType()"
|
||||||
<div class="form-group clearfix block">
|
ng-model="clientType"
|
||||||
<label class="col-sm-2 control-label" for="publicClient">Public Client</label>
|
ng-options="cType for cType in clientTypes">
|
||||||
<div class="col-sm-4">
|
</select>
|
||||||
<input ng-model="application.publicClient" name="publicClient" id="publicClient" onoffswitch />
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" data-ng-show="!application.bearerOnly">
|
<div class="form-group" data-ng-show="!application.bearerOnly">
|
||||||
|
|
|
@ -40,10 +40,16 @@
|
||||||
<input ng-model="oauth.enabled" name="enabled" id="enabled" onoffswitch />
|
<input ng-model="oauth.enabled" name="enabled" id="enabled" onoffswitch />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group clearfix block">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="publicClient">Public Client</label>
|
<label class="col-sm-2 control-label" for="clientType">Client Type</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input ng-model="oauth.publicClient" name="publicClient" id="publicClient" onoffswitch />
|
<div class="select-kc">
|
||||||
|
<select id="clientType"
|
||||||
|
ng-change="changeClientType()"
|
||||||
|
ng-model="clientType"
|
||||||
|
ng-options="cType for cType in clientTypes">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
@ -44,13 +44,6 @@ public class OAuthClientManager {
|
||||||
public OAuthClientModel create(OAuthClientRepresentation rep) {
|
public OAuthClientModel create(OAuthClientRepresentation rep) {
|
||||||
OAuthClientModel model = create(rep.getName());
|
OAuthClientModel model = create(rep.getName());
|
||||||
update(rep, model);
|
update(rep, model);
|
||||||
model.setSecret(rep.getSecret());
|
|
||||||
if (rep.getClaims() != null) {
|
|
||||||
ClaimManager.setClaims(model, rep.getClaims());
|
|
||||||
}
|
|
||||||
if (rep.getNotBefore() != null) {
|
|
||||||
model.setNotBefore(rep.getNotBefore());
|
|
||||||
}
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +51,13 @@ public class OAuthClientManager {
|
||||||
if (rep.getName() != null) model.setClientId(rep.getName());
|
if (rep.getName() != null) model.setClientId(rep.getName());
|
||||||
if (rep.isEnabled() != null) model.setEnabled(rep.isEnabled());
|
if (rep.isEnabled() != null) model.setEnabled(rep.isEnabled());
|
||||||
if (rep.isPublicClient() != null) model.setPublicClient(rep.isPublicClient());
|
if (rep.isPublicClient() != null) model.setPublicClient(rep.isPublicClient());
|
||||||
|
if (rep.getClaims() != null) {
|
||||||
|
ClaimManager.setClaims(model, rep.getClaims());
|
||||||
|
}
|
||||||
|
if (rep.getNotBefore() != null) {
|
||||||
|
model.setNotBefore(rep.getNotBefore());
|
||||||
|
}
|
||||||
|
if (rep.getSecret() != null) model.setSecret(rep.getSecret());
|
||||||
List<String> redirectUris = rep.getRedirectUris();
|
List<String> redirectUris = rep.getRedirectUris();
|
||||||
if (redirectUris != null) {
|
if (redirectUris != null) {
|
||||||
model.setRedirectUris(new HashSet<String>(redirectUris));
|
model.setRedirectUris(new HashSet<String>(redirectUris));
|
||||||
|
|
Loading…
Reference in a new issue