Skip to content

FastAuthConfig

fastauth.config.FastAuthConfig

FastAuthConfig(__pydantic_self__, _case_sensitive=None, _nested_model_default_partial_update=None, _env_prefix=None, _env_file=ENV_FILE_SENTINEL, _env_file_encoding=None, _env_ignore_empty=None, _env_nested_delimiter=None, _env_parse_none_str=None, _env_parse_enums=None, _cli_prog_name=None, _cli_parse_args=None, _cli_settings_source=None, _cli_parse_none_str=None, _cli_hide_none_type=None, _cli_avoid_json=None, _cli_enforce_required=None, _cli_use_class_docs_for_groups=None, _cli_exit_on_error=None, _cli_prefix=None, _cli_flag_prefix_char=None, _cli_implicit_flags=None, _cli_ignore_unknown_args=None, _cli_kebab_case=None, _secrets_dir=None, **values)

Bases: BaseSettings

Source code in .venv/lib/python3.10/site-packages/pydantic_settings/main.py
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
def __init__(
    __pydantic_self__,
    _case_sensitive: bool | None = None,
    _nested_model_default_partial_update: bool | None = None,
    _env_prefix: str | None = None,
    _env_file: DotenvType | None = ENV_FILE_SENTINEL,
    _env_file_encoding: str | None = None,
    _env_ignore_empty: bool | None = None,
    _env_nested_delimiter: str | None = None,
    _env_parse_none_str: str | None = None,
    _env_parse_enums: bool | None = None,
    _cli_prog_name: str | None = None,
    _cli_parse_args: bool | list[str] | tuple[str, ...] | None = None,
    _cli_settings_source: CliSettingsSource[Any] | None = None,
    _cli_parse_none_str: str | None = None,
    _cli_hide_none_type: bool | None = None,
    _cli_avoid_json: bool | None = None,
    _cli_enforce_required: bool | None = None,
    _cli_use_class_docs_for_groups: bool | None = None,
    _cli_exit_on_error: bool | None = None,
    _cli_prefix: str | None = None,
    _cli_flag_prefix_char: str | None = None,
    _cli_implicit_flags: bool | None = None,
    _cli_ignore_unknown_args: bool | None = None,
    _cli_kebab_case: bool | None = None,
    _secrets_dir: PathType | None = None,
    **values: Any,
) -> None:
    # Uses something other than `self` the first arg to allow "self" as a settable attribute
    super().__init__(
        **__pydantic_self__._settings_build_values(
            values,
            _case_sensitive=_case_sensitive,
            _nested_model_default_partial_update=_nested_model_default_partial_update,
            _env_prefix=_env_prefix,
            _env_file=_env_file,
            _env_file_encoding=_env_file_encoding,
            _env_ignore_empty=_env_ignore_empty,
            _env_nested_delimiter=_env_nested_delimiter,
            _env_parse_none_str=_env_parse_none_str,
            _env_parse_enums=_env_parse_enums,
            _cli_prog_name=_cli_prog_name,
            _cli_parse_args=_cli_parse_args,
            _cli_settings_source=_cli_settings_source,
            _cli_parse_none_str=_cli_parse_none_str,
            _cli_hide_none_type=_cli_hide_none_type,
            _cli_avoid_json=_cli_avoid_json,
            _cli_enforce_required=_cli_enforce_required,
            _cli_use_class_docs_for_groups=_cli_use_class_docs_for_groups,
            _cli_exit_on_error=_cli_exit_on_error,
            _cli_prefix=_cli_prefix,
            _cli_flag_prefix_char=_cli_flag_prefix_char,
            _cli_implicit_flags=_cli_implicit_flags,
            _cli_ignore_unknown_args=_cli_ignore_unknown_args,
            _cli_kebab_case=_cli_kebab_case,
            _secrets_dir=_secrets_dir,
        )
    )

model_config class-attribute

