31
31
import com .google .firebase .auth .FirebaseUserManager .UserImportRequest ;
32
32
import com .google .firebase .auth .ListUsersPage .DefaultUserSource ;
33
33
import com .google .firebase .auth .ListUsersPage .PageFactory ;
34
- import com .google .firebase .auth .UserRecord .CreateRequest ;
35
- import com .google .firebase .auth .UserRecord .UpdateRequest ;
34
+ import com .google .firebase .auth .UserRecord ;
36
35
import com .google .firebase .auth .internal .FirebaseTokenFactory ;
37
36
import com .google .firebase .internal .CallableOperation ;
38
37
import com .google .firebase .internal .NonNull ;
@@ -320,7 +319,8 @@ private CallableOperation<Void, FirebaseAuthException> revokeRefreshTokensOp(fin
320
319
@ Override
321
320
protected Void execute () throws FirebaseAuthException {
322
321
int currentTimeSeconds = (int ) (System .currentTimeMillis () / 1000 );
323
- UpdateRequest request = new UpdateRequest (uid ).setValidSince (currentTimeSeconds );
322
+ UserRecord .UpdateRequest request =
323
+ new UserRecord .UpdateRequest (uid ).setValidSince (currentTimeSeconds );
324
324
userManager .updateUser (request , jsonFactory );
325
325
return null ;
326
326
}
@@ -512,32 +512,33 @@ protected ListUsersPage execute() throws FirebaseAuthException {
512
512
513
513
/**
514
514
* Creates a new user account with the attributes contained in the specified {@link
515
- * CreateRequest}.
515
+ * UserRecord. CreateRequest}.
516
516
*
517
- * @param request A non-null {@link CreateRequest} instance.
517
+ * @param request A non-null {@link UserRecord. CreateRequest} instance.
518
518
* @return A {@link UserRecord} instance corresponding to the newly created account.
519
519
* @throws NullPointerException if the provided request is null.
520
520
* @throws FirebaseAuthException if an error occurs while creating the user account.
521
521
*/
522
- public UserRecord createUser (@ NonNull CreateRequest request ) throws FirebaseAuthException {
522
+ public UserRecord createUser (@ NonNull UserRecord .CreateRequest request )
523
+ throws FirebaseAuthException {
523
524
return createUserOp (request ).call ();
524
525
}
525
526
526
527
/**
527
- * Similar to {@link #createUser(CreateRequest) } but performs the operation asynchronously.
528
+ * Similar to {@link #createUser} but performs the operation asynchronously.
528
529
*
529
- * @param request A non-null {@link CreateRequest} instance.
530
+ * @param request A non-null {@link UserRecord. CreateRequest} instance.
530
531
* @return An {@code ApiFuture} which will complete successfully with a {@link UserRecord}
531
532
* instance corresponding to the newly created account. If an error occurs while creating the
532
533
* user account, the future throws a {@link FirebaseAuthException}.
533
534
* @throws NullPointerException if the provided request is null.
534
535
*/
535
- public ApiFuture <UserRecord > createUserAsync (@ NonNull CreateRequest request ) {
536
+ public ApiFuture <UserRecord > createUserAsync (@ NonNull UserRecord . CreateRequest request ) {
536
537
return createUserOp (request ).callAsync (firebaseApp );
537
538
}
538
539
539
540
private CallableOperation <UserRecord , FirebaseAuthException > createUserOp (
540
- final CreateRequest request ) {
541
+ final UserRecord . CreateRequest request ) {
541
542
checkNotDestroyed ();
542
543
checkNotNull (request , "create request must not be null" );
543
544
final FirebaseUserManager userManager = getUserManager ();
@@ -552,31 +553,32 @@ protected UserRecord execute() throws FirebaseAuthException {
552
553
553
554
/**
554
555
* Updates an existing user account with the attributes contained in the specified {@link
555
- * UpdateRequest}.
556
+ * UserRecord. UpdateRequest}.
556
557
*
557
- * @param request A non-null {@link UpdateRequest} instance.
558
+ * @param request A non-null {@link UserRecord. UpdateRequest} instance.
558
559
* @return A {@link UserRecord} instance corresponding to the updated user account.
559
560
* @throws NullPointerException if the provided update request is null.
560
561
* @throws FirebaseAuthException if an error occurs while updating the user account.
561
562
*/
562
- public UserRecord updateUser (@ NonNull UpdateRequest request ) throws FirebaseAuthException {
563
+ public UserRecord updateUser (@ NonNull UserRecord .UpdateRequest request )
564
+ throws FirebaseAuthException {
563
565
return updateUserOp (request ).call ();
564
566
}
565
567
566
568
/**
567
- * Similar to {@link #updateUser(UpdateRequest) } but performs the operation asynchronously.
569
+ * Similar to {@link #updateUser} but performs the operation asynchronously.
568
570
*
569
- * @param request A non-null {@link UpdateRequest} instance.
571
+ * @param request A non-null {@link UserRecord. UpdateRequest} instance.
570
572
* @return An {@code ApiFuture} which will complete successfully with a {@link UserRecord}
571
573
* instance corresponding to the updated user account. If an error occurs while updating the
572
574
* user account, the future throws a {@link FirebaseAuthException}.
573
575
*/
574
- public ApiFuture <UserRecord > updateUserAsync (@ NonNull UpdateRequest request ) {
576
+ public ApiFuture <UserRecord > updateUserAsync (@ NonNull UserRecord . UpdateRequest request ) {
575
577
return updateUserOp (request ).callAsync (firebaseApp );
576
578
}
577
579
578
580
private CallableOperation <UserRecord , FirebaseAuthException > updateUserOp (
579
- final UpdateRequest request ) {
581
+ final UserRecord . UpdateRequest request ) {
580
582
checkNotDestroyed ();
581
583
checkNotNull (request , "update request must not be null" );
582
584
final FirebaseUserManager userManager = getUserManager ();
@@ -636,7 +638,8 @@ private CallableOperation<Void, FirebaseAuthException> setCustomUserClaimsOp(
636
638
return new CallableOperation <Void , FirebaseAuthException >() {
637
639
@ Override
638
640
protected Void execute () throws FirebaseAuthException {
639
- final UpdateRequest request = new UpdateRequest (uid ).setCustomClaims (claims );
641
+ final UserRecord .UpdateRequest request =
642
+ new UserRecord .UpdateRequest (uid ).setCustomClaims (claims );
640
643
userManager .updateUser (request , jsonFactory );
641
644
return null ;
642
645
}
@@ -917,18 +920,6 @@ public ApiFuture<String> generateSignInWithEmailLinkAsync(
917
920
.callAsync (firebaseApp );
918
921
}
919
922
920
- FirebaseApp getFirebaseApp () {
921
- return this .firebaseApp ;
922
- }
923
-
924
- FirebaseTokenVerifier getCookieVerifier () {
925
- return this .cookieVerifier .get ();
926
- }
927
-
928
- FirebaseUserManager getUserManager () {
929
- return this .userManager .get ();
930
- }
931
-
932
923
private CallableOperation <String , FirebaseAuthException > generateEmailActionLinkOp (
933
924
final EmailLinkType type , final String email , final ActionCodeSettings settings ) {
934
925
checkNotDestroyed ();
@@ -945,6 +936,98 @@ protected String execute() throws FirebaseAuthException {
945
936
};
946
937
}
947
938
939
+ /**
940
+ * Creates a new provider OIDC Auth config with the attributes contained in the specified {@link
941
+ * OidcProviderConfig.CreateRequest}.
942
+ *
943
+ * @param request A non-null {@link OidcProviderConfig.CreateRequest} instance.
944
+ * @return An {@link OidcProviderConfig} instance corresponding to the newly created provider
945
+ * config.
946
+ * @throws NullPointerException if the provided request is null.
947
+ * @throws FirebaseAuthException if an error occurs while creating the provider config.
948
+ */
949
+ public OidcProviderConfig createOidcProviderConfig (
950
+ @ NonNull OidcProviderConfig .CreateRequest request ) throws FirebaseAuthException {
951
+ return createOidcProviderConfigOp (request ).call ();
952
+ }
953
+
954
+ /**
955
+ * Similar to {@link #createOidcProviderConfig} but performs the operation asynchronously.
956
+ *
957
+ * @param request A non-null {@link OidcProviderConfig.CreateRequest} instance.
958
+ * @return An {@code ApiFuture} which will complete successfully with a {@link OidcProviderConfig}
959
+ * instance corresponding to the newly created provider config. If an error occurs while
960
+ * creating the provider config, the future throws a {@link FirebaseAuthException}.
961
+ * @throws NullPointerException if the provided request is null.
962
+ */
963
+ public ApiFuture <OidcProviderConfig > createOidcProviderConfigAsync (
964
+ @ NonNull OidcProviderConfig .CreateRequest request ) {
965
+ return createOidcProviderConfigOp (request ).callAsync (firebaseApp );
966
+ }
967
+
968
+ private CallableOperation <OidcProviderConfig , FirebaseAuthException >
969
+ createOidcProviderConfigOp (final OidcProviderConfig .CreateRequest request ) {
970
+ checkNotDestroyed ();
971
+ checkNotNull (request , "create request must not be null" );
972
+ final FirebaseUserManager userManager = getUserManager ();
973
+ return new CallableOperation <OidcProviderConfig , FirebaseAuthException >() {
974
+ @ Override
975
+ protected OidcProviderConfig execute () throws FirebaseAuthException {
976
+ return userManager .createOidcProviderConfig (request );
977
+ }
978
+ };
979
+ }
980
+
981
+ /**
982
+ * Deletes the provider config identified by the specified provider ID.
983
+ *
984
+ * @param providerId A provider ID string.
985
+ * @throws IllegalArgumentException If the provider ID string is null or empty.
986
+ * @throws FirebaseAuthException If an error occurs while deleting the provider config.
987
+ */
988
+ public void deleteProviderConfig (@ NonNull String providerId ) throws FirebaseAuthException {
989
+ deleteProviderConfigOp (providerId ).call ();
990
+ }
991
+
992
+ /**
993
+ * Similar to {@link #deleteProviderConfig} but performs the operation asynchronously.
994
+ *
995
+ * @param providerId A provider ID string.
996
+ * @return An {@code ApiFuture} which will complete successfully when the specified provider
997
+ * config has been deleted. If an error occurs while deleting the provider config, the future
998
+ * throws a {@link FirebaseAuthException}.
999
+ * @throws IllegalArgumentException If the provider ID string is null or empty.
1000
+ */
1001
+ public ApiFuture <Void > deleteProviderConfigAsync (String providerId ) {
1002
+ return deleteProviderConfigOp (providerId ).callAsync (firebaseApp );
1003
+ }
1004
+
1005
+ private CallableOperation <Void , FirebaseAuthException > deleteProviderConfigOp (
1006
+ final String providerId ) {
1007
+ checkNotDestroyed ();
1008
+ checkArgument (!Strings .isNullOrEmpty (providerId ), "provider ID must not be null or empty" );
1009
+ final FirebaseUserManager userManager = getUserManager ();
1010
+ return new CallableOperation <Void , FirebaseAuthException >() {
1011
+ @ Override
1012
+ protected Void execute () throws FirebaseAuthException {
1013
+ userManager .deleteProviderConfig (providerId );
1014
+ return null ;
1015
+ }
1016
+ };
1017
+ }
1018
+
1019
+ FirebaseApp getFirebaseApp () {
1020
+ return this .firebaseApp ;
1021
+ }
1022
+
1023
+ FirebaseTokenVerifier getCookieVerifier () {
1024
+ return this .cookieVerifier .get ();
1025
+ }
1026
+
1027
+ FirebaseUserManager getUserManager () {
1028
+ return this .userManager .get ();
1029
+ }
1030
+
948
1031
protected <T > Supplier <T > threadSafeMemoize (final Supplier <T > supplier ) {
949
1032
return Suppliers .memoize (
950
1033
new Supplier <T >() {
0 commit comments