AuthUsernameIdentifierPolicy class final

Strict policy for username canonicalization and email intent resolution.

Any input containing @ is treated exclusively as email intent. An invalid email therefore never falls back to the username namespace. Usernames can never contain @, even when a custom allowed-character expression would otherwise accept it.

Constructors

AuthUsernameIdentifierPolicy({AuthUsernameCaseCanonicalization caseCanonicalization = AuthUsernameCaseCanonicalization.lowercase, int minimumLength = 3, int maximumLength = 32, String allowedCharactersPattern = '[a-z0-9._-]', bool requireDottedEmailDomain = true})
Creates username and email validation rules.

Properties

allowedCharactersPattern → String
Regular-expression character class allowed in usernames.
final
caseCanonicalization → AuthUsernameCaseCanonicalization
Case transformation applied to usernames.
final
hashCode → int
The hash code for this object.
no setterinherited
maximumLength → int
Maximum username length in Unicode code points.
final
minimumLength → int
Minimum username length in Unicode code points.
final
requireDottedEmailDomain → bool
Whether email domains must contain a dot-separated suffix.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

normalizeEmail(String input) → String?
Normalizes an email identifier, or returns null when it is invalid.
normalizeUsername(String input) → String?
Normalizes a username, or returns null when it is invalid.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(String input) → AuthUsernameIdentifier?
Resolves input into its unambiguous username or email namespace.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited