@@ -939,13 +939,15 @@ protected String execute() throws FirebaseAuthException {
939
939
}
940
940
941
941
/**
942
- * Creates a new provider OIDC Auth config with the attributes contained in the specified {@link
943
- * OidcProviderConfig.CreateRequest}.
942
+ * Creates a new OIDC Auth provider config with the attributes contained in the specified
943
+ * {@link OidcProviderConfig.CreateRequest}.
944
944
*
945
945
* @param request A non-null {@link OidcProviderConfig.CreateRequest} instance.
946
946
* @return An {@link OidcProviderConfig} instance corresponding to the newly created provider
947
947
* config.
948
948
* @throws NullPointerException if the provided request is null.
949
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not
950
+ * prefixed with 'oidc.'.
949
951
* @throws FirebaseAuthException if an error occurs while creating the provider config.
950
952
*/
951
953
public OidcProviderConfig createOidcProviderConfig (
@@ -961,6 +963,8 @@ public OidcProviderConfig createOidcProviderConfig(
961
963
* instance corresponding to the newly created provider config. If an error occurs while
962
964
* creating the provider config, the future throws a {@link FirebaseAuthException}.
963
965
* @throws NullPointerException if the provided request is null.
966
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not
967
+ * prefixed with 'oidc.'.
964
968
*/
965
969
public ApiFuture <OidcProviderConfig > createOidcProviderConfigAsync (
966
970
@ NonNull OidcProviderConfig .CreateRequest request ) {
@@ -971,6 +975,7 @@ public ApiFuture<OidcProviderConfig> createOidcProviderConfigAsync(
971
975
createOidcProviderConfigOp (final OidcProviderConfig .CreateRequest request ) {
972
976
checkNotDestroyed ();
973
977
checkNotNull (request , "Create request must not be null." );
978
+ OidcProviderConfig .checkOidcProviderId (request .getProviderId ());
974
979
final FirebaseUserManager userManager = getUserManager ();
975
980
return new CallableOperation <OidcProviderConfig , FirebaseAuthException >() {
976
981
@ Override
@@ -1025,7 +1030,8 @@ protected OidcProviderConfig execute() throws FirebaseAuthException {
1025
1030
*
1026
1031
* @param providerId A provider ID string.
1027
1032
* @return An {@link OidcProviderConfig} instance.
1028
- * @throws IllegalArgumentException If the provider ID string is null or empty.
1033
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1034
+ * with 'oidc'.
1029
1035
* @throws FirebaseAuthException If an error occurs while retrieving the provider config.
1030
1036
*/
1031
1037
public OidcProviderConfig getOidcProviderConfig (@ NonNull String providerId )
@@ -1042,7 +1048,8 @@ public OidcProviderConfig getOidcProviderConfig(@NonNull String providerId)
1042
1048
* {@link OidcProviderConfig} instance. If an error occurs while retrieving the provider
1043
1049
* config or if the specified provider ID does not exist, the future throws a
1044
1050
* {@link FirebaseAuthException}.
1045
- * @throws IllegalArgumentException If the provider ID string is null or empty.
1051
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not
1052
+ * prefixed with 'oidc.'.
1046
1053
*/
1047
1054
public ApiFuture <OidcProviderConfig > getOidcProviderConfigAsync (@ NonNull String providerId ) {
1048
1055
return getOidcProviderConfigOp (providerId ).callAsync (firebaseApp );
@@ -1051,7 +1058,7 @@ public ApiFuture<OidcProviderConfig> getOidcProviderConfigAsync(@NonNull String
1051
1058
private CallableOperation <OidcProviderConfig , FirebaseAuthException >
1052
1059
getOidcProviderConfigOp (final String providerId ) {
1053
1060
checkNotDestroyed ();
1054
- checkArgument (! Strings . isNullOrEmpty (providerId ), "Provider ID must not be null or empty." );
1061
+ OidcProviderConfig . checkOidcProviderId (providerId );
1055
1062
final FirebaseUserManager userManager = getUserManager ();
1056
1063
return new CallableOperation <OidcProviderConfig , FirebaseAuthException >() {
1057
1064
@ Override
@@ -1152,7 +1159,8 @@ protected ListProviderConfigsPage<OidcProviderConfig> execute()
1152
1159
* Deletes the OIDC Auth provider config identified by the specified provider ID.
1153
1160
*
1154
1161
* @param providerId A provider ID string.
1155
- * @throws IllegalArgumentException If the provider ID string is null or empty.
1162
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1163
+ * with 'oidc'.
1156
1164
* @throws FirebaseAuthException If an error occurs while deleting the provider config.
1157
1165
*/
1158
1166
public void deleteOidcProviderConfig (@ NonNull String providerId ) throws FirebaseAuthException {
@@ -1166,7 +1174,8 @@ public void deleteOidcProviderConfig(@NonNull String providerId) throws Firebase
1166
1174
* @return An {@code ApiFuture} which will complete successfully when the specified provider
1167
1175
* config has been deleted. If an error occurs while deleting the provider config, the future
1168
1176
* throws a {@link FirebaseAuthException}.
1169
- * @throws IllegalArgumentException If the provider ID string is null or empty.
1177
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1178
+ * with "oidc.".
1170
1179
*/
1171
1180
public ApiFuture <Void > deleteOidcProviderConfigAsync (String providerId ) {
1172
1181
return deleteOidcProviderConfigOp (providerId ).callAsync (firebaseApp );
@@ -1175,7 +1184,7 @@ public ApiFuture<Void> deleteOidcProviderConfigAsync(String providerId) {
1175
1184
private CallableOperation <Void , FirebaseAuthException > deleteOidcProviderConfigOp (
1176
1185
final String providerId ) {
1177
1186
checkNotDestroyed ();
1178
- checkArgument (! Strings . isNullOrEmpty (providerId ), "Provider ID must not be null or empty." );
1187
+ OidcProviderConfig . checkOidcProviderId (providerId );
1179
1188
final FirebaseUserManager userManager = getUserManager ();
1180
1189
return new CallableOperation <Void , FirebaseAuthException >() {
1181
1190
@ Override
@@ -1186,6 +1195,93 @@ protected Void execute() throws FirebaseAuthException {
1186
1195
};
1187
1196
}
1188
1197
1198
+ /**
1199
+ * Creates a new SAML Auth provider config with the attributes contained in the specified
1200
+ * {@link SamlProviderConfig.CreateRequest}.
1201
+ *
1202
+ * @param request A non-null {@link SamlProviderConfig.CreateRequest} instance.
1203
+ * @return An {@link SamlProviderConfig} instance corresponding to the newly created provider
1204
+ * config.
1205
+ * @throws NullPointerException if the provided request is null.
1206
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1207
+ * with 'saml'.
1208
+ * @throws FirebaseAuthException if an error occurs while creating the provider config.
1209
+ */
1210
+ public SamlProviderConfig createSamlProviderConfig (
1211
+ @ NonNull SamlProviderConfig .CreateRequest request ) throws FirebaseAuthException {
1212
+ return createSamlProviderConfigOp (request ).call ();
1213
+ }
1214
+
1215
+ /**
1216
+ * Similar to {@link #createSamlProviderConfig} but performs the operation asynchronously.
1217
+ *
1218
+ * @param request A non-null {@link SamlProviderConfig.CreateRequest} instance.
1219
+ * @return An {@code ApiFuture} which will complete successfully with a {@link SamlProviderConfig}
1220
+ * instance corresponding to the newly created provider config. If an error occurs while
1221
+ * creating the provider config, the future throws a {@link FirebaseAuthException}.
1222
+ * @throws NullPointerException if the provided request is null.
1223
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1224
+ * with 'saml'.
1225
+ */
1226
+ public ApiFuture <SamlProviderConfig > createSamlProviderConfigAsync (
1227
+ @ NonNull SamlProviderConfig .CreateRequest request ) {
1228
+ return createSamlProviderConfigOp (request ).callAsync (firebaseApp );
1229
+ }
1230
+
1231
+ private CallableOperation <SamlProviderConfig , FirebaseAuthException >
1232
+ createSamlProviderConfigOp (final SamlProviderConfig .CreateRequest request ) {
1233
+ checkNotDestroyed ();
1234
+ checkNotNull (request , "Create request must not be null." );
1235
+ SamlProviderConfig .checkSamlProviderId (request .getProviderId ());
1236
+ final FirebaseUserManager userManager = getUserManager ();
1237
+ return new CallableOperation <SamlProviderConfig , FirebaseAuthException >() {
1238
+ @ Override
1239
+ protected SamlProviderConfig execute () throws FirebaseAuthException {
1240
+ return userManager .createSamlProviderConfig (request );
1241
+ }
1242
+ };
1243
+ }
1244
+
1245
+ /**
1246
+ * Deletes the SAML Auth provider config identified by the specified provider ID.
1247
+ *
1248
+ * @param providerId A provider ID string.
1249
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1250
+ * with "saml.".
1251
+ * @throws FirebaseAuthException If an error occurs while deleting the provider config.
1252
+ */
1253
+ public void deleteSamlProviderConfig (@ NonNull String providerId ) throws FirebaseAuthException {
1254
+ deleteSamlProviderConfigOp (providerId ).call ();
1255
+ }
1256
+
1257
+ /**
1258
+ * Similar to {@link #deleteSamlProviderConfig} but performs the operation asynchronously.
1259
+ *
1260
+ * @param providerId A provider ID string.
1261
+ * @return An {@code ApiFuture} which will complete successfully when the specified provider
1262
+ * config has been deleted. If an error occurs while deleting the provider config, the future
1263
+ * throws a {@link FirebaseAuthException}.
1264
+ * @throws IllegalArgumentException If the provider ID string is null or empty, or is not prefixed
1265
+ * with "saml.".
1266
+ */
1267
+ public ApiFuture <Void > deleteSamlProviderConfigAsync (String providerId ) {
1268
+ return deleteSamlProviderConfigOp (providerId ).callAsync (firebaseApp );
1269
+ }
1270
+
1271
+ private CallableOperation <Void , FirebaseAuthException > deleteSamlProviderConfigOp (
1272
+ final String providerId ) {
1273
+ checkNotDestroyed ();
1274
+ SamlProviderConfig .checkSamlProviderId (providerId );
1275
+ final FirebaseUserManager userManager = getUserManager ();
1276
+ return new CallableOperation <Void , FirebaseAuthException >() {
1277
+ @ Override
1278
+ protected Void execute () throws FirebaseAuthException {
1279
+ userManager .deleteSamlProviderConfig (providerId );
1280
+ return null ;
1281
+ }
1282
+ };
1283
+ }
1284
+
1189
1285
FirebaseApp getFirebaseApp () {
1190
1286
return this .firebaseApp ;
1191
1287
}
0 commit comments