Merge pull request #1594 from stianst/master

KEYCLOAK-1801
This commit is contained in:
Stian Thorgersen 2015-09-04 13:37:32 +02:00
commit 59da0f90f8
8 changed files with 74 additions and 141 deletions

View file

@ -642,45 +642,6 @@ module.config([ '$routeProvider', function($routeProvider) {
}, },
controller : 'ClientCredentialsCtrl' 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', { .when('/realms/:realm/clients/:client/credentials/client-jwt/:keyType/import/:attribute', {
templateUrl : resourceUrl + '/partials/client-credentials-jwt-key-import.html', templateUrl : resourceUrl + '/partials/client-credentials-jwt-key-import.html',
resolve : { resolve : {

View file

@ -62,23 +62,36 @@ module.controller('ClientCredentialsCtrl', function($scope, $location, realm, cl
} }
}, true); }, 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() { $scope.configureAuthenticator = function() {
$location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials/" + client.clientAuthenticatorType); $location.url("/realms/" + realm.realm + "/clients/" + client.id + "/credentials/" + client.clientAuthenticatorType);
} }
}); });
module.controller('ClientSecretCtrl', function($scope, $location, realm, client, ClientSecret, Notifications) { module.controller('ClientSecretCtrl', function($scope, $location, ClientSecret, Notifications) {
$scope.realm = realm; var secret = ClientSecret.get({ realm : $scope.realm.realm, client : $scope.client.id },
$scope.client = client;
var secret = ClientSecret.get({ realm : realm.realm, client : client.id },
function() { function() {
$scope.secret = secret.value; $scope.secret = secret.value;
} }
); );
$scope.changePassword = function() { $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() { function() {
Notifications.success('The secret has been changed.'); Notifications.success('The secret has been changed.');
$scope.secret = secret.value; $scope.secret = secret.value;
@ -97,31 +110,27 @@ module.controller('ClientSecretCtrl', function($scope, $location, realm, client,
}); });
$scope.cancel = function() { $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) { module.controller('ClientSignedJWTCtrl', function($scope, $location, ClientCertificate) {
var signingKeyInfo = ClientCertificate.get({ realm : $scope.realm.realm, client : $scope.client.id, attribute: 'jwt.credential' },
$scope.realm = realm;
$scope.client = client;
var signingKeyInfo = ClientCertificate.get({ realm : realm.realm, client : client.id, attribute: 'jwt.credential' },
function() { function() {
$scope.signingKeyInfo = signingKeyInfo; $scope.signingKeyInfo = signingKeyInfo;
} }
); );
$scope.importCertificate = function() { $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() { $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() { $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"; var redirectLocation = "/realms/" + realm.realm + "/clients/" + client.id + "/saml/keys";
} else if (callingContext == 'jwt-credentials') { } else if (callingContext == 'jwt-credentials') {
var uploadUrl = authUrl + '/admin/realms/' + realm.realm + '/clients/' + client.id + '/certificates/' + attribute + '/upload-certificate'; 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 = []; $scope.files = [];
@ -337,8 +346,8 @@ module.controller('ClientCertificateImportCtrl', function($scope, $location, $ht
$scope.files = $files; $scope.files = $files;
}; };
$scope.clearFileSelect = function() { $scope.cancel = function() {
$scope.files = null; $location.url(redirectLocation);
} }
$scope.keyFormats = [ $scope.keyFormats = [
@ -438,7 +447,7 @@ module.controller('ClientCertificateExportCtrl', function($scope, $location, $ht
if ($scope.jks.format == 'PKCS12') ext = ".p12"; if ($scope.jks.format == 'PKCS12') ext = ".p12";
if (callingContext == 'jwt-credentials') { 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") 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() { $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,13 +1,4 @@
<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">
<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> <fieldset>
<kc-provider-config realm="realm" config="client.attributes" properties="clientConfigProperties"></kc-provider-config> <kc-provider-config realm="realm" config="client.attributes" properties="clientConfigProperties"></kc-provider-config>
</fieldset> </fieldset>
@ -19,6 +10,3 @@
</div> </div>
</div> </div>
</form> </form>
</div>
<kc-menu></kc-menu>

View file

@ -7,7 +7,7 @@
<li class="active">Generate Client Private Key</li> <li class="active">Generate Client Private Key</li>
</ol> </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"> <form class="form-horizontal" name="keyForm" novalidate kc-read-only="!access.manageRealm">
<fieldset class="form-group col-sm-10"> <fieldset class="form-group col-sm-10">
@ -47,7 +47,7 @@
<div class="form-group"> <div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="access.manageRealm"> <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="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>
</div> </div>
</fieldset> </fieldset>

View file

@ -7,7 +7,7 @@
<li class="active">Client Certificate Import</li> <li class="active">Client Certificate Import</li>
</ol> </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"> <form class="form-horizontal" name="keyForm" novalidate kc-read-only="!access.manageRealm">
<fieldset> <fieldset>
@ -50,9 +50,9 @@
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="files.length > 0"> <div class="col-md-10 col-md-offset-2">
<button type="submit" data-ng-click="uploadFile()" class="btn btn-primary">Import</button> <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="clearFileSelect()" class="btn btn-default">Cancel</button> <button type="submit" data-ng-click="cancel()" class="btn btn-default">Cancel</button>
</div> </div>
</div> </div>
</fieldset> </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">
<ol class="breadcrumb"> <div class="form-group">
<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> <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>
<div class="col-sm-10"> <div class="col-sm-10" data-ng-show="signingKeyInfo.certificate">
<textarea type="text" id="signingCert" name="signingCert" class="form-control" rows="5" <textarea type="text" id="signingCert" name="signingCert" class="form-control" rows="5" kc-select-action="click" readonly>{{signingKeyInfo.certificate}}</textarea>
kc-select-action="click" readonly>{{signingKeyInfo.certificate}}</textarea>
</div> </div>
<div class="col-sm-10" data-ng-hide="signingKeyInfo.certificate">
No client certificate configured
</div> </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> </div>
<div class="form-group"> <div class="form-group">
<div class="col-md-10 col-md-offset-2" data-ng-show="access.manageClients"> <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="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="submit" data-ng-click="importCertificate()">Import certificate</button>
<button class="btn btn-default" type="buttin" data-ng-click="cancel()">Cancel</button>
</div> </div>
</div> </div>
</fieldset>
</form> </form>
</div> </div>
<kc-menu></kc-menu>

View file

@ -1,27 +1,17 @@
<div class="col-sm-9 col-md-10 col-sm-push-3 col-md-push-2"> <div>
<form class="form-horizontal" name="credentialForm" novalidate kc-read-only="!access.manageClients" data-ng-controller="ClientSecretCtrl">
<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 class="form-group"> <div class="form-group">
<label class="col-md-2 control-label" for="secret">Secret</label> <label class="col-md-2 control-label" for="secret">Secret</label>
<div class="col-sm-6">
<div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<input readonly kc-select-action="click" class="form-control" type="text" id="secret" name="secret" data-ng-model="secret"> <input readonly kc-select-action="click" class="form-control" type="text" id="secret" name="secret" data-ng-model="secret">
</div> </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 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> </div>
</div> </div>
</form> </form>
</div> </div>
<kc-menu></kc-menu>

View file

@ -21,13 +21,13 @@
</div> </div>
</div> </div>
<kc-tooltip>Client Authenticator used for authentication this client against Keycloak server</kc-tooltip> <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> </div>
</fieldset> </fieldset>
</form> </form>
<div data-ng-include="resourceUrl + '/partials/' + clientAuthenticatorConfigPartial">
</div>
</div> </div>
<kc-menu></kc-menu> <kc-menu></kc-menu>