model_config = SettingsConfigDict(extra='forbid', arbitrary_types_allowed=True, validate_default=True, case_sensitive=False, env_prefix='', nested_model_default_partial_update=False, env_file=None, env_file_encoding=None, env_ignore_empty=False, env_nested_delimiter=None, env_parse_none_str=None, env_parse_enums=None, cli_prog_name=None, cli_parse_args=None, cli_parse_none_str=None, cli_hide_none_type=False, cli_avoid_json=False, cli_enforce_required=False, cli_use_class_docs_for_groups=False, cli_exit_on_error=True, cli_prefix='', cli_flag_prefix_char='-', cli_implicit_flags=False, cli_ignore_unknown_args=False, cli_kebab_case=False, json_file=None, json_file_encoding=None, yaml_file=None, yaml_file_encoding=None, toml_file=None, secrets_dir=None, protected_namespaces=('model_validate', 'model_dump', 'settings_customise_sources'), enable_decoding=True)

ACCESS_TOKEN_MAX_AGE class-attribute instance-attribute

ACCESS_TOKEN_MAX_AGE = 60 * 60 * 24

REFRESH_TOKEN_MAX_AGE class-attribute instance-attribute

REFRESH_TOKEN_MAX_AGE = 60 * 60 * 24 * 20

TOKEN_LOCATIONS class-attribute instance-attribute

TOKEN_LOCATIONS = ['headers', 'cookies']

ENABLE_REFRESH_TOKEN class-attribute instance-attribute

ENABLE_REFRESH_TOKEN = True

JWT_SECRET class-attribute instance-attribute

JWT_SECRET = ''

JWT_ALGORITHM class-attribute instance-attribute

JWT_ALGORITHM = 'HS256'

JWT_DEFAULT_AUDIENCE class-attribute instance-attribute

JWT_DEFAULT_AUDIENCE = ['fastauth:auth']

JWT_DEFAULT_VERIFICATION_AUDIENCE class-attribute instance-attribute

JWT_DEFAULT_VERIFICATION_AUDIENCE = ['fastauth:verification']

JWT_DEFAULT_RESET_AUDIENCE class-attribute instance-attribute

JWT_DEFAULT_RESET_AUDIENCE = ['fastauth:reset']

JWT_DEFAULT_STATE_AUDIENCE class-attribute instance-attribute

JWT_DEFAULT_STATE_AUDIENCE = ['fastauth:oauth-state']

JWT_ACCESS_TOKEN_MAX_AGE class-attribute instance-attribute

JWT_ACCESS_TOKEN_MAX_AGE = Field(default_factory=lambda self: get('ACCESS_TOKEN_MAX_AGE'))

JWT_REFRESH_TOKEN_MAX_AGE class-attribute instance-attribute

JWT_REFRESH_TOKEN_MAX_AGE = Field(default_factory=lambda self: get('REFRESH_TOKEN_MAX_AGE'))

JWT_VERIFY_TOKEN_MAX_AGE class-attribute instance-attribute

JWT_VERIFY_TOKEN_MAX_AGE = 60 * 60

JWT_RESET_TOKEN_MAX_AGE class-attribute instance-attribute

JWT_RESET_TOKEN_MAX_AGE = 60 * 60

JWT_STATE_TOKEN_MAX_AGE class-attribute instance-attribute

JWT_STATE_TOKEN_MAX_AGE = 60 * 60

COOKIE_ACCESS_TOKEN_NAME class-attribute instance-attribute

COOKIE_ACCESS_TOKEN_NAME = 'access_token_cookie'

COOKIE_REFRESH_TOKEN_NAME class-attribute instance-attribute

COOKIE_REFRESH_TOKEN_NAME = 'refresh_token_cookie'

COOKIE_ACCESS_TOKEN_MAX_AGE class-attribute instance-attribute

COOKIE_ACCESS_TOKEN_MAX_AGE = Field(default_factory=lambda self: get('ACCESS_TOKEN_MAX_AGE'))

COOKIE_REFRESH_TOKEN_MAX_AGE class-attribute instance-attribute

COOKIE_REFRESH_TOKEN_MAX_AGE = Field(default_factory=lambda self: get('REFRESH_TOKEN_MAX_AGE'))

