Skip to content

Litestar-Users Configuration

litestar_users.config.LitestarUsersConfig dataclass

Bases: Generic[UserT, RoleT]

Configuration class for LitestarUsers.

auth_exclude_paths class-attribute instance-attribute

auth_exclude_paths = field(default_factory=lambda: ['/schema'])

Paths to be excluded from authentication checks.

auth_backend_class instance-attribute

auth_backend_class

The authentication backend to use by Litestar.

auto_commit_transactions class-attribute instance-attribute

auto_commit_transactions = False

Whether to auto_commit transactions. Defaults to False.

secret instance-attribute

secret

Secret string for securely signing tokens.

hash_schemes class-attribute instance-attribute

hash_schemes = field(default_factory=lambda: ['argon2'])

Schemes to use for password encryption.

Defaults to ["argon2"]

session_backend_config class-attribute instance-attribute

session_backend_config = None

Optional backend configuration for session based authentication.

Notes
  • Required if auth_backend_class is SessionAuth.

user_model instance-attribute

user_model

A subclass of a User ORM model.

user_read_dto instance-attribute

user_read_dto

A User model based SQLAlchemy DTO class.

user_update_dto instance-attribute

user_update_dto

A User model based SQLAlchemy DTO class.

role_model class-attribute instance-attribute

role_model = None

A Role ORM model.

Notes
  • Required if role_management_handler_config is set.

role_create_dto class-attribute instance-attribute

role_create_dto = None

A SQLAlchemyDTO based on a Role ORM model.

Notes
  • Required if role_management_handler_config is set.

role_read_dto class-attribute instance-attribute

role_read_dto = None

A SQLAlchemyDTO based on a Role ORM model.

Notes
  • Required if role_management_handler_config is set.

role_update_dto class-attribute instance-attribute

role_update_dto = None

A SQLAlchemyDTO based on a Role ORM model.

Notes
  • Required if role_management_handler_config is set.

user_service_class instance-attribute

user_service_class

A subclass of BaseUserService.

require_verification_on_registration class-attribute instance-attribute

require_verification_on_registration = True

Whether the registration of a new user requires verification. Defaults to True.

auth_handler_config class-attribute instance-attribute

auth_handler_config = None

Optional instance of AuthHandlerConfig. If set, registers the route handler(s) on the app.

Notes
  • At least one route handler config must be set.

current_user_handler_config class-attribute instance-attribute

current_user_handler_config = None

Optional current-user route handler configuration. If set, registers the route handler(s) on the app.

Notes
  • At least one route handler config must be set.

password_reset_handler_config class-attribute instance-attribute

password_reset_handler_config = None

Optional password reset route handler configuration. If set, registers the route handler(s) on the app.

Notes
  • At least one route handler config must be set.

register_handler_config class-attribute instance-attribute

register_handler_config = None

Optional registration/signup route handler configuration. If set, registers the route handler(s) on the app.

Notes
  • At least one route handler config must be set.

role_management_handler_config class-attribute instance-attribute

role_management_handler_config = None

Optional role management route handler configuration. If set, registers the route handler(s) on the app.

Notes
  • At least one route handler config must be set.

user_management_handler_config class-attribute instance-attribute

user_management_handler_config = None

Optional user management route handler configuration. If set, registers the route handler(s) on the app.

Notes
  • At least one route handler config must be set.

verification_handler_config class-attribute instance-attribute

verification_handler_config = None

Optional user verification route handler configuration. If set, registers the route handler(s) on the app.

Notes
  • At least one route handler config must be set.