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) {
|
||||
console.log('ApplicationDetailCtrl');
|
||||
|
||||
$scope.clientTypes = [
|
||||
"confidential",
|
||||
"public",
|
||||
"bearer-only"
|
||||
];
|
||||
|
||||
$scope.realm = realm;
|
||||
$scope.create = !application.name;
|
||||
if (!$scope.create) {
|
||||
$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 {
|
||||
$scope.application = {};
|
||||
$scope.application.webOrigins = [];
|
||||
$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() {
|
||||
return $location.path();
|
||||
}, function() {
|
||||
|
|
|
@ -76,12 +76,33 @@ module.controller('OAuthClientListCtrl', function($scope, realm, oauthClients, O
|
|||
module.controller('OAuthClientDetailCtrl', function($scope, realm, oauth, OAuthClient, $location, Dialog, Notifications) {
|
||||
$scope.realm = realm;
|
||||
$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) {
|
||||
$scope.oauth= angular.copy(oauth);
|
||||
$scope.clientType = $scope.clientTypes[0];
|
||||
if (oauth.publicClient) {
|
||||
$scope.clientType = $scope.clientTypes[1];
|
||||
}
|
||||
} else {
|
||||
$scope.oauth = {};
|
||||
$scope.oauth.webOrigins = [];
|
||||
$scope.oauth.redirectUris = [];
|
||||
$scope.clientType = $scope.clientTypes[0];
|
||||
}
|
||||
|
||||
$scope.$watch(function() {
|
||||
|
|
|
@ -39,17 +39,17 @@
|
|||
<input ng-model="application.enabled" name="enabled" id="enabled" onoffswitch />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group clearfix block" data-ng-show="!application.publicClient">
|
||||
<label class="col-sm-2 control-label" for="bearerOnly">Bearer Only</label>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="clientType">Client Type</label>
|
||||
<div class="col-sm-4">
|
||||
<input ng-model="application.bearerOnly" name="bearerOnly" id="bearerOnly" 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 class="form-group clearfix block">
|
||||
<label class="col-sm-2 control-label" for="publicClient">Public Client</label>
|
||||
<div class="col-sm-4">
|
||||
<input ng-model="application.publicClient" name="publicClient" id="publicClient" onoffswitch />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" data-ng-show="!application.bearerOnly">
|
||||
<label class="col-sm-2 control-label" for="newRedirectUri">Redirect URI <span class="required" data-ng-show="create">*</span></label>
|
||||
|
|
|
@ -40,10 +40,16 @@
|
|||
<input ng-model="oauth.enabled" name="enabled" id="enabled" onoffswitch />
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group clearfix block">
|
||||
<label class="col-sm-2 control-label" for="publicClient">Public Client</label>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" for="clientType">Client Type</label>
|
||||
<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 class="form-group">
|
||||
|
|
|
@ -44,13 +44,6 @@ public class OAuthClientManager {
|
|||
public OAuthClientModel create(OAuthClientRepresentation rep) {
|
||||
OAuthClientModel model = create(rep.getName());
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -58,6 +51,13 @@ public class OAuthClientManager {
|
|||
if (rep.getName() != null) model.setClientId(rep.getName());
|
||||
if (rep.isEnabled() != null) model.setEnabled(rep.isEnabled());
|
||||
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();
|
||||
if (redirectUris != null) {
|
||||
model.setRedirectUris(new HashSet<String>(redirectUris));
|
||||
|
|
Loading…
Reference in a new issue