COOKIE_DEFAULT_PATH class-attribute instance-attribute

COOKIE_DEFAULT_PATH = '/'

COOKIE_DEFAULT_DOMAIN class-attribute instance-attribute

COOKIE_DEFAULT_DOMAIN = None

COOKIE_DEFAULT_SECURE class-attribute instance-attribute

COOKIE_DEFAULT_SECURE = False

COOKIE_DEFAULT_HTTPONLY class-attribute instance-attribute

COOKIE_DEFAULT_HTTPONLY = False

COOKIE_DEFAULT_SAMESITE class-attribute instance-attribute

COOKIE_DEFAULT_SAMESITE = 'lax'

ROUTER_AUTH_DEFAULT_PREFIX class-attribute instance-attribute

ROUTER_AUTH_DEFAULT_PREFIX = '/auth'

TOKEN_LOGIN_URL class-attribute instance-attribute

TOKEN_LOGIN_URL = '/token/login'

TOKEN_LOGOUT_URL class-attribute instance-attribute

TOKEN_LOGOUT_URL = '/token/logout'

TOKEN_REFRESH_URL class-attribute instance-attribute

TOKEN_REFRESH_URL = '/token/refresh'

ROUTER_USERS_DEFAULT_PREFIX class-attribute instance-attribute

ROUTER_USERS_DEFAULT_PREFIX = '/users'

ROUTER_ROLES_DEFAULT_PREFIX class-attribute instance-attribute

ROUTER_ROLES_DEFAULT_PREFIX = '/roles'

ROUTER_PERMISSIONS_DEFAULT_PREFIX class-attribute instance-attribute

ROUTER_PERMISSIONS_DEFAULT_PREFIX = '/permissions'

USER_LOGIN_FIELDS class-attribute instance-attribute

USER_LOGIN_FIELDS = 'email'

USER_FIELDS_IN_TOKEN class-attribute instance-attribute

USER_FIELDS_IN_TOKEN = ['email', 'id', 'is_active', 'is_verified']

ADMIN_DEFAULT_ROLE class-attribute instance-attribute

ADMIN_DEFAULT_ROLE = 'Admin'

USER_DEFAULT_ROLE class-attribute instance-attribute

USER_DEFAULT_ROLE = 'User'

USER_DEFAULT_IS_ACTIVE class-attribute instance-attribute

USER_DEFAULT_IS_ACTIVE = None

USER_DEFAULT_IS_VERIFIED class-attribute instance-attribute

USER_DEFAULT_IS_VERIFIED = None

settings_customise_sources classmethod

settings_customise_sources(settings_cls, init_settings, env_settings, dotenv_settings, file_secret_settings)

Define the sources and their order for loading the settings values.

Args: settings_cls: The Settings class. init_settings: The InitSettingsSource instance. env_settings: The EnvSettingsSource instance. dotenv_settings: The DotEnvSettingsSource instance. file_secret_settings: The SecretsSettingsSource instance.

Returns: A tuple containing the sources and their order for loading the settings values.

Source code in .venv/lib/python3.10/site-packages/pydantic_settings/main.py
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
@classmethod
def settings_customise_sources(
    cls,
    settings_cls: type[BaseSettings],
    init_settings: PydanticBaseSettingsSource,
    env_settings: PydanticBaseSettingsSource,
    dotenv_settings: PydanticBaseSettingsSource,
    file_secret_settings: PydanticBaseSettingsSource,
) -> tuple[PydanticBaseSettingsSource, ...]:
    """
    Define the sources and their order for loading the settings values.

    Args:
        settings_cls: The Settings class.
        init_settings: The `InitSettingsSource` instance.
        env_settings: The `EnvSettingsSource` instance.
        dotenv_settings: The `DotEnvSettingsSource` instance.
        file_secret_settings: The `SecretsSettingsSource` instance.

    Returns:
        A tuple containing the sources and their order for loading the settings values.
    """
    return init_settings, env_settings, dotenv_settings, file_secret_settings