Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ec8d519
feat(auth): PasswordPolicy Support
MichaelVerdon Jun 19, 2025
55e8400
feat: license headers and impl start
MichaelVerdon Jun 19, 2025
1823649
feat: Password Policy Logic finished
MichaelVerdon Jun 20, 2025
226fcde
feat: add unit tests
MichaelVerdon Jun 20, 2025
5ab2b37
feat: expose method
MichaelVerdon Jun 20, 2025
1d23e57
fix: rename method
MichaelVerdon Jun 20, 2025
928f5e2
chore: refactor, make explicit as possible
MichaelVerdon Jun 20, 2025
8060d70
feat: add e2e
MichaelVerdon Jun 26, 2025
21c9ad1
feat: change field types
MichaelVerdon Jun 26, 2025
7d8d60f
chore: add license headers
MichaelVerdon Jun 26, 2025
c21b3bc
chore: fix analyze
MichaelVerdon Jun 26, 2025
70b7e49
chore: format-ci
MichaelVerdon Jun 26, 2025
1be1baa
chore: remove duplicate
MichaelVerdon Jun 26, 2025
b0ef9e2
chore: undo accidental deletion
MichaelVerdon Jun 26, 2025
9936e46
chore: fix analyze
MichaelVerdon Jun 26, 2025
9c8554d
fix: expose apis
MichaelVerdon Jun 26, 2025
de5e14d
chore: formatting
MichaelVerdon Jun 26, 2025
0555134
chore: sort dependencies alphabeticaly
MichaelVerdon Jun 26, 2025
b13f33e
chore: more e2e tests
MichaelVerdon Jun 26, 2025
03e3f8d
chore: refactor
MichaelVerdon Jul 17, 2025
0b78622
chore: refactor
MichaelVerdon Jul 17, 2025
69391a1
chore: refactor
MichaelVerdon Jul 17, 2025
87899f8
chore: fix
MichaelVerdon Jul 18, 2025
0e68d2b
chore: create internals
MichaelVerdon Jul 21, 2025
fa7c0c2
chore: run format
MichaelVerdon Jul 21, 2025
27f3476
fix: shift into platform_interface
MichaelVerdon Jul 24, 2025
15705e1
fix: readd method
MichaelVerdon Jul 24, 2025
18c5d51
fix: pass apikey through method instead
MichaelVerdon Jul 24, 2025
cfb5190
format: melos run format
MichaelVerdon Jul 24, 2025
3cd99e1
chore: remove import
MichaelVerdon Jul 24, 2025
4871d79
chore: keep internals internal
MichaelVerdon Jul 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: shift into platform_interface
  • Loading branch information
MichaelVerdon committed Jul 24, 2025
commit 27f34768a1790d946e736f348500c0917486b7dd
20 changes: 5 additions & 15 deletions packages/firebase_auth/firebase_auth/lib/firebase_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:flutter/foundation.dart';

// Import internal password policy classes for implementation
import 'src/internal.dart'
show
PasswordPolicy,
PasswordPolicyApi,
PasswordPolicyImpl,
PasswordValidationStatus;

export 'package:firebase_auth_platform_interface/firebase_auth_platform_interface.dart'
show
FirebaseAuthException,
Expand Down Expand Up @@ -68,16 +60,14 @@ export 'package:firebase_auth_platform_interface/firebase_auth_platform_interfac
RecaptchaVerifierOnExpired,
RecaptchaVerifierOnError,
RecaptchaVerifierSize,
RecaptchaVerifierTheme;
RecaptchaVerifierTheme,
PasswordPolicy,
PasswordPolicyApi,
PasswordPolicyImpl,
PasswordValidationStatus;
export 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart'
show FirebaseException;

export 'src/password_policy/password_validation_status.dart';
// Remove internal class exports - these should not be part of public API
// export 'src/password_policy/password_policy.dart';
// export 'src/password_policy/password_policy_api.dart';
// export 'src/password_policy/password_policy_impl.dart';

part 'src/confirmation_result.dart';
part 'src/firebase_auth.dart';
part 'src/multi_factor.dart';
Expand Down
17 changes: 0 additions & 17 deletions packages/firebase_auth/firebase_auth/lib/src/firebase_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -858,23 +858,6 @@ class FirebaseAuth extends FirebasePluginPlatform {
/// - **operation-not-allowed**:
/// - Thrown if email/password accounts are not enabled. Enable
/// email/password accounts in the Firebase Console, under the Auth tab.
Future<PasswordValidationStatus> validatePassword(
FirebaseAuth auth,
String? password,
) async {
if (password == null || password.isEmpty) {
throw FirebaseAuthException(
code: 'invalid-password',
message: 'Password cannot be null or empty',
);
}
PasswordPolicyApi passwordPolicyApi = PasswordPolicyApi(auth);
PasswordPolicy passwordPolicy =
await passwordPolicyApi.fetchPasswordPolicy();
PasswordPolicyImpl passwordPolicyImpl = PasswordPolicyImpl(passwordPolicy);
return passwordPolicyImpl.isPasswordValid(password);
}

@override
String toString() {
return 'FirebaseAuth(app: ${app.name})';
Expand Down
16 changes: 0 additions & 16 deletions packages/firebase_auth/firebase_auth/lib/src/internal.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
// Import internal password policy classes for testing
import 'package:firebase_auth/src/internal.dart';

import './mock.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ export 'src/providers/play_games_auth.dart';
export 'src/types.dart';
export 'src/user_info.dart';
export 'src/user_metadata.dart';
export 'src/password_policy/password_policy_api.dart';
export 'src/password_policy/password_policy_impl.dart';
export 'src/password_policy/password_policy.dart';
export 'src/password_policy/password_validation_status.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:firebase_auth/firebase_auth.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'dart:core';
import 'password_policy.dart';

class PasswordPolicyApi {
final FirebaseAuth _auth;
final String _apiKey;
final String _apiUrl =
'https://identitytoolkit.googleapis.com/v2/passwordPolicy?key=';

PasswordPolicyApi(this._auth);
PasswordPolicyApi(this._apiKey);

final int _schemaVersion = 1;

Future<PasswordPolicy> fetchPasswordPolicy() async {
try {
final String _apiKey = _auth.app.options.apiKey;
final response = await http.get(Uri.parse('$_apiUrl$_apiKey'));
if (response.statusCode == 200) {
final policy = json.decode(response.body);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies:
firebase_core: ^3.15.1
flutter:
sdk: flutter
http: ^1.1.0
meta: ^1.8.0
plugin_platform_interface: ^2.1.3

Expand Down
Loading