harp_apps.dashboard.settings.auth

Inheritance diagram of harp_apps.dashboard.settings.auth

class BasicAuthSettings[source]

Bases: Configurable

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

check(username, password)[source]
classmethod model_always_shown_defaults(data)[source]

This validator overcomes the behaviour of model_dump(exclude_defaults=True, exclude_unset=True) and forces some defaults to be dumped everytime.

algorithm: Annotated[Literal['argon2', 'bcrypt', 'bcrypt_sha256', 'cisco_asa', 'cisco_pix', 'cisco_type7', 'django_bcrypt', 'django_bcrypt_sha256', 'django_des_crypt', 'django_disabled', 'django_pbkdf2_sha1', 'django_pbkdf2_sha256', 'django_salted_md5', 'django_salted_sha1', 'grub_pbkdf2_sha512', 'hex_digest', 'ldap_crypt', 'ldap_md5', 'ldap_plaintext', 'ldap_salted_md5', 'ldap_salted_sha1', 'ldap_salted_sha256', 'ldap_salted_sha512', 'ldap_sha1', 'lmhash', 'md5_crypt', 'msdcc', 'msdcc2', 'mssql2000', 'mssql2005', 'mysql323', 'mysql41', 'nthash', 'oracle10', 'oracle11', 'pbkdf2_sha1', 'pbkdf2_sha256', 'pbkdf2_sha512', 'phpass', 'plain', 'plaintext', 'postgres_md5', 'scram', 'scrypt', 'sha256_crypt', 'sha512_crypt'], BeforeValidator(func=_replace_plain_algorithm_for_bc, json_schema_input_type=PydanticUndefined), FieldInfo(annotation=NoneType, required=False, default='pbkdf2_sha256', description='Hashing algorithm used for passwords.')]
property algorithm_impl
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'algorithm': FieldInfo(annotation=Literal['argon2', 'bcrypt', 'bcrypt_sha256', 'cisco_asa', 'cisco_pix', 'cisco_type7', 'django_bcrypt', 'django_bcrypt_sha256', 'django_des_crypt', 'django_disabled', 'django_pbkdf2_sha1', 'django_pbkdf2_sha256', 'django_salted_md5', 'django_salted_sha1', 'grub_pbkdf2_sha512', 'hex_digest', 'ldap_crypt', 'ldap_md5', 'ldap_plaintext', 'ldap_salted_md5', 'ldap_salted_sha1', 'ldap_salted_sha256', 'ldap_salted_sha512', 'ldap_sha1', 'lmhash', 'md5_crypt', 'msdcc', 'msdcc2', 'mssql2000', 'mssql2005', 'mysql323', 'mysql41', 'nthash', 'oracle10', 'oracle11', 'pbkdf2_sha1', 'pbkdf2_sha256', 'pbkdf2_sha512', 'phpass', 'plain', 'plaintext', 'postgres_md5', 'scram', 'scrypt', 'sha256_crypt', 'sha512_crypt'], required=False, default='pbkdf2_sha256', description='Hashing algorithm used for passwords.', metadata=[BeforeValidator(func=<function _replace_plain_algorithm_for_bc>, json_schema_input_type=PydanticUndefined)]), 'type': FieldInfo(annotation=Literal['basic'], required=False, default=None, description='Authentication type. Only «basic» is supported for now.'), 'users': FieldInfo(annotation=dict[str, User], required=False, default_factory=dict, description='Users list.', metadata=[BeforeValidator(func=<function _load>, json_schema_input_type=PydanticUndefined)])}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

type: Literal['basic']
users: Annotated[dict[str, User], BeforeValidator(func=_load, json_schema_input_type=PydanticUndefined), FieldInfo(annotation=NoneType, required=False, default_factory=dict, description='Users list.')]
class User[source]

Bases: Configurable

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'password': FieldInfo(annotation=str, required=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

password: str