est.views ========= .. py:module:: est.views .. autoapi-nested-parse:: Views for EST (Enrollment over Secure Transport) handling authentication and certificate issuance. Module Contents --------------- .. py:exception:: UsernamePasswordAuthenticationError Bases: :py:obj:`Exception` Exception raised for username and password authentication failures. .. py:data:: THRESHOLD_LOGGER :type: int :value: 400 .. py:class:: LoggedHttpResponse(content = b'', status = None, *args, **kwargs) Bases: :py:obj:`django.http.HttpResponse`, :py:obj:`trustpoint.logger.LoggerMixin` Custom HttpResponse that logs and prints error messages automatically. .. py:class:: EstRequestedDomainExtractorMixin Mixin to extract the requested domain. This mixin sets: - self.requested_domain: The DomainModel instance based on the 'domain' parameter. - self.issuing_ca_certificate: The CA certificate for the requested domain. - self.signature_suite: The signature suite derived from the CA certificate. .. py:attribute:: requested_domain :type: pki.models.domain.DomainModel | None .. py:method:: extract_requested_domain(domain_name) Extracts the requested domain and sets the relevant certificate and signature suite. :return: The response from the parent class's dispatch method. .. py:class:: EstSimpleEnrollmentMixin Bases: :py:obj:`trustpoint.logger.LoggerMixin` Mixin providing common logic for EST simple enrollment operations. .. py:attribute:: EVENT .. py:method:: process_enrollment(request, domain_name, cert_profile) Process an EST simple enrollment request. :param request: The HTTP request object. :param domain_name: The domain name (can be None for default). :param cert_profile: The certificate profile name (can be None for default). :returns: LoggedHttpResponse with the enrollment result. .. py:class:: EstSimpleEnrollmentView(**kwargs) Bases: :py:obj:`EstSimpleEnrollmentMixin`, :py:obj:`django.views.View` Handles simple EST (Enrollment over Secure Transport) enrollment requests. .. py:method:: post(request, *args, **kwargs) Handle POST requests for simple enrollment with domain and cert profile in URL. .. py:class:: EstSimpleReEnrollmentView(**kwargs) Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`django.views.View` Handles simple EST (Enrollment over Secure Transport) reenrollment requests. This view processes certificate signing requests (CSRs), authenticates the client using either Mutual TLS or username/password, validates the device, and issues the requested certificate based on the certificate template specified in the request. .. py:attribute:: EVENT .. py:method:: post(request, *args, **kwargs) Handle POST requests for simple reenrollment. .. py:class:: EstCACertsView(**kwargs) Bases: :py:obj:`EstRequestedDomainExtractorMixin`, :py:obj:`django.views.View`, :py:obj:`trustpoint.logger.LoggerMixin` View to handle the EST /cacerts endpoint. Returns the CA certificate chain in a (simplified) PKCS#7 MIME format. URL pattern should supply the 'domain' parameter (e.g., /cacerts//) .. py:method:: get(request, *args, **kwargs) Handle GET requests for the /cacerts endpoint. This method retrieves the CA certificate chain and returns it in PKCS#7 MIME format. .. py:class:: EstCsrAttrsView(**kwargs) Bases: :py:obj:`django.views.View`, :py:obj:`trustpoint.logger.LoggerMixin` View to handle the EST /csrattrs endpoint. This endpoint is not supported and returns 404 Not Found. .. py:method:: get(request, *args, **kwargs) Handle GET requests for the /csrattrs endpoint.