|
29 | 29 | import com.google.firebase.FirebaseApp;
|
30 | 30 | import com.google.firebase.auth.FirebaseUserManager.EmailLinkType;
|
31 | 31 | import com.google.firebase.auth.FirebaseUserManager.UserImportRequest;
|
| 32 | +import com.google.firebase.auth.ListProviderConfigsPage.DefaultOidcProviderConfigSource; |
| 33 | +import com.google.firebase.auth.ListProviderConfigsPage.ProviderConfigPageFactory; |
32 | 34 | import com.google.firebase.auth.ListUsersPage.DefaultUserSource;
|
33 |
| -import com.google.firebase.auth.ListUsersPage.PageFactory; |
| 35 | +import com.google.firebase.auth.ListUsersPage.UserPageFactory; |
34 | 36 | import com.google.firebase.auth.UserRecord;
|
35 | 37 | import com.google.firebase.auth.internal.FirebaseTokenFactory;
|
36 | 38 | import com.google.firebase.internal.CallableOperation;
|
@@ -500,8 +502,8 @@ private CallableOperation<ListUsersPage, FirebaseAuthException> listUsersOp(
|
500 | 502 | @Nullable final String pageToken, final int maxResults) {
|
501 | 503 | checkNotDestroyed();
|
502 | 504 | final FirebaseUserManager userManager = getUserManager();
|
503 |
| - final PageFactory factory = |
504 |
| - new PageFactory(new DefaultUserSource(userManager, jsonFactory), maxResults, pageToken); |
| 505 | + final DefaultUserSource source = new DefaultUserSource(userManager, jsonFactory); |
| 506 | + final UserPageFactory factory = new UserPageFactory(source, maxResults, pageToken); |
505 | 507 | return new CallableOperation<ListUsersPage, FirebaseAuthException>() {
|
506 | 508 | @Override
|
507 | 509 | protected ListUsersPage execute() throws FirebaseAuthException {
|
@@ -1058,6 +1060,78 @@ protected OidcProviderConfig execute() throws FirebaseAuthException {
|
1058 | 1060 | };
|
1059 | 1061 | }
|
1060 | 1062 |
|
| 1063 | + /** |
| 1064 | + * Gets a page of OIDC Auth provider configs starting from the specified {@code pageToken}. |
| 1065 | + * |
| 1066 | + * @param pageToken A non-empty page token string, or null to retrieve the first page of provider |
| 1067 | + * configs. |
| 1068 | + * @param maxResults Maximum number of provider configs to include in the returned page. This may |
| 1069 | + * not exceed 100. |
| 1070 | + * @return A {@link ListProviderConfigsPage} instance. |
| 1071 | + * @throws IllegalArgumentException If the specified page token is empty, or max results value is |
| 1072 | + * invalid. |
| 1073 | + * @throws FirebaseAuthException If an error occurs while retrieving user data. |
| 1074 | + */ |
| 1075 | + public ListProviderConfigsPage<OidcProviderConfig> listOidcProviderConfigs( |
| 1076 | + @Nullable String pageToken, int maxResults) throws FirebaseAuthException { |
| 1077 | + return listOidcProviderConfigsOp(pageToken, maxResults).call(); |
| 1078 | + } |
| 1079 | + |
| 1080 | + /** |
| 1081 | + * Similar to {@link #listlistOidcProviderConfigs(String)} but performs the operation |
| 1082 | + * asynchronously. |
| 1083 | + * |
| 1084 | + * @param pageToken A non-empty page token string, or null to retrieve the first page of provider |
| 1085 | + * configs. |
| 1086 | + * @return An {@code ApiFuture} which will complete successfully with a |
| 1087 | + * {@link ListProviderConfigsPage} instance. If an error occurs while retrieving provider |
| 1088 | + * config data, the future throws an exception. |
| 1089 | + * @throws IllegalArgumentException If the specified page token is empty. |
| 1090 | + */ |
| 1091 | + public ApiFuture<ListProviderConfigsPage<OidcProviderConfig>> listOidcProviderConfigsAsync( |
| 1092 | + @Nullable String pageToken) { |
| 1093 | + return listOidcProviderConfigsAsync( |
| 1094 | + pageToken, |
| 1095 | + FirebaseUserManager.MAX_LIST_PROVIDER_CONFIGS_RESULTS); |
| 1096 | + } |
| 1097 | + |
| 1098 | + /** |
| 1099 | + * Similar to {@link #listOidcProviderConfigs(String, int)} but performs the operation |
| 1100 | + * asynchronously. |
| 1101 | + * |
| 1102 | + * @param pageToken A non-empty page token string, or null to retrieve the first page of provider |
| 1103 | + * configs. |
| 1104 | + * @param maxResults Maximum number of provider configs to include in the returned page. This may |
| 1105 | + * not exceed 100. |
| 1106 | + * @return An {@code ApiFuture} which will complete successfully with a |
| 1107 | + * {@link ListProviderConfigsPage} instance. If an error occurs while retrieving provider |
| 1108 | + * config data, the future throws an exception. |
| 1109 | + * @throws IllegalArgumentException If the specified page token is empty, or max results value is |
| 1110 | + * invalid. |
| 1111 | + */ |
| 1112 | + public ApiFuture<ListProviderConfigsPage<OidcProviderConfig>> listOidcProviderConfigsAsync( |
| 1113 | + @Nullable String pageToken, |
| 1114 | + int maxResults) { |
| 1115 | + return listOidcProviderConfigsOp(pageToken, maxResults).callAsync(firebaseApp); |
| 1116 | + } |
| 1117 | + |
| 1118 | + private CallableOperation<ListProviderConfigsPage<OidcProviderConfig>, FirebaseAuthException> |
| 1119 | + listOidcProviderConfigsOp(@Nullable final String pageToken, final int maxResults) { |
| 1120 | + checkNotDestroyed(); |
| 1121 | + final FirebaseUserManager userManager = getUserManager(); |
| 1122 | + final DefaultOidcProviderConfigSource source = new DefaultOidcProviderConfigSource(userManager); |
| 1123 | + final ProviderConfigPageFactory<OidcProviderConfig> factory = |
| 1124 | + new ProviderConfigPageFactory<OidcProviderConfig>(source, maxResults, pageToken); |
| 1125 | + return |
| 1126 | + new CallableOperation<ListProviderConfigsPage<OidcProviderConfig>, FirebaseAuthException>() { |
| 1127 | + @Override |
| 1128 | + protected ListProviderConfigsPage<OidcProviderConfig> execute() |
| 1129 | + throws FirebaseAuthException { |
| 1130 | + return factory.create(); |
| 1131 | + } |
| 1132 | + }; |
| 1133 | + } |
| 1134 | + |
1061 | 1135 | /**
|
1062 | 1136 | * Deletes the provider config identified by the specified provider ID.
|
1063 | 1137 | *
|
|
0 commit comments