devices.formsΒΆ

Forms exclusively used in the device application.

AttributesΒΆ

ClassesΒΆ

CredentialDownloadForm

Form to download a credential.

BaseCredentialForm

Base form for issuing credentials.

BaseServerCredentialForm

Base form for issuing server credentials.

IssueDomainCredentialForm

Form to issue a new domain credential.

IssueTlsClientCredentialForm

Form to issue a new TLS client credential.

IssueTlsServerCredentialForm

Form to issue a new TLS server credential.

ApplicationUriFormMixin

Adds a application_uri field to the form.

IssueOpcUaClientCredentialForm

Form to issue a new OPC UA client credential.

IssueOpcUaServerCredentialForm

Form to issue a new OPC UA server credential.

BrowserLoginForm

Form for the browser login via OTP for remote credential download.

RevokeIssuedCredentialForm

Form to revoke a specific issued credential.

RevokeDevicesForm

Form to revoke a issued credentials associated with a specific device.

DeleteDevicesForm

Form to delete the requested devices.

NoOnboardingCreateForm

Form for device or OPC UA GDS object creation without onboarding.

OnboardingCreateForm

Form for device or OPC UA GDS object creation with onboarding.

ClmDeviceModelOnboardingForm

CLM Device Model form for devices that use onboarding.

ClmDeviceModelNoOnboardingForm

CLM Device Model form for devices that do not use onboarding.

ApplicationCertProfileSelectForm

Allows to select the certificate profile.

FunctionsΒΆ

_get_secret([number_of_symbols])

Generates a secret with the number of symbols provided.

Module ContentsΒΆ

devices.forms.PASSWORD_MIN_LENGTH = 12[source]ΒΆ
devices.forms.OTP_SPLIT_PARTS = 2[source]ΒΆ
devices.forms.ONBOARDING_PROTOCOLS_ALLOWED_FOR_FORMS[source]ΒΆ
devices.forms._get_secret(number_of_symbols=16)[source]ΒΆ

Generates a secret with the number of symbols provided.

Parameters:

number_of_symbols (int) – Number of symbols of the generated secret. Defaults to 16.

Returns:

The generated secret.

Return type:

str

class devices.forms.CredentialDownloadForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: django.forms.Form

Form to download a credential.

password[source]ΒΆ
confirm_password[source]ΒΆ
clean()[source]ΒΆ

Checks if the passwords match and if the password is long enough.

Return type:

dict[str, Any]

class devices.forms.BaseCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: django.forms.Form

Base form for issuing credentials.

Parameters:
common_name[source]ΒΆ
pseudonym[source]ΒΆ
domain_component[source]ΒΆ
serial_number[source]ΒΆ
validity[source]ΒΆ
device[source]ΒΆ
clean_common_name()[source]ΒΆ

Checks the common name.

Return type:

str

clean_validity()[source]ΒΆ

Checks the validity.

Return type:

int

class devices.forms.BaseServerCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: BaseCredentialForm

Base form for issuing server credentials.

Parameters:
ipv4_addresses[source]ΒΆ
ipv6_addresses[source]ΒΆ
domain_names[source]ΒΆ
clean_ipv4_addresses()[source]ΒΆ

Checks the IPv4 addresses.

Return type:

list[ipaddress.IPv4Address]

clean_ipv6_addresses()[source]ΒΆ

Checks the IPv6 addresses.

Return type:

list[ipaddress.IPv6Address]

clean_domain_names()[source]ΒΆ

Checks the domain names.

Return type:

list[str]

clean()[source]ΒΆ

Ensures at least one SAN entry is set.

Return type:

dict[str, Any]

class devices.forms.IssueDomainCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: BaseCredentialForm

Form to issue a new domain credential.

Parameters:
class devices.forms.IssueTlsClientCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: BaseCredentialForm

Form to issue a new TLS client credential.

Parameters:
class devices.forms.IssueTlsServerCredentialForm(*args, device, **kwargs)[source]ΒΆ

Bases: BaseServerCredentialForm

Form to issue a new TLS server credential.

