Merge branch 'master' into url_context_path
This commit is contained in:
commit
3e1e17998e
|
@ -340,6 +340,8 @@ class CertificateOutputSchema(LemurOutputSchema):
|
||||||
|
|
||||||
@post_dump
|
@post_dump
|
||||||
def handle_subject_details(self, data):
|
def handle_subject_details(self, data):
|
||||||
|
subject_details = ["country", "state", "location", "organization", "organizational_unit"]
|
||||||
|
|
||||||
# Remove subject details if authority is CA/Browser Forum compliant. The code will use default set of values in that case.
|
# Remove subject details if authority is CA/Browser Forum compliant. The code will use default set of values in that case.
|
||||||
# If CA/Browser Forum compliance of an authority is unknown (None), it is safe to fallback to default values. Thus below
|
# If CA/Browser Forum compliance of an authority is unknown (None), it is safe to fallback to default values. Thus below
|
||||||
# condition checks for 'not False' ==> 'True or None'
|
# condition checks for 'not False' ==> 'True or None'
|
||||||
|
@ -347,11 +349,13 @@ class CertificateOutputSchema(LemurOutputSchema):
|
||||||
is_cab_compliant = data.get("authority").get("isCabCompliant")
|
is_cab_compliant = data.get("authority").get("isCabCompliant")
|
||||||
|
|
||||||
if is_cab_compliant is not False:
|
if is_cab_compliant is not False:
|
||||||
data.pop("country", None)
|
for field in subject_details:
|
||||||
data.pop("state", None)
|
data.pop(field, None)
|
||||||
data.pop("location", None)
|
|
||||||
data.pop("organization", None)
|
# Removing subject fields if None, else it complains in de-serialization
|
||||||
data.pop("organizational_unit", None)
|
for field in subject_details:
|
||||||
|
if field in data and data[field] is None:
|
||||||
|
data.pop(field)
|
||||||
|
|
||||||
|
|
||||||
class CertificateShortOutputSchema(LemurOutputSchema):
|
class CertificateShortOutputSchema(LemurOutputSchema):
|
||||||
|
|
|
@ -95,9 +95,11 @@ def organization(cert):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return cert.subject.get_attributes_for_oid(x509.OID_ORGANIZATION_NAME)[
|
o = cert.subject.get_attributes_for_oid(x509.OID_ORGANIZATION_NAME)
|
||||||
0
|
if not o:
|
||||||
].value.strip()
|
return None
|
||||||
|
|
||||||
|
return o[0].value.strip()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
sentry.captureException()
|
sentry.captureException()
|
||||||
current_app.logger.error("Unable to get organization! {0}".format(e))
|
current_app.logger.error("Unable to get organization! {0}".format(e))
|
||||||
|
@ -110,9 +112,11 @@ def organizational_unit(cert):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return cert.subject.get_attributes_for_oid(x509.OID_ORGANIZATIONAL_UNIT_NAME)[
|
ou = cert.subject.get_attributes_for_oid(x509.OID_ORGANIZATIONAL_UNIT_NAME)
|
||||||
0
|
if not ou:
|
||||||
].value.strip()
|
return None
|
||||||
|
|
||||||
|
return ou[0].value.strip()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
sentry.captureException()
|
sentry.captureException()
|
||||||
current_app.logger.error("Unable to get organizational unit! {0}".format(e))
|
current_app.logger.error("Unable to get organizational unit! {0}".format(e))
|
||||||
|
@ -125,9 +129,11 @@ def country(cert):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return cert.subject.get_attributes_for_oid(x509.OID_COUNTRY_NAME)[
|
c = cert.subject.get_attributes_for_oid(x509.OID_COUNTRY_NAME)
|
||||||
0
|
if not c:
|
||||||
].value.strip()
|
return None
|
||||||
|
|
||||||
|
return c[0].value.strip()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
sentry.captureException()
|
sentry.captureException()
|
||||||
current_app.logger.error("Unable to get country! {0}".format(e))
|
current_app.logger.error("Unable to get country! {0}".format(e))
|
||||||
|
@ -140,9 +146,11 @@ def state(cert):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return cert.subject.get_attributes_for_oid(x509.OID_STATE_OR_PROVINCE_NAME)[
|
s = cert.subject.get_attributes_for_oid(x509.OID_STATE_OR_PROVINCE_NAME)
|
||||||
0
|
if not s:
|
||||||
].value.strip()
|
return None
|
||||||
|
|
||||||
|
return s[0].value.strip()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
sentry.captureException()
|
sentry.captureException()
|
||||||
current_app.logger.error("Unable to get state! {0}".format(e))
|
current_app.logger.error("Unable to get state! {0}".format(e))
|
||||||
|
@ -155,9 +163,11 @@ def location(cert):
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return cert.subject.get_attributes_for_oid(x509.OID_LOCALITY_NAME)[
|
loc = cert.subject.get_attributes_for_oid(x509.OID_LOCALITY_NAME)
|
||||||
0
|
if not loc:
|
||||||
].value.strip()
|
return None
|
||||||
|
|
||||||
|
return loc[0].value.strip()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
sentry.captureException()
|
sentry.captureException()
|
||||||
current_app.logger.error("Unable to get location! {0}".format(e))
|
current_app.logger.error("Unable to get location! {0}".format(e))
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
ng-options="option.value as option.name for option in [
|
ng-options="option.value as option.name for option in [
|
||||||
{'name': 'RSA-2048', 'value': 'RSA2048'},
|
{'name': 'RSA-2048', 'value': 'RSA2048'},
|
||||||
{'name': 'RSA-4096', 'value': 'RSA4096'},
|
{'name': 'RSA-4096', 'value': 'RSA4096'},
|
||||||
{'name': 'ECC-PRIME192V1', 'value': 'ECCPRIME192V1'},
|
|
||||||
{'name': 'ECC-PRIME256V1', 'value': 'ECCPRIME256V1'},
|
{'name': 'ECC-PRIME256V1', 'value': 'ECCPRIME256V1'},
|
||||||
{'name': 'ECC-SECP384R1', 'value': 'ECCSECP384R1'},
|
{'name': 'ECC-SECP384R1', 'value': 'ECCSECP384R1'},
|
||||||
{'name': 'ECC-SECP521R1', 'value': 'ECCSECP521R1'}]"
|
{'name': 'ECC-SECP521R1', 'value': 'ECCSECP521R1'}]"
|
||||||
|
|
|
@ -35,10 +35,8 @@
|
||||||
ng-options="option.value as option.name for option in [
|
ng-options="option.value as option.name for option in [
|
||||||
{'name': 'RSA-2048', 'value': 'RSA2048'},
|
{'name': 'RSA-2048', 'value': 'RSA2048'},
|
||||||
{'name': 'RSA-4096', 'value': 'RSA4096'},
|
{'name': 'RSA-4096', 'value': 'RSA4096'},
|
||||||
{'name': 'ECC-PRIME192V1', 'value': 'ECCPRIME192V1'},
|
|
||||||
{'name': 'ECC-PRIME256V1', 'value': 'ECCPRIME256V1'},
|
{'name': 'ECC-PRIME256V1', 'value': 'ECCPRIME256V1'},
|
||||||
{'name': 'ECC-SECP384R1', 'value': 'ECCSECP384R1'},
|
{'name': 'ECC-SECP384R1', 'value': 'ECCSECP384R1'}]"
|
||||||
{'name': 'ECC-SECP521R1', 'value': 'ECCSECP521R1'}]"
|
|
||||||
|
|
||||||
ng-init="certificate.keyType = 'RSA2048'"></select>
|
ng-init="certificate.keyType = 'RSA2048'"></select>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue