Combining Authority Key Identifier extension options in the schema. (#651)

* Combining Authority Key Identifier extension options in the schema.
This makes processing them in the cert/csr generation stage make more sense because they are two options in the same x.509 extension. They were already in the same part of the schema for authorities, but this makes the certificates follow the same pattern, and it allows them to share the same schema/validation layout.

* Updating schema tests to match changes

* Fixing an idiot typo

* I promise to stop using Travis as a typo-corrector soon.
This commit is contained in:
Neil Schelly 2017-01-18 17:16:19 -05:00 committed by kevgliss
parent 7f2b44db04
commit 25340fd744
3 changed files with 11 additions and 25 deletions

View File

@ -170,12 +170,9 @@ class BasicConstraintsSchema(BaseExtensionSchema):
pass
class AuthorityIdentifierSchema(BaseExtensionSchema):
use_authority_cert = fields.Boolean()
class AuthorityKeyIdentifierSchema(BaseExtensionSchema):
use_key_identifier = fields.Boolean()
use_authority_cert = fields.Boolean()
class CertificateInfoAccessSchema(BaseExtensionSchema):
@ -240,7 +237,6 @@ class ExtensionSchema(BaseExtensionSchema):
extended_key_usage = fields.Nested(ExtendedKeyUsageSchema)
subject_key_identifier = fields.Nested(SubjectKeyIdentifierSchema)
sub_alt_names = fields.Nested(SubAltNamesSchema)
authority_identifier = fields.Nested(AuthorityIdentifierSchema)
authority_key_identifier = fields.Nested(AuthorityKeyIdentifierSchema)
certificate_info_access = fields.Nested(CertificateInfoAccessSchema)
custom = fields.List(fields.Nested(CustomOIDSchema))

View File

@ -184,15 +184,13 @@
<div class="checkbox">
<label tooltip-trigger="mouseenter" tooltip-placement="top"
uib-tooltip="Put Issuer's keyIdentifier in this extension">
<input type="checkbox" ng-model="certificate.extensions.authorityKeyIdentifier.useKeyIdentifier">Key
Identifier
<input type="checkbox" ng-model="certificate.extensions.authorityKeyIdentifier.useKeyIdentifier">Key Identifier
</label>
</div>
<div class="checkbox">
<label tooltip-trigger="mouseenter" tooltip-placement="top"
uib-tooltip="Put Issuer's Name and Serial number">
<input type="checkbox" ng-model="certificate.extensions.authorityIdentifier.useAuthorityCert">Authority
Certificate
<input type="checkbox" ng-model="certificate.extensions.authorityKeyIdentifier.useAuthorityCert">Authority Certificate
</label>
</div>
</div>

View File

@ -65,27 +65,19 @@ def test_certificate_edit_schema(session):
assert len(data['notifications']) == 3
def test_authority_identifier_schema():
from lemur.schemas import AuthorityIdentifierSchema
input_data = {'useAuthorityCert': True}
data, errors = AuthorityIdentifierSchema().load(input_data)
assert data == {'use_authority_cert': True}
assert not errors
data, errors = AuthorityIdentifierSchema().dumps(data)
assert not errors
assert data == json.dumps(input_data)
def test_authority_key_identifier_schema():
from lemur.schemas import AuthorityKeyIdentifierSchema
input_data = {'useKeyIdentifier': True}
input_data = {
'useKeyIdentifier': True,
'useAuthorityCert': True
}
data, errors = AuthorityKeyIdentifierSchema().load(input_data)
assert data == {'use_key_identifier': True}
assert data == {
'use_key_identifier': True,
'use_authority_cert': True
}
assert not errors
data, errors = AuthorityKeyIdentifierSchema().dumps(data)