AuthConfig constructor
AuthConfig({
- int maxAllowedEmailSignInAttempts = 5,
- Duration emailSignInFailureResetTime = const Duration(minutes: 5),
- bool enableUserImages = true,
- bool importUserImagesFromGoogleSignIn = true,
- int userImageSize = 256,
- UserImageType userImageFormat = UserImageType.jpg,
- int userImageQuality = 70,
- UserImageGenerator userImageGenerator = defaultUserImageGenerator,
- bool userCanEditUserImage = true,
- bool userCanEditUserName = true,
- bool userCanEditFullName = false,
- bool userCanSeeUserName = true,
- bool userCanSeeFullName = true,
- Duration userInfoCacheLifetime = const Duration(minutes: 1),
- UserInfoCreationCallback? onUserWillBeCreated,
- UserInfoUpdateCallback? onUserCreated,
- UserInfoUpdateCallback? onUserUpdated,
- SendPasswordResetEmailCallback? sendPasswordResetEmail,
- SendValidationEmailCallback? sendValidationEmail,
- int validationCodeLength = 8,
- Duration passwordResetExpirationTime = const Duration(minutes: 15),
- bool extraSaltyHash = true,
- String firebaseServiceAccountKeyJson = 'config/firebase_service_account_key.json',
- int maxPasswordLength = 128,
- int minPasswordLength = 8,
- bool allowUnsecureRandom = false,
- PasswordHashGenerator passwordHashGenerator = defaultGeneratePasswordHash,
- PasswordHashValidator passwordHashValidator = defaultValidatePasswordHash,
Creates a new Auth configuration. Use the set method to replace the
default settings. Defaults to config/firebase_service_account_key.json
.
Implementation
AuthConfig({
this.maxAllowedEmailSignInAttempts = 5,
this.emailSignInFailureResetTime = const Duration(minutes: 5),
this.enableUserImages = true,
this.importUserImagesFromGoogleSignIn = true,
this.userImageSize = 256,
this.userImageFormat = UserImageType.jpg,
this.userImageQuality = 70,
this.userImageGenerator = defaultUserImageGenerator,
this.userCanEditUserImage = true,
this.userCanEditUserName = true,
this.userCanEditFullName = false,
this.userCanSeeUserName = true,
this.userCanSeeFullName = true,
this.userInfoCacheLifetime = const Duration(minutes: 1),
this.onUserWillBeCreated,
this.onUserCreated,
this.onUserUpdated,
this.sendPasswordResetEmail,
this.sendValidationEmail,
this.validationCodeLength = 8,
this.passwordResetExpirationTime = const Duration(minutes: 15),
this.extraSaltyHash = true,
this.firebaseServiceAccountKeyJson =
'config/firebase_service_account_key.json',
this.maxPasswordLength = 128,
this.minPasswordLength = 8,
this.allowUnsecureRandom = false,
this.passwordHashGenerator = defaultGeneratePasswordHash,
this.passwordHashValidator = defaultValidatePasswordHash,
}) {
if (validationCodeLength < 8) {
stderr.writeln(
'WARNING: Validation code length is less than 8. This makes the validation code more susceptible to brute force attacks.',
);
}
if (validationCodeLength < 4) {
throw ArgumentError.value(
validationCodeLength,
'validationCodeLength',
'must be at least 4',
);
}
}