KEYCLOAK-1801

Suggestions to improving client credentials tab
This commit is contained in:
Stian Thorgersen 2015-09-04 12:55:25 +02:00
parent d429b2151a
commit 73c230f1ca
8 changed files with 74 additions and 141 deletions

View file

@ -642,45 +642,6 @@ module.config([ '$routeProvider', function($routeProvider) {
},
controller : 'ClientCredentialsCtrl'
})
.when('/realms/:realm/clients/:client/credentials/client-secret', {
templateUrl : resourceUrl + '/partials/client-credentials-secret.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
}
},
controller : 'ClientSecretCtrl'
})
.when('/realms/:realm/clients/:client/credentials/client-jwt', {
templateUrl : resourceUrl + '/partials/client-credentials-jwt.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
}
},
controller : 'ClientSignedJWTCtrl'
})
.when('/realms/:realm/clients/:client/credentials/:provider', {
templateUrl : resourceUrl + '/partials/client-credentials-generic.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
clientConfigProperties: function(PerClientAuthenticationConfigDescriptionLoader) {
return PerClientAuthenticationConfigDescriptionLoader();
}
},
controller : 'ClientGenericCredentialsCtrl'
})
.when('/realms/:realm/clients/:client/credentials/client-jwt/:keyType/import/:attribute', {
templateUrl : resourceUrl + '/partials/client-credentials-jwt-key-import.html',
resolve : {

View file

@ -62,23 +62,36 @@ module.controller('ClientCredentialsCtrl', function($scope, $location, realm, cl
}
}, true);
$scope.$watch('client.clientAuthenticatorType', function(val) {
$scope.clientAuthenticatorConfigPartial;
switch(val) {
case 'client-secret':
$scope.clientAuthenticatorConfigPartial = 'client-credentials-secret.html';
break;
case 'client-jwt':
$scope.clientAuthenticatorConfigPartial = 'client-credentials-jwt.html';
break;
default:
$scope.clientAuthenticatorConfigPartial = 'client-credentials-generic.html';
break;
}
});
$scope.configureAuthenticator = function() {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials/" + client.clientAuthenticatorType);
}
});
module.controller('ClientSecretCtrl', function($scope, $location, realm, client, ClientSecret, Notifications) {
$scope.realm = realm;
$scope.client = client;
var secret = ClientSecret.get({ realm : realm.realm, client : client.id },
module.controller('ClientSecretCtrl', function($scope, $location, ClientSecret, Notifications) {
var secret = ClientSecret.get({ realm : $scope.realm.realm, client : $scope.client.id },
function() {
$scope.secret = secret.value;
}
);
$scope.changePassword = function() {
var secret = ClientSecret.update({ realm : realm.realm, client : client.id },
var secret = ClientSecret.update({ realm : $scope.realm.realm, client : $scope.client.id },
function() {
Notifications.success('The secret has been changed.');
$scope.secret = secret.value;
@ -97,31 +110,27 @@ module.controller('ClientSecretCtrl', function($scope, $location, realm, client,
});
$scope.cancel = function() {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials");
$location.url("/realms/" + $scope.realm.realm + "/clients/" + $scope.client.id + "/credentials");
};
});
module.controller('ClientSignedJWTCtrl', function($scope, $location, realm, client, ClientCertificate, Notifications) {
$scope.realm = realm;
$scope.client = client;
var signingKeyInfo = ClientCertificate.get({ realm : realm.realm, client : client.id, attribute: 'jwt.credential' },
module.controller('ClientSignedJWTCtrl', function($scope, $location, ClientCertificate) {
var signingKeyInfo = ClientCertificate.get({ realm : $scope.realm.realm, client : $scope.client.id, attribute: 'jwt.credential' },
function() {
$scope.signingKeyInfo = signingKeyInfo;
}
);
$scope.importCertificate = function() {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials/client-jwt/Signing/import/jwt.credential");
$location.url("/realms/" + $scope.realm.realm + "/clients/" + $scope.client.id + "/credentials/client-jwt/Signing/import/jwt.credential");
};
$scope.generateSigningKey = function() {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials/client-jwt/Signing/export/jwt.credential");
$location.url("/realms/" + $scope.realm.realm + "/clients/" + $scope.client.id + "/credentials/client-jwt/Signing/export/jwt.credential");
};
$scope.cancel = function() {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials");
$location.url("/realms/" + $scope.realm.realm + "/clients/" + $scope.client.id + "/credentials");
};
});
@ -328,7 +337,7 @@ module.controller('ClientCertificateImportCtrl', function($scope, $location, $ht
var redirectLocation = "/realms/" + realm.realm + "/clients/" + client.id + "/saml/keys";
} else if (callingContext == 'jwt-credentials') {
var uploadUrl = authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/certificates/' + attribute + '/upload-certificate';
var redirectLocation = "/realms/" + realm.realm + "/clients/" + client.id + "/credentials/client-jwt";
var redirectLocation = "/realms/" + realm.realm + "/clients/" + client.id + "/credentials";
}
$scope.files = [];
@ -337,8 +346,8 @@ module.controller('ClientCertificateImportCtrl', function($scope, $location, $ht
$scope.files = $files;
};
$scope.clearFileSelect = function() {
$scope.files = null;
$scope.cancel = function() {
$location.url(redirectLocation);
}
$scope.keyFormats = [
@ -438,7 +447,7 @@ module.controller('ClientCertificateExportCtrl', function($scope, $location, $ht
if ($scope.jks.format == 'PKCS12') ext = ".p12";
if (callingContext == 'jwt-credentials') {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials/client-jwt");
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials");
Notifications.success("New keypair and certificate generated successfully. Download keystore file")
}
@ -461,7 +470,7 @@ module.controller('ClientCertificateExportCtrl', function($scope, $location, $ht
});
$scope.cancel = function() {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials/client-jwt");
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials");
}
});

View file

@ -1,24 +1,12 @@
<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
<form class="form-horizontal" name="credentialForm" novalidate kc-read-only="!access.manageClients" data-ng-show="client.attributes.length > 0">
<fieldset>
<kc-provider-config realm="realm" config="client.attributes" properties="clientConfigProperties"></kc-provider-config>
</fieldset>
<ol class="breadcrumb">
<li><a href="#/realms/{{realm.realm}}/clients">Clients</a></li>
<li>{{client.clientId}}</li>
</ol>
<kc-tabs-client></kc-tabs-client>
<form class="form-horizontal" name="credentialForm" novalidate kc-read-only="!access.manageClients">
<fieldset>
<kc-provider-config realm="realm" config="client.attributes" properties="clientConfigProperties"></kc-provider-config>
</fieldset>
<div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="access.manageClients">
<button kc-save data-ng-disabled="!changed">Save</button>
<button kc-reset data-ng-disabled="!changed">Cancel</button>
</div>
<div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="access.manageClients">
<button kc-save data-ng-disabled="!changed">Save</button>
<button kc-reset data-ng-disabled="!changed">Cancel</button>
</div>
</form>
</div>
<kc-menu></kc-menu>
</div>
</form>

View file

@ -7,7 +7,7 @@
<li class="active">Generate Client Private Key</li>
</ol>
<h1>Generate Private Key {{client.clientId|capitalize}}</h1>
<h1>Generate Private Key</h1>
<form class="form-horizontal" name="keyForm" novalidate kc-read-only="!access.manageRealm">
<fieldset class="form-group col-sm-10">
@ -47,7 +47,7 @@
<div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="access.manageRealm">
<button class="btn btn-primary" type="submit" data-ng-click="download()">Generate and Download</button>
<button class="btn btn-primary" type="submit" data-ng-click="cancel()">Back</button>
<button class="btn btn-default" type="submit" data-ng-click="cancel()">Cancel</button>
</div>
</div>
</fieldset>

View file

@ -7,7 +7,7 @@
<li class="active">Client Certificate Import</li>
</ol>
<h1>Import Client Certificate {{client.clientId|capitalize}}</h1>
<h1>Import Client Certificate</h1>
<form class="form-horizontal" name="keyForm" novalidate kc-read-only="!access.manageRealm">
<fieldset>
@ -50,9 +50,9 @@
</div>
</div>
<div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="files.length > 0">
<button type="submit" data-ng-click="uploadFile()" class="btn btn-primary">Import</button>
<button type="submit" data-ng-click="clearFileSelect()" class="btn btn-default">Cancel</button>
<div class="col-md-10 col-md-offset-2">
<button type="submit" data-ng-click="uploadFile()" data-ng-disabled="files.length == 0" class="btn btn-primary">Import</button>
<button type="submit" data-ng-click="cancel()" class="btn btn-default">Cancel</button>
</div>
</div>
</fieldset>

View file

@ -1,36 +1,21 @@
<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
<div>
<form class="form-horizontal" name="keyForm" novalidate kc-read-only="!access.manageClients" data-ng-controller="ClientSignedJWTCtrl">
<div class="form-group">
<label class="col-md-2 control-label" for="signingCert">Certificate</label>
<kc-tooltip>Client Certificate for validate JWT issued by client and signed by Client private key from your keystore.</kc-tooltip>
<ol class="breadcrumb">
<li><a href="#/realms/{{realm.realm}}/clients">Clients</a></li>
<li>{{client.clientId}}</li>
</ol>
<kc-tabs-client></kc-tabs-client>
<form class="form-horizontal" name="keyForm" novalidate kc-read-only="!access.manageClients">
<fieldset class="form-group col-sm-10">
<legend uncollapsed><span class="text">Client Certificate</span> <kc-tooltip>Client Certificate for validate JWT issued by client and signed by Client private key from your keystore.</kc-tooltip></legend>
<div class="form-group" data-ng-hide="!signingKeyInfo.certificate">
<label class="col-md-2 control-label" for="signingCert">Certificate</label>
<div class="col-sm-10">
<textarea type="text" id="signingCert" name="signingCert" class="form-control" rows="5"
kc-select-action="click" readonly>{{signingKeyInfo.certificate}}</textarea>
</div>
<div class="col-sm-10" data-ng-show="signingKeyInfo.certificate">
<textarea type="text" id="signingCert" name="signingCert" class="form-control" rows="5" kc-select-action="click" readonly>{{signingKeyInfo.certificate}}</textarea>
</div>
<div class="form-group" data-ng-show="!signingKeyInfo.certificate">
<label class="col-md-4 control-label" for="signingCert">Client Certificate not yet generated or imported!</label>
<div class="col-sm-10" data-ng-hide="signingKeyInfo.certificate">
No client certificate configured
</div>
<div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="access.manageClients">
<button class="btn btn-default" type="submit" data-ng-click="generateSigningKey()">Generate new keys and certificate</button>
<button class="btn btn-default" type="submit" data-ng-click="importCertificate()">Import certificate</button>
<button class="btn btn-default" type="buttin" data-ng-click="cancel()">Cancel</button>
</div>
</div>
<div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="access.manageClients">
<button class="btn btn-default" type="submit" data-ng-click="generateSigningKey()">Generate new keys and certificate</button>
<button class="btn btn-default" type="submit" data-ng-click="importCertificate()">Import certificate</button>
</div>
</fieldset>
</div>
</form>
</div>
<kc-menu></kc-menu>
</div>

View file

@ -1,27 +1,17 @@
<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2">
<ol class="breadcrumb">
<li><a href="#/realms/{{realm.realm}}/clients">Clients</a></li>
<li>{{client.clientId}}</li>
</ol>
<kc-tabs-client></kc-tabs-client>
<form class="form-horizontal" name="credentialForm" novalidate kc-read-only="!access.manageClients">
<div>
<form class="form-horizontal" name="credentialForm" novalidate kc-read-only="!access.manageClients" data-ng-controller="ClientSecretCtrl">
<div class="form-group">
<label class="col-md-2 control-label" for="secret">Secret</label>
<div class="col-sm-6">
<input readonly kc-select-action="click" class="form-control" type="text" id="secret" name="secret" data-ng-model="secret">
</div>
</div>
<div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="access.manageClients">
<button type="submit" data-ng-click="changePassword()" class="btn btn-primary">Regenerate Secret</button>
<button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
<div class="row">
<div class="col-sm-6">
<input readonly kc-select-action="click" class="form-control" type="text" id="secret" name="secret" data-ng-model="secret">
</div>
<div class="col-sm-6" data-ng-show="access.manageClients">
<button type="submit" data-ng-click="changePassword()" class="btn btn-default">Regenerate Secret</button>
</div>
</div>
</div>
</div>
</form>
</div>
<kc-menu></kc-menu>

View file

@ -21,13 +21,13 @@
</div>
</div>
<kc-tooltip>Client Authenticator used for authentication this client against Keycloak server</kc-tooltip>
<div class="col-sm-4" data-ng-show="access.manageRealm">
<a class="btn btn-primary" data-ng-show="configButtonVisible" data-ng-click="configureAuthenticator()">Configure chosen authenticator</a>
</div>
</div>
</fieldset>
</form>
<div data-ng-include="resourceUrl + '/partials/' + clientAuthenticatorConfigPartial">
</div>
</div>
<kc-menu></kc-menu>