Revize a53e5aef
Přidáno uživatelem Jan Pašek před téměř 4 roky(ů)
src/controllers/certificates_controller.py | ||
---|---|---|
211 | 211 |
|
212 | 212 |
if cert is None: |
213 | 213 |
Logger.error(f"No such certificate found 'ID = {v}'.") |
214 |
return E_NO_CERTIFICATES_FOUND, C_NO_DATA |
|
215 |
else: |
|
216 |
data = self.cert_to_dict_full(cert) |
|
217 |
if data is None: |
|
218 |
return E_CORRUPTED_DATABASE, C_INTERNAL_SERVER_ERROR |
|
219 |
return {"success": True, "data": data}, C_SUCCESS |
|
214 |
return E_NO_CERTIFICATES_FOUND, C_NOT_FOUND |
|
215 |
|
|
216 |
data = self.cert_to_dict_full(cert) |
|
217 |
if data is None: |
|
218 |
return E_CORRUPTED_DATABASE, C_INTERNAL_SERVER_ERROR |
|
219 |
|
|
220 |
try: |
|
221 |
state = self.certificate_service.get_certificate_state(v) |
|
222 |
data["status"] = state |
|
223 |
except CertificateNotFoundException: |
|
224 |
Logger.error(f"No such certificate found 'ID = {id}.") |
|
225 |
|
|
226 |
return {"success": True, "data": data}, C_SUCCESS |
|
220 | 227 |
|
221 | 228 |
def get_certificate_list(self): |
222 | 229 |
"""get list of certificates |
src/services/certificate_service.py | ||
---|---|---|
419 | 419 |
|
420 | 420 |
return self.cryptography_service.extract_public_key_from_certificate(certificate.pem_data) |
421 | 421 |
|
422 |
def get_certificate_state(self, id: int) -> str: |
|
423 |
""" |
|
424 |
Check whether the certificate is expired, valid or revoked. |
|
425 |
- in case it's revoked and expired, revoked is returned |
|
426 |
:param id: identifier of the certificate |
|
427 |
:return: certificates state from {valid, revoked, expired} |
|
428 |
:raises CertificateNotFoundException: in case id of non-existing certificate is entered |
|
429 |
""" |
|
430 |
pass |
|
431 |
|
|
422 | 432 |
def __get_crl_endpoint(self, ca_identifier: int) -> str: |
423 | 433 |
""" |
424 | 434 |
Get URL address of CRL distribution endpoint based on |
Také k dispozici: Unified diff
Re #8707 - Implemented status in the controller, prepared method in CertificateService