pki.views.certificatesΒΆ

This module contains all views concerning the PKI -> Certificates section.

AttributesΒΆ

ClassesΒΆ

CertificatesRedirectView

View that redirects to the index of the PKI Issuing CA application: Issuing CAs.

CertificatesContextMixin

Mixin which adds data to the context for the PKI -> Certificates application.

CertificateTableView

Certificate Table View.

CertificateDetailView

The certificate detail view.

IssuingCaCertificateDownloadView

View for downloading a single certificate.

CertificateDownloadView

View for downloading a single certificate.

CertificateMultipleDownloadView

View for downloading multiple certificates at once as archived files.

TlsServerCertificateDownloadView

View for downloading the TLS server certificate of trustpoint.

CertificateViewSet

ViewSet for managing Certificate instances.

Module ContentsΒΆ

class pki.views.certificates.CertificatesRedirectView(**kwargs)[source]ΒΆ

Bases: django.views.generic.base.RedirectView

View that redirects to the index of the PKI Issuing CA application: Issuing CAs.

permanent = False[source]ΒΆ
pattern_name = 'pki:certificates'[source]ΒΆ
class pki.views.certificates.CertificatesContextMixin[source]ΒΆ

Bases: trustpoint.page_context.PageContextMixin

Mixin which adds data to the context for the PKI -> Certificates application.

page_category = 'pki'[source]ΒΆ
page_name = 'certificates'[source]ΒΆ
class pki.views.certificates.CertificateTableView[source]ΒΆ

Bases: CertificatesContextMixin, trustpoint.views.base.SortableTableMixin[pki.models.CertificateModel], django.views.generic.list.ListView[pki.models.CertificateModel]

Certificate Table View.

model[source]ΒΆ
template_name = 'pki/certificates/certificates.html'[source]ΒΆ
context_object_name = 'certificates'[source]ΒΆ
paginate_by = 50[source]ΒΆ
default_sort_param = 'common_name'[source]ΒΆ
pki.views.certificates.OID_MAP[source]ΒΆ
class pki.views.certificates.CertificateDetailView[source]ΒΆ

Bases: CertificatesContextMixin, django.views.generic.detail.DetailView[pki.models.CertificateModel]

The certificate detail view.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'pki/certificates/details.html'[source]ΒΆ
context_object_name = 'cert'[source]ΒΆ
get_context_data(**kwargs)[source]ΒΆ

Adding map of attribute and its oid with its values.

Parameters:

**kwargs (Any) – Keyword arguments passed to super().get_context_data().

Returns:

The context data.

Return type:

dict

class pki.views.certificates.IssuingCaCertificateDownloadView[source]ΒΆ

Bases: CertificatesContextMixin, django.views.generic.detail.DetailView[pki.models.CertificateModel]

View for downloading a single certificate.

model[source]ΒΆ
context_object_name = 'certificate'[source]ΒΆ
get(request, *args, **kwargs)[source]ΒΆ

HTTP GET Method.

If only the certificate primary key are passed in the url, the download summary will be displayed. If value for file_format is also provided, a file download will be performed.

Compare the re_path regex in the pki.urls package.

Parameters:
  • request (django.http.HttpRequest) – The HttpRequest object.

  • pk – A string containing the certificate primary key.

  • *args (Any) – Positional arguments.

  • **kwargs (Any) – Keyword arguments.

Returns:

The HTTP response with either the download summary or a file download.

Return type:

HttpResponse

Raises:

Http404 –

class pki.views.certificates.CertificateDownloadView[source]ΒΆ

Bases: CertificatesContextMixin, django.views.generic.detail.DetailView[pki.models.CertificateModel]

View for downloading a single certificate.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'pki/certificates/download.html'[source]ΒΆ
context_object_name = 'certificate'[source]ΒΆ
get(request, pk=None, file_format=None, *args, **kwargs)[source]ΒΆ

HTTP GET Method.

If only the certificate primary key are passed in the url, the download summary will be displayed. If value for file_format is also provided, a file download will be performed.

Compare the re_path regex in the pki.urls package.

Parameters:
  • request (django.http.HttpRequest) – The HttpRequest object.

  • pk (str | None) – A string containing the certificate primary key.

  • file_format (str | None) – The format of the certificate to download.

  • *args (tuple[Any]) – Positional arguments.

  • **kwargs (dict[str, Any]) – Keyword arguments.

Returns:

The HTTP response with either the download summary or a file download.

Return type:

HttpResponse

Raises:

Http404 –

class pki.views.certificates.CertificateMultipleDownloadView[source]ΒΆ

Bases: CertificatesContextMixin, trustpoint.views.base.PrimaryKeyListFromPrimaryKeyString, django.views.generic.list.ListView[pki.models.CertificateModel]

View for downloading multiple certificates at once as archived files.

model[source]ΒΆ
success_url[source]ΒΆ
ignore_url[source]ΒΆ
template_name = 'pki/certificates/download_multiple.html'[source]ΒΆ
context_object_name = 'certificates'[source]ΒΆ
get_context_data(*args, **kwargs)[source]ΒΆ

Adding the part of the url to the context, that contains the certificate primary keys.

This is used for the {% url }% tags in the template to download files.

Parameters:
  • *args (Any) – Positional arguments passed to super().get_context_data().

  • **kwargs (Any) – Keyword arguments passed to super().get_context_data().

Returns:

The context data.

Return type:

dict

get(request, pks=None, file_format=None, archive_format=None, *args, **kwargs)[source]ΒΆ

HTTP GET Method.

If only certificate primary keys are passed in the url, the download summary will be displayed. If value for file_format and archive_format are also provided, a file download will be performed.

Compare the re_path regex in the pki.urls package.

Parameters:
  • request (django.http.HttpRequest) – The HttpRequest object.

  • pks (str | None) – A string containing the certificate primary keys, e.g. 1/2/3/4/5

  • file_format (None | str) – The format of the archived certificate files.

  • archive_format (None | str) – The archive format that will be provided as download.

  • *args (tuple[Any]) – Positional arguments.

  • **kwargs (dict[str, Any]) – Keyword arguments.

Returns:

The HTTP response with either the download summary or a file download.

Return type:

HttpResponse

Raises:

Http404 –

class pki.views.certificates.TlsServerCertificateDownloadView[source]ΒΆ

Bases: CertificatesContextMixin, django.views.generic.detail.DetailView[pki.models.CertificateModel]

View for downloading the TLS server certificate of trustpoint.

model[source]ΒΆ
context_object_name = 'certificate'[source]ΒΆ
get(request, *args, **kwargs)[source]ΒΆ

Download the active Trustpoint TLS server certificate.

Parameters:
  • request (django.http.HttpRequest)

  • args (Any)

  • kwargs (Any)

Return type:

django.http.HttpResponse

class pki.views.certificates.CertificateViewSet(**kwargs)[source]ΒΆ

Bases: rest_framework.viewsets.ModelViewSet[pki.models.CertificateModel]

ViewSet for managing Certificate 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 = ['serial_number', 'not_valid_before'][source]ΒΆ
search_fields: ClassVar = ['common_name', 'sha256_fingerprint'][source]ΒΆ
ordering_fields: ClassVar = ['common_name', 'created_at'][source]ΒΆ
list(request, *args, **_kwargs)[source]ΒΆ

API endpoint to get all certificates.

Parameters:
  • request (django.http.HttpRequest)

  • args (Any)

  • _kwargs (Any)

Return type:

django.http.HttpResponse