Parameters:
class devices.forms.ApplicationUriFormMixin(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: django.forms.Form

Adds a application_uri field to the form.

application_uri[source]ΒΆ
clean_application_uri()[source]ΒΆ

Checks if the application uri was set properly.

Returns:

The application uri.

Return type:

str

class devices.forms.IssueOpcUaClientCredentialForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: ApplicationUriFormMixin, BaseCredentialForm

Form to issue a new OPC UA client credential.

class devices.forms.IssueOpcUaServerCredentialForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: ApplicationUriFormMixin, BaseServerCredentialForm

Form to issue a new OPC UA server credential.

class devices.forms.BrowserLoginForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: django.forms.Form

Form for the browser login via OTP for remote credential download.

otp[source]ΒΆ
clean()[source]ΒΆ

Cleans the form data, extracting the credential ID and OTP.

Return type:

dict[str, Any]

class devices.forms.RevokeIssuedCredentialForm[source]ΒΆ

Bases: django.forms.ModelForm[pki.models.certificate.RevokedCertificateModel]

Form to revoke a specific issued credential.

class Meta[source]ΒΆ

Meta class configuration.

model[source]ΒΆ
fields = ('revocation_reason',)[source]ΒΆ
class devices.forms.RevokeDevicesForm[source]ΒΆ

Bases: django.forms.ModelForm[pki.models.certificate.RevokedCertificateModel]

Form to revoke a issued credentials associated with a specific device.

class Meta[source]ΒΆ

Meta class configuration.

model[source]ΒΆ
fields = ('revocation_reason',)[source]ΒΆ
pks[source]ΒΆ
class devices.forms.DeleteDevicesForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: django.forms.Form

Form to delete the requested devices.

pks[source]ΒΆ
class devices.forms.NoOnboardingCreateForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

Form for device or OPC UA GDS object creation without onboarding.

Parameters:
  • args (Any)

  • kwargs (Any)

common_name[source]ΒΆ
serial_number[source]ΒΆ
domain_queryset: django.db.models.query.QuerySet[pki.models.domain.DomainModel][source]ΒΆ
domain[source]ΒΆ
no_onboarding_pki_protocols[source]ΒΆ
helper[source]ΒΆ
clean_common_name()[source]ΒΆ

Validates the device name, i.e. checks if it is unique.

Parameters:

common_name – The desired name of the new device.

Returns:

The device name if it passed the checks.

Return type:

str

save(device_type)[source]ΒΆ

Stores the form as devie model object in the db.

Parameters:

device_type (devices.models.DeviceModel.DeviceType) – The device type to set. Defaults to None.

Returns:

_description_

Return type:

devices.models.DeviceModel

class devices.forms.OnboardingCreateForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

Form for device or OPC UA GDS object creation with onboarding.

Parameters:
  • args (Any)

  • kwargs (Any)

common_name[source]ΒΆ
serial_number[source]ΒΆ
domain_queryset: django.db.models.query.QuerySet[pki.models.domain.DomainModel][source]ΒΆ
domain[source]ΒΆ
onboarding_protocol[source]ΒΆ
onboarding_pki_protocols[source]ΒΆ
helper[source]ΒΆ
clean_common_name()[source]ΒΆ

Validates the device name, i.e. checks if it is unique.

Parameters:

common_name – The desired name of the new device.

Returns:

The device name if it passed the checks.

Return type:

str

save(device_type)[source]ΒΆ

Stores the form as device model object in the db.

Parameters:

device_type (devices.models.DeviceModel.DeviceType) – The device type to set. Defaults to None.

Returns:

_description_

Return type:

devices.models.DeviceModel

class devices.forms.ClmDeviceModelOnboardingForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

CLM Device Model form for devices that use onboarding.

Parameters:
  • args (Any)

  • kwargs (Any)

common_name[source]ΒΆ
serial_number[source]ΒΆ
domain_queryset: django.db.models.query.QuerySet[pki.models.domain.DomainModel][source]ΒΆ
domain[source]ΒΆ
onboarding_protocol[source]ΒΆ
onboarding_status[source]ΒΆ
pki_protocol_cmp[source]ΒΆ
pki_protocol_est[source]ΒΆ
instance: devices.models.DeviceModel[source]ΒΆ
helper[source]ΒΆ
save(onboarding_protocol)[source]ΒΆ

Saves the changes to DB.

Parameters:

onboarding_protocol (devices.models.OnboardingProtocol)

Return type:

None

class devices.forms.ClmDeviceModelNoOnboardingForm(*args, **kwargs)[source]ΒΆ

Bases: django.forms.Form

CLM Device Model form for devices that do not use onboarding.

Parameters:
  • args (Any)

  • kwargs (Any)

common_name[source]ΒΆ
serial_number[source]ΒΆ
domain_queryset: django.db.models.query.QuerySet[pki.models.domain.DomainModel][source]ΒΆ
domain[source]ΒΆ
pki_protocol_cmp[source]ΒΆ
pki_protocol_est[source]ΒΆ
pki_protocol_manual[source]ΒΆ
instance: devices.models.DeviceModel[source]ΒΆ
helper[source]ΒΆ
save()[source]ΒΆ

Saves the changes to DB.

Return type:

None

devices.forms.APP_CERT_PROFILES = [('tls-client', 'TLS-Client Certificate'), ('tls-server', 'TLS-Server Certificate'),...[source]ΒΆ
class devices.forms.ApplicationCertProfileSelectForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]ΒΆ

Bases: django.forms.Form

Allows to select the certificate profile.

app_cert_profiles[source]ΒΆ