Initial work allowing certificates to be revoked. (#941)
* Initial work allowing for certificates to be revoked.
This commit is contained in:
@ -328,4 +328,36 @@ angular.module('lemur')
|
||||
$scope.authorityService = AuthorityService;
|
||||
$scope.destinationService = DestinationService;
|
||||
$scope.notificationService = NotificationService;
|
||||
})
|
||||
|
||||
.controller('CertificateRevokeController', function ($scope, $uibModalInstance, CertificateApi, CertificateService, LemurRestangular, NotificationService, toaster, revokeId) {
|
||||
CertificateApi.get(revokeId).then(function (certificate) {
|
||||
$scope.certificate = certificate;
|
||||
});
|
||||
|
||||
$scope.cancel = function () {
|
||||
$uibModalInstance.dismiss('cancel');
|
||||
};
|
||||
|
||||
$scope.revoke = function (certificate) {
|
||||
CertificateService.revoke(certificate).then(
|
||||
function () {
|
||||
toaster.pop({
|
||||
type: 'success',
|
||||
title: certificate.name,
|
||||
body: 'Successfully revoked!'
|
||||
});
|
||||
$uibModalInstance.close();
|
||||
},
|
||||
function (response) {
|
||||
toaster.pop({
|
||||
type: 'error',
|
||||
title: certificate.name,
|
||||
body: 'lemur-bad-request',
|
||||
bodyOutputType: 'directive',
|
||||
directiveData: response.data,
|
||||
timeout: 100000
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -0,0 +1,48 @@
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" ng-click="cancel()" aria-label="Close"><span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h3 class="modal-title">Revoke <span class="text-muted"><small>{{ certificate.name }}</small></span></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form name="revokeForm" ng-if="!certificate.endpoints.length" novalidate>
|
||||
<p><strong>Certificate revocation is final. Once revoked the certificate is no longer valid.</strong></p>
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group"
|
||||
ng-class="{'has-error': revokeForm.confirm.$invalid, 'has-success': !revokeForm.$invalid&&revokeForm.confirm.$dirty}">
|
||||
<label class="control-label col-sm-2">
|
||||
Confirm Revocation
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
<input name="confirm" ng-model="confirm" placeholder='{{ certificate.name }}'
|
||||
uib-tooltip="Confirm revocation by entering '{{ certificate.name }}'"
|
||||
class="form-control"
|
||||
compare-to="certificate.name"
|
||||
required/>
|
||||
|
||||
<p ng-show="revokeForm.confirm.$invalid && !revokeForm.confirm.$pristine" class="help-block">
|
||||
You must confirm certificate revocation.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div ng-if="certificate.endpoints.length">
|
||||
<p><strong>Certificate cannot be revoked, it is associated with the following endpoints. Disassociate this
|
||||
certificate
|
||||
before revoking.</strong></p>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item" ng-repeat="endpoint in certificate.endpoints">
|
||||
<span class="pull-right"><label class="label label-default">{{ endpoint.type }}</label></span>
|
||||
<ul class="list-unstyled">
|
||||
<li>{{ endpoint.name }}</li>
|
||||
<li><span class="text-muted">{{ endpoint.dnsname }}</span></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" ng-click="revoke(certificate)" ng-disabled="revokeForm.confirm.$invalid"
|
||||
class="btn btn-danger">Revoke
|
||||
</button>
|
||||
<button ng-click="cancel()" class="btn">Cancel</button>
|
||||
</div>
|
@ -258,5 +258,9 @@ angular.module('lemur')
|
||||
return certificate.customPOST(certificate.exportOptions, 'export');
|
||||
};
|
||||
|
||||
CertificateService.revoke = function (certificate) {
|
||||
return certificate.customPUT(certificate.externalId, 'revoke');
|
||||
};
|
||||
|
||||
return CertificateService;
|
||||
});
|
||||
|
@ -190,4 +190,19 @@ angular.module('lemur')
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.revoke = function (certificateId) {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
controller: 'CertificateRevokeController',
|
||||
templateUrl: '/angular/certificates/certificate/revoke.tpl.html',
|
||||
size: 'lg',
|
||||
backdrop: 'static',
|
||||
resolve: {
|
||||
revokeId: function () {
|
||||
return certificateId;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -60,6 +60,7 @@
|
||||
<li><a href ng-click="edit(certificate.id)">Edit</a></li>
|
||||
<li><a href ng-click="clone(certificate.id)">Clone</a></li>
|
||||
<li><a href ng-click="export(certificate.id)">Export</a></li>
|
||||
<li><a href ng-click="revoke(certificate.id)">Revoke</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -188,27 +189,21 @@
|
||||
<uib-tab>
|
||||
<uib-tab-heading>
|
||||
Chain
|
||||
<button class="btn btn-xs btn-default clipboard-btn glyphicon glyphicon-copy"
|
||||
uib-tooltip="Copy chain to clipboard" tooltip-trigger="mouseenter" clipboard
|
||||
text="certificate.chain"></button>
|
||||
<i class="glyphicon glyphicon-copy" style="cursor: pointer" clipboard text="certificate.chain"></i>
|
||||
</uib-tab-heading>
|
||||
<pre style="width: 100%">{{ certificate.chain }}</pre>
|
||||
</uib-tab>
|
||||
<uib-tab>
|
||||
<uib-tab-heading>
|
||||
Public Certificate
|
||||
<button class="btn btn-xs btn-default clipboard-btn glyphicon glyphicon-copy"
|
||||
uib-tooltip="Copy certificate to clipboard" tooltip-trigger="mouseenter" clipboard
|
||||
text="certificate.body"></button>
|
||||
<i class="glyphicon glyphicon-copy" style="cursor: pointer" clipboard text="certificate.body"></i>
|
||||
</uib-tab-heading>
|
||||
<pre style="width: 100%">{{ certificate.body }}</pre>
|
||||
</uib-tab>
|
||||
<uib-tab ng-click="loadPrivateKey(certificate)">
|
||||
<uib-tab-heading>
|
||||
Private Key
|
||||
<button class="btn btn-xs btn-default clipboard-btn glyphicon glyphicon-copy"
|
||||
uib-tooltip="Copy key to clipboard" tooltip-trigger="mouseenter" clipboard
|
||||
text="certificate.privateKey"></button>
|
||||
<i class="glyphicon glyphicon-copy" style="cursor: pointer" clipboard text="certificate.privateKey"></i>
|
||||
</uib-tab-heading>
|
||||
<pre style="width: 100%">{{ certificate.privateKey }}</pre>
|
||||
</uib-tab>
|
||||
|
Reference in New Issue
Block a user