pki.views.issuing_cas ===================== .. py:module:: pki.views.issuing_cas .. autoapi-nested-parse:: Views for Issuing CA management. Module Contents --------------- .. py:class:: CmpContextParams Bases: :py:obj:`NamedTuple` Parameters for creating a CMP certificate request context. .. py:attribute:: subject :type: cryptography.x509.Name .. py:attribute:: public_key :type: cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey | cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey .. py:attribute:: private_key :type: cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey | cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey .. py:attribute:: recipient_name :type: str .. py:attribute:: extensions :type: list[cryptography.x509.Extension[cryptography.x509.ExtensionType]] | None .. py:attribute:: sender_kid :type: int | None .. py:class:: IssuingCaContextMixin Bases: :py:obj:`trustpoint.views.base.ContextDataMixin` Mixin which adds context_data for the PKI -> Issuing CAs pages. .. py:attribute:: context_page_category :value: 'pki' .. py:attribute:: context_page_name :value: 'cas' .. py:class:: KeylessCaContextMixin Bases: :py:obj:`trustpoint.views.base.ContextDataMixin` Mixin which adds context_data for the PKI -> Keyless CAs pages. .. py:attribute:: context_page_category :value: 'pki' .. py:attribute:: context_page_name :value: 'cas' .. py:class:: IssuingCaTableView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`trustpoint.views.base.SortableTableMixin`\ [\ :py:obj:`pki.models.CaModel`\ ], :py:obj:`django.views.generic.list.ListView`\ [\ :py:obj:`pki.models.CaModel`\ ] Issuing CA Table View. .. py:attribute:: model .. py:attribute:: template_name :value: 'pki/issuing_cas/issuing_cas.html' .. py:attribute:: context_object_name :value: 'issuing_ca' .. py:attribute:: paginate_by :value: 50 .. py:attribute:: default_sort_param :value: 'created_at' .. py:method:: get_queryset() Return only issuing CAs. .. py:method:: get_context_data(*args, **kwargs) Add sorting information to the context. .. py:class:: IssuingCaAddMethodSelectView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.IssuingCaAddMethodSelectForm`\ ] View to select the method to add an Issuing CA. .. py:attribute:: template_name :value: 'pki/issuing_cas/add/method_select.html' .. py:attribute:: form_class .. py:method:: form_valid(form) Redirect to the next step based on the selected method. .. py:class:: IssuingCaAddFileImportPkcs12View Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.IssuingCaAddFileImportPkcs12Form`\ ] View to import an Issuing CA from a PKCS12 file. .. py:attribute:: template_name :value: 'pki/issuing_cas/add/file_import.html' .. py:attribute:: form_class .. py:attribute:: success_url .. py:method:: form_valid(form) Handle the case where the form is valid. .. py:class:: IssuingCaAddFileImportSeparateFilesView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.IssuingCaAddFileImportSeparateFilesForm`\ ] View to import an Issuing CA from separate PEM files. .. py:attribute:: template_name :value: 'pki/issuing_cas/add/file_import.html' .. py:attribute:: form_class .. py:attribute:: success_url .. py:method:: form_valid(form) Handle the case where the form is valid. .. py:class:: IssuingCaAddRequestEstView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.IssuingCaAddRequestEstForm`\ ] View to request an Issuing CA certificate using EST. .. py:attribute:: form_class .. py:attribute:: template_name :value: 'pki/issuing_cas/add/request_est.html' .. py:method:: form_valid(form) Handle successful form submission. .. py:class:: IssuingCaTruststoreAssociationView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.IssuingCaTruststoreAssociationForm`\ ] View for associating a truststore with an Issuing CA. .. py:attribute:: form_class .. py:attribute:: template_name :value: 'pki/issuing_cas/truststore_association.html' .. py:method:: get_ca() Get the CA from the URL parameters. .. py:method:: get_form_kwargs() Add the CA instance to the form kwargs. .. py:method:: post(request, *args, **kwargs) Handle both association and import form submissions. .. py:method:: get_context_data(**kwargs) Add the CA and import form to the context. .. py:method:: form_valid(form) Handle successful form submission. .. py:class:: IssuingCaDefineCertContentMixin Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`IssuingCaContextMixin` Mixin for defining certificate content using a certificate profile. .. py:attribute:: ca_type_filter :type: pki.models.CaModel.CaTypeChoice .. py:attribute:: redirect_url_name :type: str .. py:attribute:: available_profiles :type: list[pki.models.cert_profile.CertificateProfileModel] .. py:method:: dispatch(request, *args, **kwargs) Dispatch the request, ensuring the CA and profile exist. .. py:method:: get_form_kwargs() Get form kwargs, including the profile. .. py:method:: get_context_data(**kwargs) Add additional context data. .. py:method:: form_invalid(form) Handle the case where the form is invalid. .. py:method:: form_valid(form) Handle the case where the form is valid. .. py:method:: get_success_message() Get the success message for the form submission. .. py:class:: IssuingCaDefineCertContentEstView Bases: :py:obj:`IssuingCaDefineCertContentMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.CertificateIssuanceForm`\ ] View to define certificate content using the issuing_ca profile before requesting via EST. .. py:attribute:: form_class .. py:attribute:: template_name :value: 'pki/issuing_cas/define_cert_content_est.html' .. py:attribute:: ca_type_filter .. py:attribute:: redirect_url_name :value: 'pki:issuing_cas-request-cert-est' .. py:method:: get_success_message() Get the success message for the form submission. .. py:class:: RemoteRaAddRequestCmpMixin Bases: :py:obj:`IssuingCaContextMixin` Mixin for CMP RA configuration views. .. py:method:: form_valid(form) Handle successful CMP RA configuration submission. .. py:class:: IssuingCaAddRequestCmpView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.IssuingCaAddRequestCmpForm`\ ] View to request an Issuing CA certificate using CMP. .. py:attribute:: form_class .. py:attribute:: template_name :value: 'pki/issuing_cas/add/request_cmp.html' .. py:method:: form_valid(form) Handle successful form submission. .. py:class:: RemoteRaAddRequestCmpView Bases: :py:obj:`RemoteRaAddRequestCmpMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.IssuingCaAddRequestCmpForm`\ ] View to configure a remote CMP RA (Registration Authority). .. py:attribute:: form_class .. py:attribute:: template_name :value: 'pki/issuing_cas/add/cmp_ra.html' .. py:class:: RemoteRaAddRequestEstMixin Bases: :py:obj:`IssuingCaContextMixin` Mixin for EST RA configuration views. .. py:method:: form_valid(form) Handle successful EST RA configuration submission. .. py:class:: RemoteRaAddRequestEstView Bases: :py:obj:`RemoteRaAddRequestEstMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.IssuingCaAddRequestEstForm`\ ] View to configure a remote EST RA (Registration Authority). .. py:attribute:: form_class .. py:attribute:: template_name :value: 'pki/issuing_cas/add/est_ra.html' .. py:class:: IssuingCaDefineCertContentCmpView Bases: :py:obj:`IssuingCaDefineCertContentMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`pki.forms.CertificateIssuanceForm`\ ] View to define certificate content using the issuing_ca profile before requesting via CMP. .. py:attribute:: form_class .. py:attribute:: template_name :value: 'pki/issuing_cas/define_cert_content_cmp.html' .. py:attribute:: ca_type_filter .. py:attribute:: redirect_url_name :value: 'pki:issuing_cas-request-cert-cmp' .. py:method:: get_success_message() Get the success message for the form submission. .. py:class:: IssuingCaConfigView Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.CaModel`\ ] View to display the details of an Issuing CA. .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: template_name :value: 'pki/issuing_cas/config.html' .. py:attribute:: context_object_name :value: 'issuing_ca' .. py:method:: get_queryset() Return only issuing CAs. .. py:method:: get_context_data(**kwargs) Adds the issued certificates to the context. :param \*\*kwargs: Keyword arguments passed to super().get_context_data() :returns: The context to render the page. .. py:method:: get(request, *args, **kwargs) Handle GET requests. .. py:method:: post(request, *_args, **_kwargs) Handle POST request to update CRL cycle settings. .. py:class:: IssuingCaRequestCertMixin Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`IssuingCaContextMixin` Mixin for certificate request views for EST and CMP protocols. .. py:attribute:: context_object_name :value: 'issuing_ca' .. py:attribute:: ca_type_filter :type: pki.models.CaModel.CaTypeChoice .. py:attribute:: redirect_url_name :type: str .. py:method:: get_queryset() Return only CAs matching the protocol-specific type filter. .. py:method:: get_context_data(**kwargs) Add the issuing_ca certificate profile and cert content summary to the context. .. py:method:: post(request, *_args, **_kwargs) Handle POST request to request certificate. .. py:method:: get_not_implemented_message() Get the not implemented message for the specific protocol. .. py:class:: IssuingCaRequestCertEstView Bases: :py:obj:`IssuingCaRequestCertMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.CaModel`\ ] View to display the EST certificate request page. .. py:attribute:: template_name :value: 'pki/issuing_cas/request_cert_est.html' .. py:attribute:: ca_type_filter .. py:attribute:: redirect_url_name :value: 'pki:issuing_cas-request-cert-est' .. py:method:: get_not_implemented_message() Get the not implemented message for EST. .. py:method:: post(request, *_args, **_kwargs) Handle POST request to request certificate via EST. .. py:class:: IssuingCaRequestCertCmpView Bases: :py:obj:`IssuingCaRequestCertMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.CaModel`\ ] View to display the CMP certificate request page. .. py:attribute:: template_name :value: 'pki/issuing_cas/request_cert_cmp.html' .. py:attribute:: ca_type_filter .. py:attribute:: redirect_url_name :value: 'pki:issuing_cas-request-cert-cmp' .. py:method:: get_not_implemented_message() Get the not implemented message for CMP. .. py:method:: post(request, *_args, **_kwargs) Handle POST request to request certificate via CMP. .. py:class:: KeylessCaConfigView Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`KeylessCaContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.CaModel`\ ] View to display the details of a Keyless CA. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: template_name :value: 'pki/keyless_cas/config.html' .. py:attribute:: context_object_name :value: 'keyless_ca' .. py:method:: get_queryset() Return only keyless CAs. .. py:method:: get_context_data(**kwargs) Add active CRL information to the context. .. py:class:: IssuedCertificatesListView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.list.ListView`\ [\ :py:obj:`pki.models.CertificateModel`\ ] View to display all certificates issued by a specific Issuing CA. .. py:attribute:: model .. py:attribute:: template_name :value: 'pki/issuing_cas/issued_certificates.html' .. py:attribute:: context_object_name :value: 'issued_certificates' .. py:method:: get_queryset() Gets the required and filtered QuerySet. :returns: The filtered QuerySet. .. py:method:: get_context_data(**kwargs) Adds the issuing ca model object to the context. :param \*\*kwargs: Keyword arguments passed to super().get_context_data() :returns: The context to render the page. .. py:class:: IssuingCaDetailView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.CaModel`\ ] Detail view for an Issuing CA. .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: template_name :value: 'pki/issuing_cas/details.html' .. py:attribute:: context_object_name :value: 'issuing_ca' .. py:method:: get_queryset() Return only issuing CAs (excluding RAs and keyless CAs). .. py:class:: IssuingCaBulkDeleteConfirmView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`trustpoint.views.base.BulkDeleteView` View to confirm the deletion of multiple Issuing CAs. .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: template_name :value: 'pki/issuing_cas/confirm_delete.html' .. py:attribute:: context_object_name :value: 'issuing_cas' .. py:method:: get(request, *args, **kwargs) Handle GET requests. .. py:method:: get_queryset() Return only issuing CAs. .. py:method:: form_valid(form) Delete the selected Issuing CAs on valid form. .. py:class:: IssuingCaCrlGenerationView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.CaModel`\ ] View to manually generate a CRL for an Issuing CA. .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: context_object_name :value: 'issuing_ca' .. py:attribute:: http_method_names :value: ('get',) .. py:method:: get_queryset() Return only issuing CAs. .. py:method:: get(request, *args, **kwargs) Generate a CRL for the Issuing CA (should be POST!). .. py:class:: CrlDownloadView Bases: :py:obj:`IssuingCaContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`pki.models.CaModel`\ ] Unauthenticated view to download the certificate revocation list of any CA. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: context_object_name :value: 'ca' .. py:method:: get_queryset() Return all CAs. .. py:method:: get(request, *args, **kwargs) Download the CRL of the CA. .. py:class:: IssuingCaViewSet(**kwargs) Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`rest_framework.viewsets.ReadOnlyModelViewSet`\ [\ :py:obj:`pki.models.CaModel`\ ] ViewSet for managing Issuing CA instances via REST API. .. py:attribute:: queryset .. py:attribute:: serializer_class .. py:attribute:: permission_classes .. py:attribute:: filter_backends .. py:attribute:: filterset_fields :type: ClassVar :value: ['unique_name', 'is_active'] .. py:attribute:: search_fields :type: ClassVar :value: ['unique_name', 'credential__certificate__common_name'] .. py:attribute:: ordering_fields :type: ClassVar :value: ['unique_name', 'created_at', 'updated_at'] .. py:method:: list(_request) API endpoint to get all Issuing CAs. .. py:method:: retrieve(request) API endpoint to get a single Issuing CA by ID. .. py:method:: generate_crl(_request, pk = None, **_kwargs) Generate a new CRL for this Issuing CA. .. py:method:: crl(request, pk = None, **_kwargs) Download the CRL for this Issuing CA.