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 ;
@@ -323,7 +322,8 @@ private CallableOperation<Void, FirebaseAuthException> revokeRefreshTokensOp(fin
323
322
@ Override
324
323
protected Void execute () throws FirebaseAuthException {
325
324
int currentTimeSeconds = (int ) (System .currentTimeMillis () / 1000 );
326
- UpdateRequest request = new UpdateRequest (uid ).setValidSince (currentTimeSeconds );
325
+ UserRecord .UpdateRequest request =
326
+ new UserRecord .UpdateRequest (uid ).setValidSince (currentTimeSeconds );
327
327
userManager .updateUser (request , jsonFactory );
328
328
return null ;
329
329
}
@@ -515,32 +515,33 @@ protected ListUsersPage execute() throws FirebaseAuthException {
515
515
516
516
/**
517
517
* Creates a new user account with the attributes contained in the specified {@link
518
- * CreateRequest}.
518
+ * UserRecord. CreateRequest}.
519
519
*
520
- * @param request A non-null {@link CreateRequest} instance.
520
+ * @param request A non-null {@link UserRecord. CreateRequest} instance.
521
521
* @return A {@link UserRecord} instance corresponding to the newly created account.
522
522
* @throws NullPointerException if the provided request is null.
523
523
* @throws FirebaseAuthException if an error occurs while creating the user account.
524
524
*/
525
- public UserRecord createUser (@ NonNull CreateRequest request ) throws FirebaseAuthException {
525
+ public UserRecord createUser (@ NonNull UserRecord .CreateRequest request )
526
+ throws FirebaseAuthException {
526
527
return createUserOp (request ).call ();
527
528
}
528
529
529
530
/**
530
- * Similar to {@link #createUser(CreateRequest) } but performs the operation asynchronously.
531
+ * Similar to {@link #createUser} but performs the operation asynchronously.
531
532
*
532
- * @param request A non-null {@link CreateRequest} instance.
533
+ * @param request A non-null {@link UserRecord. CreateRequest} instance.
533
534
* @return An {@code ApiFuture} which will complete successfully with a {@link UserRecord}
534
535
* instance corresponding to the newly created account. If an error occurs while creating the
535
536
* user account, the future throws a {@link FirebaseAuthException}.
536
537
* @throws NullPointerException if the provided request is null.
537
538
*/
538
- public ApiFuture <UserRecord > createUserAsync (@ NonNull CreateRequest request ) {
539
+ public ApiFuture <UserRecord > createUserAsync (@ NonNull UserRecord . CreateRequest request ) {
539
540
return createUserOp (request ).callAsync (firebaseApp );
540
541
}
541
542
542
543
private CallableOperation <UserRecord , FirebaseAuthException > createUserOp (
543
- final CreateRequest request ) {
544
+ final UserRecord . CreateRequest request ) {
544
545
checkNotDestroyed ();
545
546
checkNotNull (request , "create request must not be null" );
546
547
final FirebaseUserManager userManager = getUserManager ();
@@ -555,31 +556,32 @@ protected UserRecord execute() throws FirebaseAuthException {
555
556
556
557
/**
557
558
* Updates an existing user account with the attributes contained in the specified {@link
558
- * UpdateRequest}.
559
+ * UserRecord. UpdateRequest}.
559
560
*
560
- * @param request A non-null {@link UpdateRequest} instance.
561
+ * @param request A non-null {@link UserRecord. UpdateRequest} instance.
561
562
* @return A {@link UserRecord} instance corresponding to the updated user account.
562
563
* @throws NullPointerException if the provided update request is null.
563
564
* @throws FirebaseAuthException if an error occurs while updating the user account.
564
565
*/
565
- public UserRecord updateUser (@ NonNull UpdateRequest request ) throws FirebaseAuthException {
566
+ public UserRecord updateUser (@ NonNull UserRecord .UpdateRequest request )
567
+ throws FirebaseAuthException {
566
568
return updateUserOp (request ).call ();
567
569
}
568
570
569
571
/**
570
- * Similar to {@link #updateUser(UpdateRequest) } but performs the operation asynchronously.
572
+ * Similar to {@link #updateUser} but performs the operation asynchronously.
571
573
*
572
- * @param request A non-null {@link UpdateRequest} instance.
574
+ * @param request A non-null {@link UserRecord. UpdateRequest} instance.
573
575
* @return An {@code ApiFuture} which will complete successfully with a {@link UserRecord}
574
576
* instance corresponding to the updated user account. If an error occurs while updating the
575
577
* user account, the future throws a {@link FirebaseAuthException}.
576
578
*/
577
- public ApiFuture <UserRecord > updateUserAsync (@ NonNull UpdateRequest request ) {
579
+ public ApiFuture <UserRecord > updateUserAsync (@ NonNull UserRecord . UpdateRequest request ) {
578
580
return updateUserOp (request ).callAsync (firebaseApp );
579
581
}
580
582
581
583
private CallableOperation <UserRecord , FirebaseAuthException > updateUserOp (
582
- final UpdateRequest request ) {
584
+ final UserRecord . UpdateRequest request ) {
583
585
checkNotDestroyed ();
584
586
checkNotNull (request , "update request must not be null" );
585
587
final FirebaseUserManager userManager = getUserManager ();
@@ -639,7 +641,8 @@ private CallableOperation<Void, FirebaseAuthException> setCustomUserClaimsOp(
639
641
return new CallableOperation <Void , FirebaseAuthException >() {
640
642
@ Override
641
643
protected Void execute () throws FirebaseAuthException {
642
- final UpdateRequest request = new UpdateRequest (uid ).setCustomClaims (claims );
644
+ final UserRecord .UpdateRequest request =
645
+ new UserRecord .UpdateRequest (uid ).setCustomClaims (claims );
643
646
userManager .updateUser (request , jsonFactory );
644
647
return null ;
645
648
}
@@ -1054,18 +1057,6 @@ public ApiFuture<String> generateSignInWithEmailLinkAsync(
1054
1057
.callAsync (firebaseApp );
1055
1058
}
1056
1059
1057
- FirebaseApp getFirebaseApp () {
1058
- return this .firebaseApp ;
1059
- }
1060
-
1061
- FirebaseTokenVerifier getCookieVerifier () {
1062
- return this .cookieVerifier .get ();
1063
- }
1064
-
1065
- FirebaseUserManager getUserManager () {
1066
- return this .userManager .get ();
1067
- }
1068
-
1069
1060
private CallableOperation <String , FirebaseAuthException > generateEmailActionLinkOp (
1070
1061
final EmailLinkType type , final String email , final ActionCodeSettings settings ) {
1071
1062
checkNotDestroyed ();
@@ -1082,6 +1073,98 @@ protected String execute() throws FirebaseAuthException {
1082
1073
};
1083
1074
}
1084
1075
1076
+ /**
1077
+ * Creates a new provider OIDC Auth config with the attributes contained in the specified {@link
1078
+ * OidcProviderConfig.CreateRequest}.
1079
+ *
1080
+ * @param request A non-null {@link OidcProviderConfig.CreateRequest} instance.
1081
+ * @return An {@link OidcProviderConfig} instance corresponding to the newly created provider
1082
+ * config.
1083
+ * @throws NullPointerException if the provided request is null.
1084
+ * @throws FirebaseAuthException if an error occurs while creating the provider config.
1085
+ */
1086
+ public OidcProviderConfig createOidcProviderConfig (
1087
+ @ NonNull OidcProviderConfig .CreateRequest request ) throws FirebaseAuthException {
1088
+ return createOidcProviderConfigOp (request ).call ();
1089
+ }
1090
+
1091
+ /**
1092
+ * Similar to {@link #createOidcProviderConfig} but performs the operation asynchronously.
1093
+ *
1094
+ * @param request A non-null {@link OidcProviderConfig.CreateRequest} instance.
1095
+ * @return An {@code ApiFuture} which will complete successfully with a {@link OidcProviderConfig}
1096
+ * instance corresponding to the newly created provider config. If an error occurs while
1097
+ * creating the provider config, the future throws a {@link FirebaseAuthException}.
1098
+ * @throws NullPointerException if the provided request is null.
1099
+ */
1100
+ public ApiFuture <OidcProviderConfig > createOidcProviderConfigAsync (
1101
+ @ NonNull OidcProviderConfig .CreateRequest request ) {
1102
+ return createOidcProviderConfigOp (request ).callAsync (firebaseApp );
1103
+ }
1104
+
1105
+ private CallableOperation <OidcProviderConfig , FirebaseAuthException >
1106
+ createOidcProviderConfigOp (final OidcProviderConfig .CreateRequest request ) {
1107
+ checkNotDestroyed ();
1108
+ checkNotNull (request , "create request must not be null" );
1109
+ final FirebaseUserManager userManager = getUserManager ();
1110
+ return new CallableOperation <OidcProviderConfig , FirebaseAuthException >() {
1111
+ @ Override
1112
+ protected OidcProviderConfig execute () throws FirebaseAuthException {
1113
+ return userManager .createOidcProviderConfig (request );
1114
+ }
1115
+ };
1116
+ }
1117
+
1118
+ /**
1119
+ * Deletes the provider config identified by the specified provider ID.
1120
+ *
1121
+ * @param providerId A provider ID string.
1122
+ * @throws IllegalArgumentException If the provider ID string is null or empty.
1123
+ * @throws FirebaseAuthException If an error occurs while deleting the provider config.
1124
+ */
1125
+ public void deleteProviderConfig (@ NonNull String providerId ) throws FirebaseAuthException {
1126
+ deleteProviderConfigOp (providerId ).call ();
1127
+ }
1128
+
1129
+ /**
1130
+ * Similar to {@link #deleteProviderConfig} but performs the operation asynchronously.
1131
+ *
1132
+ * @param providerId A provider ID string.
1133
+ * @return An {@code ApiFuture} which will complete successfully when the specified provider
1134
+ * config has been deleted. If an error occurs while deleting the provider config, the future
1135
+ * throws a {@link FirebaseAuthException}.
1136
+ * @throws IllegalArgumentException If the provider ID string is null or empty.
1137
+ */
1138
+ public ApiFuture <Void > deleteProviderConfigAsync (String providerId ) {
1139
+ return deleteProviderConfigOp (providerId ).callAsync (firebaseApp );
1140
+ }
1141
+
1142
+ private CallableOperation <Void , FirebaseAuthException > deleteProviderConfigOp (
1143
+ final String providerId ) {
1144
+ checkNotDestroyed ();
1145
+ checkArgument (!Strings .isNullOrEmpty (providerId ), "provider ID must not be null or empty" );
1146
+ final FirebaseUserManager userManager = getUserManager ();
1147
+ return new CallableOperation <Void , FirebaseAuthException >() {
1148
+ @ Override
1149
+ protected Void execute () throws FirebaseAuthException {
1150
+ userManager .deleteProviderConfig (providerId );
1151
+ return null ;
1152
+ }
1153
+ };
1154
+ }
1155
+
1156
+ FirebaseApp getFirebaseApp () {
1157
+ return this .firebaseApp ;
1158
+ }
1159
+
1160
+ FirebaseTokenVerifier getCookieVerifier () {
1161
+ return this .cookieVerifier .get ();
1162
+ }
1163
+
1164
+ FirebaseUserManager getUserManager () {
1165
+ return this .userManager .get ();
1166
+ }
1167
+
1085
1168
protected <T > Supplier <T > threadSafeMemoize (final Supplier <T > supplier ) {
1086
1169
return Suppliers .memoize (
1087
1170
new Supplier <T >() {
0 commit comments