* Closes #278
This commit is contained in:
kevgliss 2016-05-05 15:28:17 -07:00
parent 52f44c3ea6
commit 6ec3bad49a
3 changed files with 129 additions and 109 deletions

View File

@ -248,6 +248,10 @@ def create(**kwargs):
cert.owner = kwargs['owner'] cert.owner = kwargs['owner']
# we override the generated name if one is provided
if kwargs.get('name'):
cert.name = kwargs['name']
database.create(cert) database.create(cert)
cert.description = kwargs['description'] cert.description = kwargs['description']
g.user.certificates.append(cert) g.user.certificates.append(cert)

View File

@ -201,7 +201,8 @@ class CertificatesList(AuthenticatedResource):
"validityEnd": "2015-06-16T07:00:00.000Z", "validityEnd": "2015-06-16T07:00:00.000Z",
"replacements": [ "replacements": [
{'id': 123} {'id': 123}
] ],
"name": "TestCertificate"
} }
**Example response**: **Example response**:

View File

@ -1,140 +1,155 @@
<form name="trackingForm" novalidate> <form name="trackingForm" novalidate>
<div class="form-horizontal"> <div class="form-horizontal">
<div class="form-group" <div class="form-group"
ng-class="{'has-error': trackingForm.ownerEmail.$invalid, 'has-success': !trackingForm.$invalid&&trackingForm.ownerEmail.$dirty}"> ng-class="{'has-error': trackingForm.ownerEmail.$invalid, 'has-success': !trackingForm.$invalid&&trackingForm.ownerEmail.$dirty}">
<label class="control-label col-sm-2"> <label class="control-label col-sm-2">
Owner Owner
</label> </label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="email" name="ownerEmail" ng-model="certificate.owner" placeholder="TeamDL@example.com" <input type="email" name="ownerEmail" ng-model="certificate.owner" placeholder="TeamDL@example.com"
tooltip="This is the certificates team distribution list or main point of contact" class="form-control" tooltip="This is the certificates team distribution list or main point of contact"
required/> class="form-control"
required/>
<p ng-show="trackingForm.ownerEmail.$invalid && !trackingForm.ownerEmail.$pristine" class="help-block">You must <p ng-show="trackingForm.ownerEmail.$invalid && !trackingForm.ownerEmail.$pristine" class="help-block">
enter an Certificate owner</p> You must enter an Certificate owner</p>
</div> </div>
</div> </div>
<div class="form-group" <div class="form-group"
ng-class="{'has-error': trackingForm.description.$invalid, 'has-success': !trackingForm.$invalid&&trackingForm.description.$dirty}"> ng-class="{'has-error': trackingForm.name.$invalid, 'has-success': !trackingForm.name.$invalid&&trackingForm.name.$dirty}">
<label class="control-label col-sm-2"> <label class="control-label col-sm-2" tooltip="If no name is provided, Lemur will generate a name for you">
Description Custom Name <span class="glyphicon glyphicon-question-sign"></span>
</label> </label>
<div class="col-sm-10">
<input name="name" ng-model="certificate.name"
placeholder="the.example.net-SymantecCorporation-20150828-20160830" class="form-control"/>
</div>
</div>
<div class="form-group"
ng-class="{'has-error': trackingForm.description.$invalid, 'has-success': !trackingForm.$invalid&&trackingForm.description.$dirty}">
<label class="control-label col-sm-2">
Description
</label>
<div class="col-sm-10"> <div class="col-sm-10">
<textarea name="description" ng-model="certificate.description" placeholder="Something elegant" <textarea name="description" ng-model="certificate.description" placeholder="Something elegant"
class="form-control" required></textarea> class="form-control" required></textarea>
<p ng-show="trackingForm.description.$invalid && !trackingForm.description.$pristine" class="help-block">You <p ng-show="trackingForm.description.$invalid && !trackingForm.description.$pristine"
must give a short description about this authority will be used for.</p> class="help-block">You
</div> must give a short description about this authority will be used for.</p>
</div> </div>
<div class="form-group"
ng-class="{'has-error': trackingForm.selectedAuthority.$invalid, 'has-success': !trackingForm.$invalid&&trackingForm.selectedAuthority.$dirty}">
<label class="control-label col-sm-2">
Certificate Authority
</label>
<div class="col-sm-10">
<div class="input-group col-sm-12">
<input name="selectedAuthority"
tooltip="If you are unsure which authority you need; you most likely want to use 'verisign'"
type="text" ng-model="certificate.selectedAuthority" placeholder="Authority Name"
typeahead-on-select="certificate.attachAuthority($item)"
typeahead="authority.name for authority in authorityService.findActiveAuthorityByName($viewValue)"
typeahead-loading="loadingAuthorities"
class="form-control" typeahead-wait-ms="1000"
typeahead-template-url="angular/authorities/authority/select.tpl.html" required>
</div> </div>
</div> <div class="form-group"
</div> ng-class="{'has-error': trackingForm.selectedAuthority.$invalid, 'has-success': !trackingForm.$invalid&&trackingForm.selectedAuthority.$dirty}">
<div class="form-group"> <label class="control-label col-sm-2">
<label class="control-label col-sm-2"> Certificate Authority
Certificate Template </label>
</label>
<div class="col-sm-10"> <div class="col-sm-10">
<select class="form-control" ng-change="certificate.useTemplate()" name="certificateTemplate" <div class="input-group col-sm-12">
ng-model="certificate.template" ng-options="template.name for template in templates"></select> <input name="selectedAuthority"
</div> tooltip="If you are unsure which authority you need; you most likely want to use 'verisign'"
</div> type="text" ng-model="certificate.selectedAuthority" placeholder="Authority Name"
<div class="form-group" typeahead-on-select="certificate.attachAuthority($item)"
ng-class="{'has-error': trackingForm.commonName.$invalid, 'has-success': !trackingForm.$invalid&&trackingForm.commonName.$dirty}"> typeahead="authority.name for authority in authorityService.findActiveAuthorityByName($viewValue)"
<label class="control-label col-sm-2"> typeahead-loading="loadingAuthorities"
Common Name class="form-control" typeahead-wait-ms="1000"
</label> typeahead-template-url="angular/authorities/authority/select.tpl.html" required>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">
Certificate Template
</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input name="commonName" <select class="form-control" ng-change="certificate.useTemplate()" name="certificateTemplate"
tooltip="If you need a certificate with multiple domains enter your primary domain here and the rest under 'Subject Alternate Names' in the next few panels" ng-model="certificate.template" ng-options="template.name for template in templates"></select>
ng-model="certificate.commonName" placeholder="Common Name" class="form-control" ng-maxlength="64" </div>
required/> </div>
<div class="form-group"
ng-class="{'has-error': trackingForm.commonName.$invalid, 'has-success': !trackingForm.$invalid&&trackingForm.commonName.$dirty}">
<label class="control-label col-sm-2">
Common Name
</label>
<p ng-show="trackingForm.commonName.$invalid && !trackingForm.commonName.$pristine" class="help-block">You must <div class="col-sm-10">
enter a common name and it must be less than 64 characters</p> <input name="commonName"
</div> tooltip="If you need a certificate with multiple domains enter your primary domain here and the rest under 'Subject Alternate Names' in the next few panels"
</div> ng-model="certificate.commonName" placeholder="Common Name" class="form-control"
<div class="form-group"> ng-maxlength="64"
<label class="control-label col-sm-2" required/>
tooltip="If no date is selected Lemur attempts to issue a 2 year certificate">
Validity Range <span class="glyphicon glyphicon-question-sign"></span> <p ng-show="trackingForm.commonName.$invalid && !trackingForm.commonName.$pristine" class="help-block">
</label> You must
<div class="col-sm-2"> enter a common name and it must be less than 64 characters</p>
<select ng-model="certificate.validityYears" class="form-control"> </div>
<option value="1">1 year</option> </div>
<option value="2">2 years</option> <div class="form-group">
<option value="3">3 years</option> <label class="control-label col-sm-2"
<option value="4">4 years</option> tooltip="If no date is selected Lemur attempts to issue a 2 year certificate">
</select> Validity Range <span class="glyphicon glyphicon-question-sign"></span>
</div> </label>
<div class="col-sm-2">
<select ng-model="certificate.validityYears" class="form-control">
<option value="1">1 year</option>
<option value="2">2 years</option>
<option value="3">3 years</option>
<option value="4">4 years</option>
</select>
</div>
<span style="padding-top: 15px" class="text-center col-sm-1"> <span style="padding-top: 15px" class="text-center col-sm-1">
<strong>- or -</strong> <strong>- or -</strong>
</span> </span>
<div class="col-sm-3"> <div class="col-sm-3">
<div class="input-group"> <div class="input-group">
<input tooltip="Starting Date (yyyy/MM/dd)" class="form-control" datepicker-popup="yyyy/MM/dd" <input tooltip="Starting Date (yyyy/MM/dd)" class="form-control" datepicker-popup="yyyy/MM/dd"
is-open="$parent.openNotBefore.isOpen" min-date="certificate.authority.notBefore" is-open="$parent.openNotBefore.isOpen" min-date="certificate.authority.notBefore"
max-date="certificate.authority.maxDate" ng-model="certificate.validityStart"/> max-date="certificate.authority.maxDate" ng-model="certificate.validityStart"/>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" ng-click="openNotBefore($event)"><i <button class="btn btn-default" ng-click="openNotBefore($event)"><i
class="glyphicon glyphicon-calendar"></i></button> class="glyphicon glyphicon-calendar"></i></button>
</span> </span>
</div> </div>
</div> </div>
<span style="padding-top: 15px" class="text-center col-sm-1"><label><span <span style="padding-top: 15px" class="text-center col-sm-1"><label><span
class="glyphicon glyphicon-resize-horizontal"></span></label></span> class="glyphicon glyphicon-resize-horizontal"></span></label></span>
<div class="col-sm-3"> <div class="col-sm-3">
<div> <div>
<div class="input-group"> <div class="input-group">
<input tooltip="Ending Date (yyyy/MM/dd)" class="form-control" datepicker-popup="yyyy/MM/dd" <input tooltip="Ending Date (yyyy/MM/dd)" class="form-control" datepicker-popup="yyyy/MM/dd"
is-open="$parent.openNotAfter.isOpen" min-date="certificate.authority.notBefore" is-open="$parent.openNotAfter.isOpen" min-date="certificate.authority.notBefore"
max-date="certificate.authority.maxDate" ng-model="certificate.validityEnd"/> max-date="certificate.authority.maxDate" ng-model="certificate.validityEnd"/>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-default" ng-click="openNotAfter($event)"><i <button class="btn btn-default" ng-click="openNotAfter($event)"><i
class="glyphicon glyphicon-calendar"></i></button> class="glyphicon glyphicon-calendar"></i></button>
</span> </span>
</div> </div>
</div>
</div>
</div> </div>
</div> <div class="form-group"
</div> ng-class="{'has-error': trackingForm.csr.$invalid&&trackingForm.csr.$dirty, 'has-success': !trackingForm.csr.$invalid&&trackingForm.csr.$dirty}">
<div class="form-group" <label class="control-label col-sm-2">
ng-class="{'has-error': trackingForm.csr.$invalid&&trackingForm.csr.$dirty, 'has-success': !trackingForm.csr.$invalid&&trackingForm.csr.$dirty}"> Certificate Signing Request (CSR)
<label class="control-label col-sm-2"> </label>
Certificate Signing Request (CSR) <div class="col-sm-10">
</label> <textarea tooltip="Values defined in the CSR will take precedence" name="certificate signing request"
<div class="col-sm-10"> ng-model="certificate.csr"
<textarea tooltip="Values defined in the CSR will take precedence" name="certificate signing request" ng-model="certificate.csr"
placeholder="PEM encoded string..." class="form-control" placeholder="PEM encoded string..." class="form-control"
ng-pattern="/^-----BEGIN CERTIFICATE REQUEST-----/"></textarea> ng-pattern="/^-----BEGIN CERTIFICATE REQUEST-----/"></textarea>
<p ng-show="trackingForm.csr.$invalid && !trackingForm.csr.$pristine" <p ng-show="trackingForm.csr.$invalid && !trackingForm.csr.$pristine"
class="help-block">Enter a valid certificate signing request.</p> class="help-block">Enter a valid certificate signing request.</p>
</div> </div>
</div>
<div ng-include="'angular/certificates/certificate/replaces.tpl.html'"></div>
<div ng-include="'angular/certificates/certificate/notifications.tpl.html'"></div>
<div ng-include="'angular/certificates/certificate/destinations.tpl.html'"></div>
</div> </div>
<div ng-include="'angular/certificates/certificate/replaces.tpl.html'"></div>
<div ng-include="'angular/certificates/certificate/notifications.tpl.html'"></div>
<div ng-include="'angular/certificates/certificate/destinations.tpl.html'"></div>
</div>
</form> </form>