@@ -1076,13 +1076,15 @@ protected String execute() throws FirebaseAuthException {
1076
1076
}
1077
1077
1078
1078
/**
1079
- * Creates a new provider OIDC Auth config with the attributes contained in the specified {@link
1080
- * OidcProviderConfig.CreateRequest}.
1079
+ * Creates a new OIDC Auth provider config with the attributes contained in the specified
1080
+ * {@link OidcProviderConfig.CreateRequest}.
1081
1081
*
1082
1082
* @param request A non-null {@link OidcProviderConfig.CreateRequest} instance.
1083
1083
* @return An {@link OidcProviderConfig} instance corresponding to the newly created provider
1084
1084
* config.
1085
1085
* @throws NullPointerException if the provided request is null.
1086
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not
1087
+ * prefixed with 'oidc.'.
1086
1088
* @throws FirebaseAuthException if an error occurs while creating the provider config.
1087
1089
*/
1088
1090
public OidcProviderConfig createOidcProviderConfig (
@@ -1098,6 +1100,8 @@ public OidcProviderConfig createOidcProviderConfig(
1098
1100
* instance corresponding to the newly created provider config. If an error occurs while
1099
1101
* creating the provider config, the future throws a {@link FirebaseAuthException}.
1100
1102
* @throws NullPointerException if the provided request is null.
1103
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not
1104
+ * prefixed with 'oidc.'.
1101
1105
*/
1102
1106
public ApiFuture <OidcProviderConfig > createOidcProviderConfigAsync (
1103
1107
@ NonNull OidcProviderConfig .CreateRequest request ) {
@@ -1108,6 +1112,7 @@ public ApiFuture<OidcProviderConfig> createOidcProviderConfigAsync(
1108
1112
createOidcProviderConfigOp (final OidcProviderConfig .CreateRequest request ) {
1109
1113
checkNotDestroyed ();
1110
1114
checkNotNull (request , "Create request must not be null." );
1115
+ OidcProviderConfig .checkOidcProviderId (request .getProviderId ());
1111
1116
final FirebaseUserManager userManager = getUserManager ();
1112
1117
return new CallableOperation <OidcProviderConfig , FirebaseAuthException >() {
1113
1118
@ Override
@@ -1162,7 +1167,8 @@ protected OidcProviderConfig execute() throws FirebaseAuthException {
1162
1167
*
1163
1168
* @param providerId A provider ID string.
1164
1169
* @return An {@link OidcProviderConfig} instance.
1165
- * @throws IllegalArgumentException If the provider ID string is null or empty.
1170
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1171
+ * with 'oidc'.
1166
1172
* @throws FirebaseAuthException If an error occurs while retrieving the provider config.
1167
1173
*/
1168
1174
public OidcProviderConfig getOidcProviderConfig (@ NonNull String providerId )
@@ -1179,7 +1185,8 @@ public OidcProviderConfig getOidcProviderConfig(@NonNull String providerId)
1179
1185
* {@link OidcProviderConfig} instance. If an error occurs while retrieving the provider
1180
1186
* config or if the specified provider ID does not exist, the future throws a
1181
1187
* {@link FirebaseAuthException}.
1182
- * @throws IllegalArgumentException If the provider ID string is null or empty.
1188
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not
1189
+ * prefixed with 'oidc.'.
1183
1190
*/
1184
1191
public ApiFuture <OidcProviderConfig > getOidcProviderConfigAsync (@ NonNull String providerId ) {
1185
1192
return getOidcProviderConfigOp (providerId ).callAsync (firebaseApp );
@@ -1188,7 +1195,7 @@ public ApiFuture<OidcProviderConfig> getOidcProviderConfigAsync(@NonNull String
1188
1195
private CallableOperation <OidcProviderConfig , FirebaseAuthException >
1189
1196
getOidcProviderConfigOp (final String providerId ) {
1190
1197
checkNotDestroyed ();
1191
- checkArgument (! Strings . isNullOrEmpty (providerId ), "Provider ID must not be null or empty." );
1198
+ OidcProviderConfig . checkOidcProviderId (providerId );
1192
1199
final FirebaseUserManager userManager = getUserManager ();
1193
1200
return new CallableOperation <OidcProviderConfig , FirebaseAuthException >() {
1194
1201
@ Override
@@ -1289,7 +1296,8 @@ protected ListProviderConfigsPage<OidcProviderConfig> execute()
1289
1296
* Deletes the OIDC Auth provider config identified by the specified provider ID.
1290
1297
*
1291
1298
* @param providerId A provider ID string.
1292
- * @throws IllegalArgumentException If the provider ID string is null or empty.
1299
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1300
+ * with 'oidc'.
1293
1301
* @throws FirebaseAuthException If an error occurs while deleting the provider config.
1294
1302
*/
1295
1303
public void deleteOidcProviderConfig (@ NonNull String providerId ) throws FirebaseAuthException {
@@ -1303,7 +1311,8 @@ public void deleteOidcProviderConfig(@NonNull String providerId) throws Firebase
1303
1311
* @return An {@code ApiFuture} which will complete successfully when the specified provider
1304
1312
* config has been deleted. If an error occurs while deleting the provider config, the future
1305
1313
* throws a {@link FirebaseAuthException}.
1306
- * @throws IllegalArgumentException If the provider ID string is null or empty.
1314
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1315
+ * with "oidc.".
1307
1316
*/
1308
1317
public ApiFuture <Void > deleteOidcProviderConfigAsync (String providerId ) {
1309
1318
return deleteOidcProviderConfigOp (providerId ).callAsync (firebaseApp );
@@ -1312,7 +1321,7 @@ public ApiFuture<Void> deleteOidcProviderConfigAsync(String providerId) {
1312
1321
private CallableOperation <Void , FirebaseAuthException > deleteOidcProviderConfigOp (
1313
1322
final String providerId ) {
1314
1323
checkNotDestroyed ();
1315
- checkArgument (! Strings . isNullOrEmpty (providerId ), "Provider ID must not be null or empty." );
1324
+ OidcProviderConfig . checkOidcProviderId (providerId );
1316
1325
final FirebaseUserManager userManager = getUserManager ();
1317
1326
return new CallableOperation <Void , FirebaseAuthException >() {
1318
1327
@ Override
@@ -1323,6 +1332,93 @@ protected Void execute() throws FirebaseAuthException {
1323
1332
};
1324
1333
}
1325
1334
1335
+ /**
1336
+ * Creates a new SAML Auth provider config with the attributes contained in the specified
1337
+ * {@link SamlProviderConfig.CreateRequest}.
1338
+ *
1339
+ * @param request A non-null {@link SamlProviderConfig.CreateRequest} instance.
1340
+ * @return An {@link SamlProviderConfig} instance corresponding to the newly created provider
1341
+ * config.
1342
+ * @throws NullPointerException if the provided request is null.
1343
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1344
+ * with 'saml'.
1345
+ * @throws FirebaseAuthException if an error occurs while creating the provider config.
1346
+ */
1347
+ public SamlProviderConfig createSamlProviderConfig (
1348
+ @ NonNull SamlProviderConfig .CreateRequest request ) throws FirebaseAuthException {
1349
+ return createSamlProviderConfigOp (request ).call ();
1350
+ }
1351
+
1352
+ /**
1353
+ * Similar to {@link #createSamlProviderConfig} but performs the operation asynchronously.
1354
+ *
1355
+ * @param request A non-null {@link SamlProviderConfig.CreateRequest} instance.
1356
+ * @return An {@code ApiFuture} which will complete successfully with a {@link SamlProviderConfig}
1357
+ * instance corresponding to the newly created provider config. If an error occurs while
1358
+ * creating the provider config, the future throws a {@link FirebaseAuthException}.
1359
+ * @throws NullPointerException if the provided request is null.
1360
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1361
+ * with 'saml'.
1362
+ */
1363
+ public ApiFuture <SamlProviderConfig > createSamlProviderConfigAsync (
1364
+ @ NonNull SamlProviderConfig .CreateRequest request ) {
1365
+ return createSamlProviderConfigOp (request ).callAsync (firebaseApp );
1366
+ }
1367
+
1368
+ private CallableOperation <SamlProviderConfig , FirebaseAuthException >
1369
+ createSamlProviderConfigOp (final SamlProviderConfig .CreateRequest request ) {
1370
+ checkNotDestroyed ();
1371
+ checkNotNull (request , "Create request must not be null." );
1372
+ SamlProviderConfig .checkSamlProviderId (request .getProviderId ());
1373
+ final FirebaseUserManager userManager = getUserManager ();
1374
+ return new CallableOperation <SamlProviderConfig , FirebaseAuthException >() {
1375
+ @ Override
1376
+ protected SamlProviderConfig execute () throws FirebaseAuthException {
1377
+ return userManager .createSamlProviderConfig (request );
1378
+ }
1379
+ };
1380
+ }
1381
+
1382
+ /**
1383
+ * Deletes the SAML Auth provider config identified by the specified provider ID.
1384
+ *
1385
+ * @param providerId A provider ID string.
1386
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1387
+ * with "saml.".
1388
+ * @throws FirebaseAuthException If an error occurs while deleting the provider config.
1389
+ */
1390
+ public void deleteSamlProviderConfig (@ NonNull String providerId ) throws FirebaseAuthException {
1391
+ deleteSamlProviderConfigOp (providerId ).call ();
1392
+ }
1393
+
1394
+ /**
1395
+ * Similar to {@link #deleteSamlProviderConfig} but performs the operation asynchronously.
1396
+ *
1397
+ * @param providerId A provider ID string.
1398
+ * @return An {@code ApiFuture} which will complete successfully when the specified provider
1399
+ * config has been deleted. If an error occurs while deleting the provider config, the future
1400
+ * throws a {@link FirebaseAuthException}.
1401
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1402
+ * with "saml.".
1403
+ */
1404
+ public ApiFuture <Void > deleteSamlProviderConfigAsync (String providerId ) {
1405
+ return deleteSamlProviderConfigOp (providerId ).callAsync (firebaseApp );
1406
+ }
1407
+
1408
+ private CallableOperation <Void , FirebaseAuthException > deleteSamlProviderConfigOp (
1409
+ final String providerId ) {
1410
+ checkNotDestroyed ();
1411
+ SamlProviderConfig .checkSamlProviderId (providerId );
1412
+ final FirebaseUserManager userManager = getUserManager ();
1413
+ return new CallableOperation <Void , FirebaseAuthException >() {
1414
+ @ Override
1415
+ protected Void execute () throws FirebaseAuthException {
1416
+ userManager .deleteSamlProviderConfig (providerId );
1417
+ return null ;
1418
+ }
1419
+ };
1420
+ }
1421
+
1326
1422
FirebaseApp getFirebaseApp () {
1327
1423
return this .firebaseApp ;
1328
1424
}
0 commit comments