management.views.tls ==================== .. py:module:: management.views.tls .. autoapi-nested-parse:: TLS setting specific views. Module Contents --------------- .. py:class:: TlsSettingsContextMixin Mixin which adds data to the context for the TLS settings application. .. py:attribute:: page_category :type: str :value: 'management' .. py:attribute:: page_name :type: str :value: 'tls' .. py:method:: get_context_data(**kwargs) Add page_category and page_name to context. .. py:class:: TlsView Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`TlsSettingsContextMixin`, :py:obj:`django.views.generic.FormView`\ [\ :py:obj:`management.forms.IPv4AddressForm`\ ] View to display certificate details, including Subject Alternative Name (SAN) and associated IP addresses. .. py:attribute:: template_name :value: 'management/tls.html' .. py:attribute:: form_class .. py:attribute:: success_url .. py:method:: get_form_kwargs() Pass additional arguments (e.g., SAN IPs) to the form. .. py:method:: get_context_data(**kwargs) Add certificate information, including SAN data and issuer details, to the context for display. .. py:method:: form_valid(form) Handle valid form submissions. .. py:method:: form_invalid(form) Handle invalid form submissions. .. py:method:: get_san_ips() Fetches IPv4 addresses from the Subject Alternative Name (SAN) extension of the active TLS certificate. :returns: A list of IPv4 addresses (as strings) or an empty list if none are found. .. py:class:: TlsAddMethodSelectView(**kwargs) Bases: :py:obj:`django.views.generic.TemplateView` View to select the method to add a TLS Certificate. .. py:attribute:: template_name :value: 'management/tls/method_select.html' .. py:attribute:: success_url .. py:class:: GenerateTlsCertificateView Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`django.views.generic.FormView`\ [\ :py:obj:`setup_wizard.forms.StartupWizardTlsCertificateForm`\ ] View for generating TLS Server Credentials in the setup wizard. This view handles the generation of TLS Server Credentials. It provides a form for the user to input necessary information such as IP addresses and domain names, and processes the data to generate the required TLS certificates. .. attribute:: http_method_names HTTP methods allowed for this view. :type: ClassVar[list[str]] .. attribute:: template_name Path to the template used for rendering the form. :type: str .. attribute:: form_class The form class used to validate user input. :type: Form .. attribute:: success_url The URL to redirect to upon successful credential generation. :type: str .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: template_name :value: 'management/tls/generate_tls.html' .. py:attribute:: form_class .. py:attribute:: success_url .. py:method:: form_valid(form) Handle a valid form submission for TLS Server Credential generation. :param form: The validated form containing user input for generating the TLS Server Credential. :returns: Redirect to the success URL upon successful credential generation, or an error page if an exception occurs. :rtype: HttpResponseRedirect :raises TrustpointTlsServerCredentialError: If no TLS server credential is found. :raises subprocess.CalledProcessError: If the associated shell script fails. .. py:class:: TlsAddFileImportPkcs12View Bases: :py:obj:`TlsSettingsContextMixin`, :py:obj:`django.views.generic.FormView`\ [\ :py:obj:`management.forms.TlsAddFileImportPkcs12Form`\ ], :py:obj:`trustpoint.logger.LoggerMixin` View to import an TLS-Server Credential from a PKCS12 file. .. py:attribute:: template_name :value: 'management/tls/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:: TlsAddFileImportSeparateFilesView Bases: :py:obj:`TlsSettingsContextMixin`, :py:obj:`django.views.generic.FormView`\ [\ :py:obj:`management.forms.TlsAddFileImportSeparateFilesForm`\ ], :py:obj:`trustpoint.logger.LoggerMixin` View to import an Issuing CA from separate PEM files. .. py:attribute:: template_name :value: 'management/tls/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:: TlsBulkDeleteConfirmView Bases: :py:obj:`TlsSettingsContextMixin`, :py:obj:`trustpoint.views.base.BulkDeleteView` View to confirm the deletion of multiple TLS certificates. .. py:attribute:: model .. py:attribute:: success_url .. py:attribute:: ignore_url .. py:attribute:: template_name :value: 'management/tls/confirm_delete.html' .. py:attribute:: context_object_name :value: 'certificates' .. py:method:: get(request, *args, **kwargs) Handle GET requests. .. py:method:: form_valid(_form) Attempt to delete tls certificates if the form is valid. .. py:class:: ActivateTlsServerView(**kwargs) Bases: :py:obj:`django.views.generic.View`, :py:obj:`trustpoint.logger.LoggerMixin` Activate a TLS server certificate. .. py:method:: post(request, *args, **kwargs) Handle a valid form submission for TLS Server Credential activation. .. py:class:: TlsViewSet(**kwargs) Bases: :py:obj:`rest_framework.viewsets.ModelViewSet`\ [\ :py:obj:`Any`\ ] ViewSet for managing Backup instances. Supports standard CRUD operations such as list, retrieve, create, update, and delete. .. py:attribute:: queryset .. py:attribute:: serializer_class .. py:attribute:: permission_classes .. py:attribute:: filter_backends .. py:attribute:: filterset_fields :type: ClassVar :value: ['credential_type'] .. py:attribute:: search_fields :type: ClassVar :value: ['certificates'] .. py:attribute:: ordering_fields :type: ClassVar :value: ['created_at']