2015-06-22 22:47:27 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular.module('lemur')
|
2015-07-30 02:13:06 +02:00
|
|
|
.controller('CertificateEditController', function ($scope, $modalInstance, CertificateApi, CertificateService, DestinationService, NotificationService, editId) {
|
|
|
|
CertificateApi.get(editId).then(function (certificate) {
|
|
|
|
CertificateService.getNotifications(certificate);
|
|
|
|
CertificateService.getDestinations(certificate);
|
2015-06-22 22:47:27 +02:00
|
|
|
$scope.certificate = certificate;
|
|
|
|
});
|
|
|
|
|
2015-07-30 02:13:06 +02:00
|
|
|
$scope.cancel = function () {
|
|
|
|
$modalInstance.dismiss('cancel');
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.save = function (certificate) {
|
|
|
|
CertificateService.update(certificate).then(function () {
|
|
|
|
$modalInstance.close();
|
|
|
|
});
|
|
|
|
};
|
2015-06-22 22:47:27 +02:00
|
|
|
|
2015-07-30 02:13:06 +02:00
|
|
|
$scope.destinationService = DestinationService;
|
|
|
|
$scope.notificationService = NotificationService;
|
2015-06-22 22:47:27 +02:00
|
|
|
})
|
|
|
|
|
2015-08-02 14:57:26 +02:00
|
|
|
.controller('CertificateCreateController', function ($scope, $modalInstance, CertificateApi, CertificateService, DestinationService, AuthorityService, PluginService, MomentService, WizardHandler, LemurRestangular, NotificationService) {
|
2015-06-22 22:47:27 +02:00
|
|
|
$scope.certificate = LemurRestangular.restangularizeElement(null, {}, 'certificates');
|
|
|
|
|
2015-08-27 21:59:40 +02:00
|
|
|
// set the defaults
|
|
|
|
CertificateService.getDefaults($scope.certificate);
|
|
|
|
|
2015-07-11 02:08:39 +02:00
|
|
|
$scope.create = function (certificate) {
|
|
|
|
WizardHandler.wizard().context.loading = true;
|
2015-07-21 22:36:03 +02:00
|
|
|
CertificateService.create(certificate).then(function () {
|
2015-07-11 02:08:39 +02:00
|
|
|
WizardHandler.wizard().context.loading = false;
|
|
|
|
$modalInstance.close();
|
2015-06-22 22:47:27 +02:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.templates = [
|
|
|
|
{
|
|
|
|
'name': 'Client Certificate',
|
|
|
|
'description': '',
|
|
|
|
'extensions': {
|
|
|
|
'basicConstraints': {},
|
|
|
|
'keyUsage': {
|
|
|
|
'isCritical': true,
|
|
|
|
'useDigitalSignature': true
|
|
|
|
},
|
|
|
|
'extendedKeyUsage': {
|
|
|
|
'isCritical': true,
|
|
|
|
'useClientAuthentication': true
|
|
|
|
},
|
|
|
|
'subjectKeyIdentifier': {
|
|
|
|
'includeSKI': true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'name': 'Server Certificate',
|
|
|
|
'description': '',
|
|
|
|
'extensions' : {
|
|
|
|
'basicConstraints': {},
|
|
|
|
'keyUsage': {
|
|
|
|
'isCritical': true,
|
|
|
|
'useKeyEncipherment': true,
|
|
|
|
'useDigitalSignature': true
|
|
|
|
},
|
|
|
|
'extendedKeyUsage': {
|
|
|
|
'isCritical': true,
|
|
|
|
'useServerAuthentication': true
|
|
|
|
},
|
|
|
|
'subjectKeyIdentifier': {
|
|
|
|
'includeSKI': true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
$scope.openNotBefore = function($event) {
|
|
|
|
$event.preventDefault();
|
|
|
|
$event.stopPropagation();
|
|
|
|
|
|
|
|
$scope.openNotBefore.isOpen = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.openNotAfter = function($event) {
|
|
|
|
$event.preventDefault();
|
|
|
|
$event.stopPropagation();
|
|
|
|
|
|
|
|
$scope.openNotAfter.isOpen = true;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2015-07-30 02:13:06 +02:00
|
|
|
PluginService.getByType('destination').then(function (plugins) {
|
2015-07-11 02:08:39 +02:00
|
|
|
$scope.plugins = plugins;
|
|
|
|
});
|
|
|
|
|
2015-06-22 22:47:27 +02:00
|
|
|
$scope.authorityService = AuthorityService;
|
2015-07-11 02:08:39 +02:00
|
|
|
$scope.destinationService = DestinationService;
|
2015-07-30 02:13:06 +02:00
|
|
|
$scope.notificationService = NotificationService;
|
2015-06-22 22:47:27 +02:00
|
|
|
});
|