devices.modelsΒΆ
This modules contains all models specific to the device abstractions.
ClassesΒΆ
The DeviceModel. |
|
Model for all credentials and certificates that have been issued or requested by the Trustpoint. |
|
Model to associate a credential model with an OTP and token for unauthenticated remoted download. |
Module ContentsΒΆ
- class devices.models.DeviceModel(*args, **kwargs)[source]ΒΆ
Bases:
util.db.CustomDeleteActionModelThe DeviceModel.
- class DeviceType(*args, **kwds)[source]ΒΆ
Bases:
django.db.models.IntegerChoicesEnum for device type.
- class devices.models.IssuedCredentialModel(*args, **kwargs)[source]ΒΆ
Bases:
util.db.CustomDeleteActionModelModel for all credentials and certificates that have been issued or requested by the Trustpoint.
- class IssuedCredentialType(*args, **kwds)[source]ΒΆ
Bases:
django.db.models.IntegerChoicesThe type of the credential.
- revoke()[source]ΒΆ
Revokes all active certificates associated with this credential.
- Return type:
None
- is_valid_domain_credential()[source]ΒΆ
Determines if this issued credential is valid for enrolling new application credentials.
- This method performs the following checks:
The IssuedCredentialModel type must be of type DOMAIN_CREDENTIAL.
The credential must be of type ISSUED_CREDENTIAL.
A primary certificate must exist.
The certificateβs status must be βOKβ.
- Returns:
- A tuple where:
The first value is True if the credential meets all criteria, False otherwise.
The second value is a reason string explaining why the credential is invalid.
- Return type:
tuple[bool, str]
- static get_credential_for_certificate(cert)[source]ΒΆ
Retrieve an IssuedCredentialModel instance for the given certificate.
- Parameters:
cert (cryptography.x509.Certificate) β x509.Certificate to search for.
- Returns:
The corresponding IssuedCredentialModel instance.
- Raises:
ClientCertificateAuthenticationError β if no matching issued credential is found.
- Return type:
- class devices.models.RemoteDeviceCredentialDownloadModel(*args, **kwargs)[source]ΒΆ
Bases:
django.db.models.ModelModel to associate a credential model with an OTP and token for unauthenticated remoted download.
- save(*args, **kwargs)[source]ΒΆ
Generates a new random OTP on initial save of the model.
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- get_otp_display()[source]ΒΆ
Return the OTP in the format βcredential_id.otpβ for display within the admin view.
- Returns:
The str to display.
- Return type:
str