devices.views ============= .. py:module:: devices.views .. autoapi-nested-parse:: This module contains all views concerning the devices application. Attributes ---------- .. autoapisummary:: devices.views.DeviceWithoutDomainErrorMsg devices.views.NamedCurveMissingForEccErrorMsg devices.views.ActiveTrustpointTlsServerCredentialModelMissingErrorMsg devices.views.PublicKeyInfoMissingErrorMsg devices.views.ALLOWED_APP_CRED_PROFILES Classes ------- .. autoapisummary:: devices.views.AbstractDeviceTableView devices.views.DeviceTableView devices.views.OpcUaGdsTableView devices.views.AbstractCreateChooseOnboaringView devices.views.DeviceCreateChooseOnboardingView devices.views.OpcUaGdsCreateChooseOnboardingView devices.views.AbstractCreateNoOnboardingView devices.views.DeviceCreateNoOnboardingView devices.views.OpcUaGdsCreateNoOnboardingView devices.views.AbstractCreateOnboardingView devices.views.DeviceCreateOnboardingView devices.views.OpcUaGdsCreateOnboardingView devices.views.AbstractCertificateLifecycleManagementSummaryView devices.views.DeviceCertificateLifecycleManagementSummaryView devices.views.OpcUaGdsCertificateLifecycleManagementSummaryView devices.views.AbstractNoOnboardingIssueNewApplicationCredentialView devices.views.DeviceNoOnboardingIssueNewApplicationCredentialView devices.views.OpcUaGdsNoOnboardingIssueNewApplicationCredentialView devices.views.AbstractSelectCertificateProfileNewApplicationCredentialView devices.views.DeviceSelectCertificateProfileNewApplicationCredentialView devices.views.OpcUaGdsSelectCertificateProfileNewApplicationCredentialView devices.views.AbstractOnboardingIssueNewApplicationCredentialView devices.views.DeviceOnboardingIssueNewApplicationCredentialView devices.views.OpcUaGdsOnboardingIssueNewApplicationCredentialView devices.views.AbstractIssueCredentialView devices.views.AbstractIssueDomainCredentialView devices.views.DeviceIssueDomainCredentialView devices.views.OpcUaGdsIssueDomainCredentialView devices.views.AbstractIssueTlsClientCredentialView devices.views.DeviceIssueTlsClientCredentialView devices.views.OpcUaGdsIssueTlsClientCredentialView devices.views.AbstractIssueTlsServerCredentialView devices.views.DeviceIssueTlsServerCredentialView devices.views.OpcUaGdsIssueTlsServerCredentialView devices.views.AbstractIssueOpcUaClientCredentialView devices.views.DeviceIssueOpcUaClientCredentialView devices.views.OpcUaGdsIssueOpcUaClientCredentialView devices.views.AbstractIssueOpcUaServerCredentialView devices.views.DeviceIssueOpcUaServerCredentialView devices.views.OpcUaGdsIssueOpcUaServerCredentialView devices.views.DownloadTokenRequiredAuthenticationMixin devices.views.AbstractDownloadPageDispatcherView devices.views.DeviceDownloadPageDispatcherView devices.views.OpcUaGdsDownloadPageDispatcherView devices.views.AbstractCertificateDownloadView devices.views.DeviceCertificateDownloadView devices.views.OpcUaGdsCertificateDownloadView devices.views.AbstractDeviceBaseCredentialDownloadView devices.views.DeviceManualCredentialDownloadView devices.views.DeviceBrowserCredentialDownloadView devices.views.AbstractBrowserOnboardingOTPView devices.views.DeviceBrowserOnboardingOTPView devices.views.OpcUaGdsBrowserOnboardingOTPView devices.views.AbstractBrowserOnboardingCancelView devices.views.DeviceBrowserOnboardingCancelView devices.views.OpcUaGdsBrowserOnboardingCancelView devices.views.DeviceOnboardingBrowserLoginView devices.views.AbstractIssuedCredentialRevocationView devices.views.DeviceIssuedCredentialRevocationView devices.views.OpcUaGdsIssuedCredentialRevocationView devices.views.AbstractBulkRevokeView devices.views.DeviceBulkRevokeView devices.views.OpcUaGdsBulkRevokeView devices.views.AbstractBulkDeleteView devices.views.DeviceBulkDeleteView devices.views.OpcUaGdsBulkDeleteView Module Contents --------------- .. py:data:: DeviceWithoutDomainErrorMsg .. py:data:: NamedCurveMissingForEccErrorMsg .. py:data:: ActiveTrustpointTlsServerCredentialModelMissingErrorMsg .. py:data:: PublicKeyInfoMissingErrorMsg .. py:data:: ALLOWED_APP_CRED_PROFILES .. py:class:: AbstractDeviceTableView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.list.ListView`\ [\ :py:obj:`devices.models.DeviceModel`\ ], :py:obj:`abc.ABC` Device Table View. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'devices' .. py:attribute:: paginate_by :value: 50 .. py:attribute:: default_sort_param :value: 'common_name' .. py:attribute:: filterset_class .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: apply_filters(qs) Applies the `DeviceFilter` to the given queryset. :param qs: The base queryset to filter. :returns: The filtered queryset according to GET parameters. .. py:method:: get(request, *args, **kwargs) Adds the object model to the instance and forwards to super().get(). :param request: The Django request object. :param \*args: Positional arguments passed to super().get(). :param \*\*kwargs: Keyword arguments passed to super().get(). :returns: The HttpResponse object returned by super().get(). .. py:method:: get_queryset() :abstractmethod: Filter queryset to only include devices which are of generic type. :returns: Returns a queryset of all DeviceModels which are of generic type. .. py:method:: get_context_data(**kwargs) Adds the clm and revoke buttons to the context. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:method:: get_ordering() Returns the sort parameters as a list. :returns: The sort parameters, if any. Otherwise the default sort parameter. .. py:method:: _get_clm_button_html(record) Gets the HTML for the CLM button in the devices table. :param record: The corresponding DeviceModel. :returns: The HTML of the hyperlink for the CLM button. .. py:method:: _get_pki_protocols(record) .. py:class:: DeviceTableView Bases: :py:obj:`AbstractDeviceTableView` Device Table View. .. py:attribute:: template_name :value: 'devices/devices.html' .. py:attribute:: page_name :value: 'devices' .. py:method:: get_queryset() Filter queryset to only include devices which are of generic type and filtered by filtered by UI filters. :returns: Returns a queryset of all DeviceModels, filtered by UI filters. .. py:class:: OpcUaGdsTableView Bases: :py:obj:`DeviceTableView` Table View for devices where opc_ua_gds is True. .. py:attribute:: template_name :value: 'devices/opc_ua_gds.html' .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:method:: get_queryset() Filter queryset to only include devices which are of OPC-UA GDS type and filtered by UI filters. :returns: Returns a queryset of all DeviceModels which are of OPC-UA GDS type, filtered by UI filters. .. py:class:: AbstractCreateChooseOnboaringView(**kwargs) Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.base.TemplateView` Abstract view for choosing if the new device shall be onboarded or not. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: template_name :value: 'devices/create_choose_onboarding.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the cancel url href according to the subcategory. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:class:: DeviceCreateChooseOnboardingView(**kwargs) Bases: :py:obj:`AbstractCreateChooseOnboaringView` View for choosing if the new device shall be onboarded or not. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsCreateChooseOnboardingView(**kwargs) Bases: :py:obj:`AbstractCreateChooseOnboaringView` View for choosing if the new OPC UA GDS shall be onboarded or not. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractCreateNoOnboardingView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`devices.forms.NoOnboardingCreateForm`\ ] asdfds. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: form_class .. py:attribute:: template_name :value: 'devices/create.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the cancel url href according to the subcategory. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:method:: form_valid(form) Saves the form / creates the device model object. :param form: The valid form. :returns: The HTTP Response to be returned. .. py:method:: get_success_url() Gets the success url to redirect to after successful processing of the POST data following a form submit. :returns: The success url to redirect to after successful processing of the POST data following a form submit. .. py:class:: DeviceCreateNoOnboardingView Bases: :py:obj:`AbstractCreateNoOnboardingView` Create form view for the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsCreateNoOnboardingView Bases: :py:obj:`AbstractCreateNoOnboardingView` Create form view for the devices section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractCreateOnboardingView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`devices.forms.OnboardingCreateForm`\ ] asdfds. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: form_class .. py:attribute:: template_name :value: 'devices/create.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the cancel url href according to the subcategory. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the devices page. .. py:method:: form_valid(form) Saves the form / creates the device model object. :param form: The valid form. :returns: The HTTP Response to be returned. .. py:method:: get_success_url() Gets the success url to redirect to after successful processing of the POST data following a form submit. :returns: The success url to redirect to after successful processing of the POST data following a form submit. .. py:class:: DeviceCreateOnboardingView Bases: :py:obj:`AbstractCreateOnboardingView` Create form view for the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsCreateOnboardingView Bases: :py:obj:`AbstractCreateOnboardingView` Create form view for the devices section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractCertificateLifecycleManagementSummaryView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ], :py:obj:`abc.ABC` This is the CLM summary view in the devices section. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/credentials/certificate_lifecycle_management.html' .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: default_sort_param :value: 'common_name' .. py:attribute:: issued_creds_qs :type: django.db.models.QuerySet[devices.models.IssuedCredentialModel] .. py:attribute:: domain_credentials_qs :type: django.db.models.QuerySet[devices.models.IssuedCredentialModel] .. py:attribute:: application_credentials_qs :type: django.db.models.QuerySet[devices.models.IssuedCredentialModel] .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_issued_creds_qs() Gets a sorted queryset of all IssuedCredentialModels. :returns: Sorted queryset of all IssuedCredentialModels. .. py:method:: get_domain_credentials_qs() Gets a sorted queryset of all IssuedCredentialModels that are domain credentials. self.get_issued_creds_qs() must be called first! :returns: Sorted queryset of all IssuedCredentialModels that are domain credentials .. py:method:: get_application_credentials_qs() Gets a sorted queryset of all IssuedCredentialModels that are application credentials. self.get_issued_creds_qs() must be called first! :returns: Sorted queryset of all IssuedCredentialModels that are application credentials. .. py:method:: get_context_data(**kwargs) Adds the paginator and credential details to the context. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to use for rendering the clm summary page. .. py:method:: get_onboarding_initial() Gets the initial values for onboarding. :returns: Initial values for onboarding. .. py:method:: get_no_onboarding_initial() Gets the initial values for no onboarding. :returns: Initial values for no onboarding. .. py:method:: get_onboarding_form() Gets the form for onboarding. :returns: The onboarding form. .. py:method:: get_no_onboarding_form() Gets the form for no onboarding. :returns: The no onboarding form. .. py:method:: get_device_form() Gets the device Form for onboarding or no onboarding. :returns: The required form. .. py:method:: _get_expires_in(record) :staticmethod: Gets the remaining time until the credential expires as human-readable string. :param record: The corresponding IssuedCredentialModel. :returns: The remaining time until the credential expires as human-readable string. .. py:method:: _get_revoke_button_html(record) Gets the HTML for the revoke button in the devices table. :param record: The corresponding DeviceModel. :returns: The HTML of the hyperlink for the revoke button. .. py:method:: _get_pki_protocols(record) .. py:method:: post(request, *_args, **kwargs) Handles the POST request used for device form submission. :param request: The django request object. :param _args: Positional arguments are discarded. :param kwargs: Keyword arguments are passed to get_context_data. :returns: The HttpResponse. .. py:class:: DeviceCertificateLifecycleManagementSummaryView Bases: :py:obj:`AbstractCertificateLifecycleManagementSummaryView` Certificate Lifecycle Management Summary View for devices. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsCertificateLifecycleManagementSummaryView Bases: :py:obj:`AbstractCertificateLifecycleManagementSummaryView` Certificate Lifecycle Management Summary View for OPC UA Devcies. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractNoOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] abc. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: template_name :value: 'devices/credentials/issue_credential.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Add the sections to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:method:: _get_redirect_url() .. py:method:: get(request, *_args, **_kwargs) Adds checks if the device is configured for no-onboarding and has a domain set. :param request: The django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: The HttpResponse Or HttpRedirect to the CLM page. .. py:class:: DeviceNoOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`AbstractNoOnboardingIssueNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsNoOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`AbstractNoOnboardingIssueNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractSelectCertificateProfileNewApplicationCredentialView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] abc. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: template_name :value: 'devices/credentials/profile_select.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Add the sections to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:class:: DeviceSelectCertificateProfileNewApplicationCredentialView Bases: :py:obj:`AbstractSelectCertificateProfileNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsSelectCertificateProfileNewApplicationCredentialView Bases: :py:obj:`AbstractSelectCertificateProfileNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] abc. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: template_name :value: 'devices/credentials/issue_credential.html' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Add the sections to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:class:: DeviceOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`AbstractOnboardingIssueNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsOnboardingIssueNewApplicationCredentialView Bases: :py:obj:`AbstractOnboardingIssueNewApplicationCredentialView` abc. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractIssueCredentialView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] Base view for all credential issuance views. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: model .. py:attribute:: context_object_name :value: 'device' .. py:attribute:: template_name :value: 'devices/credentials/issue_application_credential.html' .. py:attribute:: form_class :type: type[AbstractIssueCredentialView.FormClass] .. py:attribute:: issuer_class :type: type[AbstractIssueCredentialView.IssuerClass] .. py:attribute:: friendly_name :type: str .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Add the form to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:method:: get_form_kwargs() This method ads the concerning device model to the form kwargs and returns them. :returns: The form kwargs including the concerning device model. .. py:method:: issue_credential(device, cleaned_data) :abstractmethod: Abstract method to issue a credential. :param device: The device to be associated with the new credential. :param cleaned_data: The validated form data. :returns: The IssuedCredentialModel object that was created and saved. .. py:method:: post(request, *_args, **_kwargs) Adds the object model to the instance and forwards to super().post(). :param request: The Django request object is only used implicitly through self. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: The HttpResponseBase object returned by super().post(). .. py:class:: AbstractIssueDomainCredentialView Bases: :py:obj:`AbstractIssueCredentialView`\ [\ :py:obj:`devices.forms.IssueDomainCredentialForm`\ , :py:obj:`devices.issuer.LocalDomainCredentialIssuer`\ ] Base view for issuing domain credentials. .. py:attribute:: form_class .. py:attribute:: template_name :value: 'devices/credentials/issue_domain_credential.html' .. py:attribute:: issuer_class .. py:attribute:: friendly_name :value: 'Domain Credential' .. py:method:: issue_credential(device, _cleaned_data) Issue a domain credential for the device. :param device: The device to issue the credential for. :param _cleaned_data: The validated form data is discarded. :returns: The issued credential model. .. py:class:: DeviceIssueDomainCredentialView Bases: :py:obj:`AbstractIssueDomainCredentialView` View for issuing domain credentials for devices. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsIssueDomainCredentialView Bases: :py:obj:`AbstractIssueDomainCredentialView` View for issuing domain credentials for OPC-UA GDS devices. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractIssueTlsClientCredentialView Bases: :py:obj:`AbstractIssueCredentialView`\ [\ :py:obj:`devices.forms.IssueTlsClientCredentialForm`\ , :py:obj:`devices.issuer.LocalTlsClientCredentialIssuer`\ ] View to issue a new TLS client credential. .. py:attribute:: form_class .. py:attribute:: issuer_class .. py:attribute:: friendly_name :value: 'TLS client credential' .. py:attribute:: page_name :type: str .. py:method:: issue_credential(device, cleaned_data) Issues an TLS client credential. :param device: The device to be associated with the new credential. :param cleaned_data: The validated form data. :returns: The IssuedCredentialModel object that was created and saved. .. py:class:: DeviceIssueTlsClientCredentialView Bases: :py:obj:`AbstractIssueTlsClientCredentialView` Issue a new TLS client credential within the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsIssueTlsClientCredentialView Bases: :py:obj:`AbstractIssueTlsClientCredentialView` Issue a new TLS client credential within the devices section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractIssueTlsServerCredentialView Bases: :py:obj:`AbstractIssueCredentialView`\ [\ :py:obj:`devices.forms.IssueTlsServerCredentialForm`\ , :py:obj:`devices.issuer.LocalTlsServerCredentialIssuer`\ ] View to issue a new TLS server credential. .. py:attribute:: form_class .. py:attribute:: issuer_class .. py:attribute:: friendly_name :value: 'TLS server credential' .. py:method:: issue_credential(device, cleaned_data) Issues an TLS server credential. :param device: The device to be associated with the new credential. :param cleaned_data: The validated form data. :returns: The IssuedCredentialModel object that was created and saved. .. py:class:: DeviceIssueTlsServerCredentialView Bases: :py:obj:`AbstractIssueTlsServerCredentialView` Issues a TLS server credenital within the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsIssueTlsServerCredentialView Bases: :py:obj:`AbstractIssueTlsServerCredentialView` Issues a TLS server credenital within the devices section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractIssueOpcUaClientCredentialView Bases: :py:obj:`AbstractIssueCredentialView`\ [\ :py:obj:`devices.forms.IssueOpcUaClientCredentialForm`\ , :py:obj:`devices.issuer.OpcUaClientCredentialIssuer`\ ] View to issue a new OPC UA client credential. .. py:attribute:: form_class .. py:attribute:: issuer_class .. py:attribute:: friendly_name :value: 'OPC UA client credential' .. py:method:: issue_credential(device, cleaned_data) Issues an OPC UA client credential. :param device: The device to be associated with the new credential. :param cleaned_data: The validated form data. :returns: The IssuedCredentialModel object that was created and saved. .. py:class:: DeviceIssueOpcUaClientCredentialView Bases: :py:obj:`AbstractIssueOpcUaClientCredentialView` Issues an OPC UA client credential within the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsIssueOpcUaClientCredentialView Bases: :py:obj:`AbstractIssueOpcUaClientCredentialView` Issues an OPC UA client credential within the devices section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractIssueOpcUaServerCredentialView Bases: :py:obj:`AbstractIssueCredentialView`\ [\ :py:obj:`devices.forms.IssueOpcUaServerCredentialForm`\ , :py:obj:`devices.issuer.OpcUaServerCredentialIssuer`\ ] View to issue a new OPC UA server credential. .. py:attribute:: form_class .. py:attribute:: issuer_class .. py:attribute:: friendly_name :value: 'OPC UA server credential' .. py:method:: issue_credential(device, cleaned_data) Issues an OPC UA server credential. :param device: The device to be associated with the new credential. :param cleaned_data: The validated form data. :returns: The IssuedCredentialModel object that was created and saved. .. py:class:: DeviceIssueOpcUaServerCredentialView Bases: :py:obj:`AbstractIssueOpcUaServerCredentialView` Issues an OPC UA server credential within the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsIssueOpcUaServerCredentialView Bases: :py:obj:`AbstractIssueOpcUaServerCredentialView` Issues an OPC UA server credential within the devices section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: DownloadTokenRequiredAuthenticationMixin Mixin which checks the token included in the URL for browser download views. .. py:attribute:: credential_download :type: devices.models.RemoteDeviceCredentialDownloadModel .. py:method:: dispatch(request, *args, **kwargs) Checks the validity of the token included in the URL for browser download views and redirects if invalid. :param request: The django request object. :param \*args: Positional arguments passed to super().dispatch(). :param \*\*kwargs: Keyword arguments passed to super().dispatch(). :returns: A Django HttpResponseBase object. .. py:class:: AbstractDownloadPageDispatcherView(**kwargs) Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.base.RedirectView` Redirects depending on the type of credential, that is if a private key is available or not. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model :type: type[devices.models.IssuedCredentialModel] .. py:attribute:: permanent :value: False .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_redirect_url(*_args, **kwargs) Gets the redirection URL depending on the type credential, that is if a private key is available or not. :param \*_args: Positional arguments are discarded. :param \*\*kwargs: The pk parameter is retrieved and expected to be there. :returns: The redirect URL. .. py:class:: DeviceDownloadPageDispatcherView(**kwargs) Bases: :py:obj:`AbstractDownloadPageDispatcherView` Download dispatcher view for the device pages. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsDownloadPageDispatcherView(**kwargs) Bases: :py:obj:`AbstractDownloadPageDispatcherView` Download dispatcher view for the OPC UA GDS pages. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractCertificateDownloadView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.IssuedCredentialModel`\ ] View for downloading certificates. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model :type: type[devices.models.IssuedCredentialModel] .. py:attribute:: template_name :value: 'devices/credentials/certificate_download.html' .. py:attribute:: context_object_name :value: 'issued_credential' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Add the clm_url to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:class:: DeviceCertificateDownloadView Bases: :py:obj:`AbstractCertificateDownloadView` Certificate download view for the device pages. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsCertificateDownloadView Bases: :py:obj:`AbstractCertificateDownloadView` Certificate download view for the OPC UA GDS pages. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractDeviceBaseCredentialDownloadView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.IssuedCredentialModel`\ ] View to download a password protected application credential in the desired format. Inherited by the domain and application credential download views. It is not intended for direct use. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/credentials/credential_download.html' .. py:attribute:: context_object_name :value: 'credential' .. py:attribute:: form_class .. py:attribute:: is_browser_download :value: False .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds information about the credential to the context. :param \*\*kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data for the view. .. py:method:: post(_request, *_args, **_kwargs) Processing the valid form data. This will use the contained form data to start the download process of the desired file. :param _request: The django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: If successful, this will start the file download. Otherwise, a Http404 will be raised and displayed. .. py:class:: DeviceManualCredentialDownloadView Bases: :py:obj:`AbstractDeviceBaseCredentialDownloadView` View to download a password protected domain or application credential in the desired format. .. py:attribute:: page_name :value: 'devices' .. py:class:: DeviceBrowserCredentialDownloadView Bases: :py:obj:`DownloadTokenRequiredAuthenticationMixin`, :py:obj:`AbstractDeviceBaseCredentialDownloadView` View to download a password protected domain or app credential in the desired format from a remote client. .. py:attribute:: is_browser_download :value: True .. py:class:: AbstractBrowserOnboardingOTPView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.IssuedCredentialModel`\ ] View to display the OTP for remote credential download (aka. browser onboarding). .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/credentials/onboarding/browser/otp_view.html' .. py:attribute:: redirection_view :value: 'devices:devices' .. py:attribute:: context_object_name :value: 'credential' .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds information about the credential and otp for the browser download process. :param \*\*kwargs: Keyword arguments passed to super().get_context_data. :returns: The context to render the page. .. py:class:: DeviceBrowserOnboardingOTPView Bases: :py:obj:`AbstractBrowserOnboardingOTPView` The browser onboarding OTP view for the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsBrowserOnboardingOTPView Bases: :py:obj:`AbstractBrowserOnboardingOTPView` The browser onboarding OTP view for the OPC UA GDS section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractBrowserOnboardingCancelView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.IssuedCredentialModel`\ ] View to cancel the browser onboarding process and delete the associated RemoteDeviceCredentialDownloadModel. .. py:attribute:: http_method_names :value: ('get',) .. py:attribute:: model .. py:attribute:: context_object_name :value: 'credential' .. py:attribute:: permanent :value: False .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get(request, *_args, **_kwargs) Cancels the browser onboarding process and deletes the associated RemoteDeviceCredentialDownloadModel. :param request: The Django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: The HttpResponseBase object with the desired redirection URL. .. py:class:: DeviceBrowserOnboardingCancelView Bases: :py:obj:`AbstractBrowserOnboardingCancelView` Cancels the browser onboarding for the devices section. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsBrowserOnboardingCancelView Bases: :py:obj:`AbstractBrowserOnboardingCancelView` Cancels the browser onboarding for the OPC UA GDS section. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: DeviceOnboardingBrowserLoginView Bases: :py:obj:`django.views.generic.edit.FormView`\ [\ :py:obj:`devices.forms.BrowserLoginForm`\ ] View to handle certificate download requests. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: template_name :value: 'devices/credentials/onboarding/browser/login.html' .. py:attribute:: form_class .. py:attribute:: cleaned_data :type: dict[str, Any] .. py:method:: get_success_url() Gets the success url to redirect to after successful processing of the POST data following a form submit. :returns: The success url to redirect to after successful processing of the POST data following a form submit. .. py:method:: form_invalid(form) Adds an error message in the case of an invalid OTP. :param form: The corresponding form object. :returns: The Django HttpResponse object. .. py:method:: form_valid(form) Performed if the form was validated successfully and adds the cleaned data to the instance. :param form: The corresponding form object. :returns: The Django HttpResponse object. .. py:class:: AbstractIssuedCredentialRevocationView Bases: :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.detail.DetailView`\ [\ :py:obj:`devices.models.IssuedCredentialModel`\ ] Revokes a specific issued credential. .. py:attribute:: http_method_names :value: ('get', 'post') .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/confirm_revoke.html' .. py:attribute:: context_object_name :value: 'issued_credential' .. py:attribute:: pk_url_kwarg :value: 'pk' .. py:attribute:: form_class .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the primary keys to the context. :param kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data. .. py:method:: post(_request, *_args, **_kwargs) Will try to revoke the requested issued credential. :param request: The Django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: Redirect to the devices summary. .. py:class:: DeviceIssuedCredentialRevocationView Bases: :py:obj:`AbstractIssuedCredentialRevocationView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsIssuedCredentialRevocationView Bases: :py:obj:`AbstractIssuedCredentialRevocationView` abc. .. py:attribute:: page_name :value: 'opc_ua_gds' .. py:class:: AbstractBulkRevokeView Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.list.ListView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] View to confirm the deletion of multiple Devices. .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/confirm_bulk_revoke.html' .. py:attribute:: context_object_name :value: 'devices' .. py:attribute:: missing :type: str :value: '' .. py:attribute:: pks :type: str :value: '' .. py:attribute:: queryset :type: django.db.models.QuerySet[devices.models.DeviceModel] .. py:attribute:: form_class .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the primary keys to the context. :param kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data. .. py:method:: get_queryset() Gets the queryset of DeviceModel objects that are requested to be revoked. :returns: The queryset of DeviceModel objects that are requested to be revoked. .. py:method:: _set_queryset(request) .. py:method:: get(request, *args, **kwargs) HTTP GET processing. :param request: The Django request object. :param \*args: Positional arguments passed to super().get(). :param \*\*kwargs: Keyword arguments passed to super().get(). :returns: The device deletion view or a redirect to the devices view if one or more pks were not found. .. py:method:: post(request, *_args, **_kwargs) Will try to revoke all certificate assiciated with the requested DeviceModel records. :param request: The Django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: Redirect to the devices summary. .. py:class:: DeviceBulkRevokeView Bases: :py:obj:`AbstractBulkRevokeView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsBulkRevokeView Bases: :py:obj:`AbstractBulkRevokeView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: AbstractBulkDeleteView Bases: :py:obj:`trustpoint.logger.LoggerMixin`, :py:obj:`trustpoint.page_context.PageContextMixin`, :py:obj:`django.views.generic.list.ListView`\ [\ :py:obj:`devices.models.DeviceModel`\ ] View to confirm the deletion of multiple Devices. .. py:attribute:: model .. py:attribute:: template_name :value: 'devices/confirm_delete.html' .. py:attribute:: context_object_name :value: 'devices' .. py:attribute:: missing :type: str :value: '' .. py:attribute:: pks :type: str :value: '' .. py:attribute:: queryset :type: django.db.models.QuerySet[devices.models.DeviceModel] .. py:attribute:: form_class .. py:attribute:: page_category :value: 'devices' .. py:attribute:: page_name :type: str .. py:method:: get_context_data(**kwargs) Adds the primary keys to the context. :param kwargs: Keyword arguments are passed to super().get_context_data(**kwargs). :returns: The context data. .. py:method:: get_queryset() Gets the queryset of DeviceModel objects that are requested to be deleted. :returns: The queryset of DeviceModel objects that are requested to be deleted. .. py:method:: _set_queryset(request) .. py:method:: get(request, *args, **kwargs) HTTP GET processing. :param request: The Django request object. :param \*args: Positional arguments passed to super().get(). :param \*\*kwargs: Keyword arguments passed to super().get(). :returns: The device deletion view or a redirect to the devices view if one or more pks were not found. .. py:method:: post(request, *_args, **_kwargs) HTTP POST processing which will try to delete all requested DeviceModel records. :param request: The Django request object. :param \*_args: Positional arguments are discarded. :param \*\*_kwargs: Keyword arguments are discarded. :returns: Redirect to the devices summary. .. py:class:: DeviceBulkDeleteView Bases: :py:obj:`AbstractBulkDeleteView` abc. .. py:attribute:: page_name :value: 'devices' .. py:class:: OpcUaGdsBulkDeleteView Bases: :py:obj:`AbstractBulkDeleteView` abc. .. py:attribute:: page_name :value: 'opc_ua_gds'