KEYCLOAK-152 Re-generate realm's key pair
This commit is contained in:
parent
98662066cf
commit
19d4b09626
12 changed files with 99 additions and 0 deletions
|
@ -38,6 +38,15 @@ module.config([ '$routeProvider', function($routeProvider) {
|
|||
},
|
||||
controller : 'RealmTokenDetailCtrl'
|
||||
})
|
||||
.when('/realms/:realm/keys-settings', {
|
||||
templateUrl : 'partials/realm-keys.html',
|
||||
resolve : {
|
||||
realm : function(RealmLoader) {
|
||||
return RealmLoader();
|
||||
}
|
||||
},
|
||||
controller : 'RealmKeysDetailCtrl'
|
||||
})
|
||||
.when('/realms/:realm/social-settings', {
|
||||
templateUrl : 'partials/realm-social.html',
|
||||
resolve : {
|
||||
|
|
|
@ -548,6 +548,21 @@ module.controller('RealmTokenDetailCtrl', function($scope, Realm, realm, $http,
|
|||
};
|
||||
});
|
||||
|
||||
module.controller('RealmKeysDetailCtrl', function($scope, Realm, realm, $http, $location, Dialog, Notifications) {
|
||||
$scope.realm = realm;
|
||||
|
||||
$scope.generate = function() {
|
||||
Dialog.confirmGenerateKeys($scope.realm.realm, 'realm', function() {
|
||||
Realm.update({ id: realm.id, publicKey : 'GENERATE' }, function () {
|
||||
Notifications.success('New keys generated for realm.');
|
||||
Realm.get({ id : realm.id }, function(updated) {
|
||||
$scope.realm = updated;
|
||||
})
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
module.controller('RoleListCtrl', function($scope, $location, realm, roles) {
|
||||
|
||||
$scope.realm = realm;
|
||||
|
|
|
@ -34,6 +34,27 @@ module.service('Dialog', function($dialog) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
dialog.confirmGenerateKeys = function(name, type, success) {
|
||||
var title = 'Generate new keys for realm';
|
||||
var msg = '<span class="primary">Are you sure you want to permanently generate new keys for ' + name + '"?</span>' +
|
||||
'<span>This action can\'t be undone.</span>';
|
||||
var btns = [ {
|
||||
result : 'cancel',
|
||||
label : 'Cancel'
|
||||
}, {
|
||||
result : 'ok',
|
||||
label : 'Generate new keys',
|
||||
cssClass : 'destructive'
|
||||
} ];
|
||||
|
||||
$dialog.messageBox(title, msg, btns).open().then(function(result) {
|
||||
if (result == "ok") {
|
||||
success();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return dialog
|
||||
});
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
|
||||
<li class="active"><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/keys-settings">Keys</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/keys-settings">Keys</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<div id="wrapper" class="container" xmlns="http://www.w3.org/1999/html">
|
||||
<div class="row">
|
||||
<div class="bs-sidebar col-md-3 clearfix" data-ng-include data-src="'partials/realm-menu.html'"></div>
|
||||
<div id="content-area" class="col-md-9" role="main">
|
||||
<div class="top-nav" data-ng-hide="createRealm">
|
||||
<ul class="rcue-tabs">
|
||||
<li><a href="#/realms/{{realm.id}}">General</a></li>
|
||||
<li data-ng-show="realm.social"><a href="#/realms/{{realm.id}}/social-settings">Social</a></li>
|
||||
<li data-ng-show="realm.registrationAllowed"><a href="#/realms/{{realm.id}}/registration-settings">Registration</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
|
||||
<li class="active"><a href="#/realms/{{realm.id}}/keys-settings">Keys</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="content">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="#/realms/{{realm.id}}">{{realm.realm}}</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}">Settings</a></li>
|
||||
<li class="active">Keys</li>
|
||||
</ol>
|
||||
<h2><span>{{realm.realm}}</span> Keys</h2>
|
||||
<form name="realmForm" novalidate>
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
<label for="publicKey">Public key</label>
|
||||
|
||||
<div class="controls">
|
||||
<textarea type="text" id="publicKey" name="publicKey" class="xlarge" rows="5">{{realm.publicKey}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="form-actions">
|
||||
<button type="submit" data-ng-click="generate()" class="destructive">Generate new keys</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div id="container-right-bg"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -10,6 +10,7 @@
|
|||
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/keys-settings">Keys</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/keys-settings">Keys</a></li>
|
||||
<li class="active"><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/keys-settings">Keys</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<li><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
|
||||
<li class="active"><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/keys-settings">Keys</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
<li class="active"><a href="#/realms/{{realm.id}}/roles">Roles</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/required-credentials">Credentials</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/token-settings">Token</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/keys-settings">Keys</a></li>
|
||||
<li><a href="#/realms/{{realm.id}}/smtp-settings">SMTP</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -125,6 +125,10 @@ public class RealmManager {
|
|||
if (rep.getSocialProviders() != null) {
|
||||
realm.setSocialConfig(new HashMap(rep.getSocialProviders()));
|
||||
}
|
||||
|
||||
if ("GENERATE".equals(rep.getPublicKey())) {
|
||||
generateRealmKeys(realm);
|
||||
}
|
||||
}
|
||||
|
||||
private void enableAccountManagement(RealmModel realm) {
|
||||
|
|
Loading…
Reference in a new issue