management.formsΒΆ
Forms definition.
Module ContentsΒΆ
- class management.forms.SecurityConfigForm(*args, **kwargs)[source]ΒΆ
Bases:
django.forms.ModelForm[management.models.SecurityConfig]Security configuration model form.
- Parameters:
args (Any)
kwargs (Any)
- FEATURE_TO_FIELDS: ClassVar[dict[type[management.security.features.SecurityFeature], list[str]]][source]ΒΆ
- class management.forms.NotificationConfigForm(*args, **kwargs)[source]ΒΆ
Bases:
django.forms.ModelForm[management.models.NotificationConfig]Form for managing global notification configuration settings.
- Parameters:
args (Any)
kwargs (Any)
- class Meta[source]ΒΆ
Meta configuration for NotificationConfigForm.
- class management.forms.BackupOptionsForm[source]ΒΆ
Bases:
django.forms.ModelForm[management.models.BackupOptions]Form for editing BackupOptions settings.
- class management.forms.IPv4AddressForm(*args, **kwargs)[source]ΒΆ
Bases:
django.forms.FormA form for selecting and updating an IPv4 address.
This form provides an interface for selecting an IPv4 address from a list of Subject Alternative Names (SANs).
- Parameters:
args (Any)
kwargs (Any)
- class management.forms.TlsAddFileImportPkcs12Form(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:
trustpoint.logger.LoggerMixin,django.forms.FormForm for importing an TLS-Server Credential using a PKCS#12 file.
This form allows the user to upload a PKCS#12 file containing the private key and certificate chain, along with an optional password. It validates the uploaded file and its contents.
- clean()[source]ΒΆ
Cleans and validates the entire form.
This method performs additional validation on the cleaned data to ensure all required fields are valid and consistent. It checks the uploaded PKCS#12 file and its password (if provided). Any issues during validation raise appropriate errors.
- Raises:
ValidationError β If the data is invalid, such as when the unique name
is already taken or the PKCS#12 file cannot be read or parsed. β
- Return type:
None
- class management.forms.TlsAddFileImportSeparateFilesForm(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:
trustpoint.logger.LoggerMixin,django.forms.FormForm for importing a TLS-Server Credential using separate files.
This form allows the user to upload a private key file, its password (optional), an TLS certificate file, and an optional certificate chain. The form validates the uploaded files, ensuring they are correctly formatted, within size limits, and not already associated with an existing Issuing CA.
- tls_certificate[source]ΒΆ
The Issuing CA certificate file (.cer, .der, .pem, .p7b, .p7c).
- Type:
FileField
- clean_private_key_file()[source]ΒΆ
Validates the uploaded private key file.
This method checks if the private key file is provided and ensures it meets size constraints. The actual parsing happens in clean() where the password is available.
- Returns:
The raw bytes of the private key file.
- Return type:
bytes
- Raises:
ValidationError β If the private key file is missing or too large.
- clean_tls_certificate()[source]ΒΆ
Validates and parses the uploaded TLS certificate file.
This method ensures the provided TLS certificate file is valid and not already associated with an existing TLS in the database. If the file is too large, corrupted, or already in use, a validation error is raised.
- Returns:
A serializer containing the parsed certificate.
- Return type:
- Raises:
ValidationError β If the file is missing, too large, corrupted, or already
associated with an existing TLS. β
- clean_tls_certificate_chain()[source]ΒΆ
Validates and parses the uploaded TLS certificate chain file.
- Return type:
None | trustpoint_core.serializer.CertificateCollectionSerializer
- clean()[source]ΒΆ
Cleans and validates the form data.
This method performs additional validation on the provided data, such as ensuring the private key file, and certificates are valid. It also activates and saves the TLS certificate if all checks pass.
- Raises:
ValidationError β If the form data is invalid or there is an error during processing.
- Return type:
dict[str, Any] | None
- class management.forms.KeyStorageConfigForm(*args, **kwargs)[source]ΒΆ
Bases:
django.forms.ModelForm[management.models.KeyStorageConfig]Form for configuring cryptographic material storage options.
- Parameters:
args (Any)
kwargs (Any)
- class management.forms.PKCS11ConfigForm(*args, **kwargs)[source]ΒΆ
Bases:
django.forms.FormForm for configuring PKCS#11 settings including HSM PIN and token information.
- Parameters:
args (Any)
kwargs (Any)