management.views.tlsΒΆ

TLS setting specific views.

Module ContentsΒΆ

class management.views.tls.TlsSettingsContextMixin[source]ΒΆ

Mixin which adds data to the context for the TLS settings application.

page_category: str = 'management'[source]ΒΆ
page_name: str = 'tls'[source]ΒΆ
get_context_data(**kwargs)[source]ΒΆ

Add page_category and page_name to context.

Parameters:

kwargs (Any)

Return type:

dict[str, Any]

class management.views.tls.TlsView[source]ΒΆ

Bases: trustpoint.logger.LoggerMixin, TlsSettingsContextMixin, django.views.generic.FormView[management.forms.IPv4AddressForm]

View to display certificate details, including Subject Alternative Name (SAN) and associated IP addresses.

template_name = 'management/tls.html'[source]ΒΆ
form_class[source]ΒΆ
success_url[source]ΒΆ
get_form_kwargs()[source]ΒΆ

Pass additional arguments (e.g., SAN IPs) to the form.

Return type:

dict[str, Any]

get_context_data(**kwargs)[source]ΒΆ

Add certificate information, including SAN data and issuer details, to the context for display.

Parameters:

kwargs (dict[str, Any])

Return type:

dict[str, Any]

form_valid(form)[source]ΒΆ

Handle valid form submissions.

Parameters:

form (management.forms.IPv4AddressForm)

Return type:

django.http.HttpResponse

form_invalid(form)[source]ΒΆ

Handle invalid form submissions.

Parameters:

form (management.forms.IPv4AddressForm)

Return type:

django.http.HttpResponse

get_san_ips()[source]ΒΆ

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.

Return type:

list[str]

class management.views.tls.TlsAddMethodSelectView(**kwargs)[source]ΒΆ

Bases: django.views.generic.TemplateView

View to select the method to add a TLS Certificate.

template_name = 'management/tls/method_select.html'[source]ΒΆ
success_url[source]ΒΆ
class management.views.tls.GenerateTlsCertificateView[source]ΒΆ

Bases: trustpoint.logger.LoggerMixin, django.views.generic.FormView[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.

http_method_names[source]ΒΆ

HTTP methods allowed for this view.

Type:

ClassVar[list[str]]

template_name[source]ΒΆ

Path to the template used for rendering the form.

Type:

str

form_class[source]ΒΆ

The form class used to validate user input.

Type:

Form

success_url[source]ΒΆ

The URL to redirect to upon successful credential generation.

Type:

str

http_method_names = ('get', 'post')[source]ΒΆ
template_name = 'management/tls/generate_tls.html'[source]ΒΆ
form_class[source]ΒΆ
success_url[source]ΒΆ
form_valid(form)[source]ΒΆ

Handle a valid form submission for TLS Server Credential generation.

Parameters:

form (setup_wizard.forms.StartupWizardTlsCertificateForm) – 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.

Return type:

HttpResponseRedirect

Raises:
class management.views.tls.TlsAddFileImportPkcs12View[source]ΒΆ

Bases: TlsSettingsContextMixin, django.views.generic.FormView[management.forms.TlsAddFileImportPkcs12Form], trustpoint.logger.LoggerMixin

View to import an TLS-Server Credential from a PKCS12 file.

template_name = 'management/tls/file_import.html'[source]ΒΆ
form_class[source]ΒΆ
success_url[source]ΒΆ
form_valid(form)[source]ΒΆ

Handle the case where the form is valid.

Parameters:

form (management.forms.TlsAddFileImportPkcs12Form)

Return type:

django.http.HttpResponse

class management.views.tls.TlsAddFileImportSeparateFilesView[source]ΒΆ

Bases: TlsSettingsContextMixin, django.views.generic.FormView[management.forms.TlsAddFileImportSeparateFilesForm], trustpoint.logger.LoggerMixin

View to import an Issuing CA from separate PEM files.

template_name = 'management/tls/file_import.html'[source]ΒΆ
form_class[source]ΒΆ
success_url[source]ΒΆ
form_valid(form)[source]ΒΆ

Handle the case where the form is valid.

Parameters:

form (management.forms.TlsAddFileImportSeparateFilesForm)

Return type:

django.http.HttpResponse

class management.views.tls.TlsBulkDeleteConfirmView[source]ΒΆ

Bases: TlsSettingsContextMixin, trustpoint.views.base.BulkDeleteView

View to confirm the deletion of multiple TLS certificates.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'management/tls/confirm_delete.html'[source]ΒΆ
context_object_name = 'certificates'[source]ΒΆ
get(request, *args, **kwargs)[source]ΒΆ

Handle GET requests.

Parameters:
  • request (django.http.HttpRequest)

  • args (Any)

  • kwargs (Any)

Return type:

django.http.HttpResponse

form_valid(_form)[source]ΒΆ

Attempt to delete tls certificates if the form is valid.

Parameters:

_form (django.forms.Form)

Return type:

django.http.HttpResponse

class management.views.tls.ActivateTlsServerView(**kwargs)[source]ΒΆ

Bases: django.views.generic.View, trustpoint.logger.LoggerMixin

Activate a TLS server certificate.

post(request, *args, **kwargs)[source]ΒΆ

Handle a valid form submission for TLS Server Credential activation.

Parameters:
  • request (django.http.HttpRequest)

  • args (Any)

  • kwargs (dict[str, Any])

Return type:

django.http.HttpResponse

class management.views.tls.TlsViewSet(**kwargs)[source]ΒΆ

Bases: rest_framework.viewsets.ModelViewSet[Any]

ViewSet for managing Backup instances.

Supports standard CRUD operations such as list, retrieve, create, update, and delete.

queryset[source]ΒΆ
serializer_class[source]ΒΆ
permission_classes[source]ΒΆ
filter_backends[source]ΒΆ
filterset_fields: ClassVar = ['credential_type'][source]ΒΆ
search_fields: ClassVar = ['certificates'][source]ΒΆ
ordering_fields: ClassVar = ['created_at'][source]ΒΆ