mirror of
https://github.com/apache/superset.git
synced 2026-04-28 04:25:07 +00:00
fix(dependency): update cryptography import (#22744)
Co-authored-by: Daniel Draper <daniel.draper@understand.ai>
This commit is contained in:
@@ -74,9 +74,8 @@ import markdown as md
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import sqlalchemy as sa
|
||||
from cryptography import x509
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.backends.openssl.x509 import _Certificate
|
||||
from cryptography.x509 import Certificate, load_pem_x509_certificate
|
||||
from flask import current_app, flash, g, Markup, render_template, request
|
||||
from flask_appbuilder import SQLA
|
||||
from flask_appbuilder.security.sqla.models import Role, User
|
||||
@@ -1550,7 +1549,7 @@ def override_user(user: Optional[User], force: bool = True) -> Iterator[Any]:
|
||||
delattr(g, "user")
|
||||
|
||||
|
||||
def parse_ssl_cert(certificate: str) -> _Certificate:
|
||||
def parse_ssl_cert(certificate: str) -> Certificate:
|
||||
"""
|
||||
Parses the contents of a certificate and returns a valid certificate object
|
||||
if valid.
|
||||
@@ -1560,9 +1559,7 @@ def parse_ssl_cert(certificate: str) -> _Certificate:
|
||||
:raises CertificateException: If certificate is not valid/unparseable
|
||||
"""
|
||||
try:
|
||||
return x509.load_pem_x509_certificate(
|
||||
certificate.encode("utf-8"), default_backend()
|
||||
)
|
||||
return load_pem_x509_certificate(certificate.encode("utf-8"), default_backend())
|
||||
except ValueError as ex:
|
||||
raise CertificateException("Invalid certificate") from ex
|
||||
|
||||
|
||||
Reference in New Issue
Block a user