Skip to content

Commit 19efa52

Browse files
DellaBittachkuang-gjonsimantov
authored
Auth Google IO 23 (#1255)
* initial Auth deprecations * all three platforms build * FirebaseAuth.java and auth_test.cc fixes * format * bundle identifer * removed explicit from CurrentUserBlockListener constructor * added tests, desktop impl, desktop passes * iOS builds and tests pass * android builds and passes tests * [Auth] PhoneAuthCredential support (#1253) Add a new `PhoneAuthCredential` and return it from a new `PhoneAuthProvider::GetCredential` method. Update the `OnVerificationCompleted` method for Phone Auth to push `PhoneAuthCredential` objects to the application. This new PhoneAuthCredential will be used in other new API methods that will introduced later. For now it returns a `sms_code` string on Android platforms. * [Auth] PhoneAuthOptions struct for VerifyPhoneNumber (#1257) Add a new `PhoneAuthProvider::VerifyPhoneNumber` method that takes a `PhoneAuthOptions` structure. For the C++ implementation on Android, update the current `VerifyPhoneNumber` method to call into the new offering. The older Android SDK `VerifyPhoneNumber` method is deprecated and will probably be removed from the Android SDK at Google I/O, so let's fix this before it becomes a problem. * Add new Auth and User methods to replace the deprecated ones (#1264) Adds the methods to replace those that were deprecated in the Auth and User classes. Duplicated every Integration Test so that there's one test for the deprecated API and one test for the new API. **Note:** `User::LinkAndRetreiveveDataWithCredential` has been removed as it has the same functionality as the new `User::LinkWithCredential`. The major changes of this PR are in four different areas: 1. The addition of tests to `integration_test.cc`. 2. The addition of new methods in the User and Auth implementation. 3. The plaform specific functions that close Futures on callbacks. Functions that faciliate `Future<SignInResult>` and `Future<User*>` completions, marshalling native data into those two return types have been two new compatriot versions for `Future<AuthResult>` and `Future<User>` return types. 4. The internal experimental implementation of FederatedAuth for desktop calls into the user's application to facilitate a auth. The class `FederatedAuthProvider` has been expanded with callbacks that support `AuthResult` objects in addition to the deprecated `SignInResult` objects. Fixes b/138788092. * Auth I/O '23 - update other SDK iTests to use new API (#1268) Numerous product SDKs have iTests which interact with Auth. In a previous feature branch change these tests were changed to use `Future<User*> Auth::current_user_DEPRECATED()`, for instance, as the new Auth API wasn't yet written. This PR updates the tests to use the new APIs, such as `Future<AuthResult> Auth::current_user()`. * Default no-op for deprecated virtual function (#1275) `Listener::OnVerificationCompleted(Credential)` is going to be deprecated and should not be required to implement in the derived class. * Fix Doxygen warnings. * Additional docs fixes. * Fix lint warning. * Added readme note about deprecated methods. * Remove "_DEPRECATED" from LinkAndRetrieveDataWithCredential (#1290) * Remove "_DEPRECATED" from LinkAndRetrieveDataWithCredential No need a DEPRECATED suffix since there's no conflict in a new overloaded version of the method. * Fix kUserFn_LinkAndRetrieveDataWithCredential * Format files. --------- Co-authored-by: Jon Simantov <[email protected]> * Auth Google I/0 23 - Update doc examples to use new API (#1271) Update auth user doc examples to use the new Auth API. * Add comparison operator for Auth::User (#1301) * Add comparison operator for Auth::User * Change to use is_valid() * Add tests * format_code * Add != operator * add comments * Add documentation * update TODO * format code --------- Co-authored-by: Jon Simantov <[email protected]> --------- Co-authored-by: chkuang-g <[email protected]> Co-authored-by: Jon Simantov <[email protected]> Co-authored-by: Jon Simantov <[email protected]>
1 parent 8cd2536 commit 19efa52

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4662
-816
lines changed

app_check/integration_test/src/integration_test.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,12 @@ void FirebaseAppCheckTest::TerminateFunctions() {
406406
}
407407

408408
void FirebaseAppCheckTest::SignIn() {
409-
if (auth_->current_user() != nullptr) {
409+
if (auth_->current_user().is_valid()) {
410410
// Already signed in.
411411
return;
412412
}
413413
LogDebug("Signing in.");
414-
firebase::Future<firebase::auth::User*> sign_in_future =
414+
firebase::Future<firebase::auth::AuthResult> sign_in_future =
415415
auth_->SignInAnonymously();
416416
WaitForCompletion(sign_in_future, "SignInAnonymously");
417417
if (sign_in_future.error() != 0) {
@@ -426,15 +426,15 @@ void FirebaseAppCheckTest::SignOut() {
426426
// Auth is not set up.
427427
return;
428428
}
429-
if (auth_->current_user() == nullptr) {
429+
if (!auth_->current_user().is_valid()) {
430430
// Already signed out.
431431
return;
432432
}
433-
if (auth_->current_user()->is_anonymous()) {
433+
if (auth_->current_user().is_anonymous()) {
434434
// If signed in anonymously, delete the anonymous user.
435-
WaitForCompletion(auth_->current_user()->Delete(), "DeleteAnonymousUser");
435+
WaitForCompletion(auth_->current_user().Delete(), "DeleteAnonymousUser");
436436
// If there was a problem deleting the user, try to sign out at least.
437-
if (auth_->current_user()) {
437+
if (auth_->current_user().is_valid()) {
438438
auth_->SignOut();
439439
}
440440
} else {
@@ -443,11 +443,11 @@ void FirebaseAppCheckTest::SignOut() {
443443
auth_->SignOut();
444444

445445
// Wait for the sign-out to finish.
446-
while (auth_->current_user() != nullptr) {
446+
while (auth_->current_user().is_valid()) {
447447
if (ProcessEvents(100)) break;
448448
}
449449
}
450-
EXPECT_EQ(auth_->current_user(), nullptr);
450+
EXPECT_FALSE(auth_->current_user().is_valid());
451451
}
452452

453453
firebase::database::DatabaseReference FirebaseAppCheckTest::CreateWorkingPath(
@@ -559,7 +559,7 @@ TEST_F(FirebaseAppCheckTest, TestSignIn) {
559559
InitializeAppCheckWithDebug();
560560
InitializeApp();
561561
InitializeAuth();
562-
EXPECT_NE(auth_->current_user(), nullptr);
562+
EXPECT_TRUE(auth_->current_user().is_valid());
563563
}
564564

565565
TEST_F(FirebaseAppCheckTest, TestDebugProviderValidToken) {

auth/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ build_flatbuffers("${flatbuffer_schemas}"
5151
# Common source files used by all platforms
5252
set(common_SRCS
5353
src/auth.cc
54+
src/credential.cc
5455
src/common.cc
5556
src/common.h
5657
src/data.h

0 commit comments

Comments
 (0)