pki.views.certificates

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

Classes

CertificatesRedirectView

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

CertificatesContextMixin

Mixin which adds some extra context for the PKI Views.

CertificateTableView

Certificate Table View.

CertificateDetailView

The certificate detail view.

CmpIssuingCaCertificateDownloadView

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.

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]

Mixin which adds some extra context for the PKI Views.

extra_context: ClassVar[source]
class pki.views.certificates.CertificateTableView[source]

Bases: CertificatesContextMixin, trustpoint.views.base.SortableTableMixin, 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]
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]
class pki.views.certificates.CmpIssuingCaCertificateDownloadView[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, pk=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 – The HttpRequest object.

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

  • *args – Positional arguments.

  • **kwargs – Keyword arguments.

  • _request (django.http.HttpRequest)

  • _args (Any)

  • _kwargs (Any)

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, pk=None, *_args, **_kwargs)[source]

Download the active Trustpoint TLS server certificate

Parameters:
  • _request (django.http.HttpRequest)

  • pk (str | None)

  • _args (Any)

  • _kwargs (Any)

Return type:

django.http.HttpResponse