File tree Expand file tree Collapse file tree
src/main/java/com/google/firebase/auth Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,4 +111,8 @@ public FirebaseAuth build() {
111111 return new FirebaseAuth (this );
112112 }
113113 }
114+
115+ public void addAuthorizedDomain (String domain ) throws FirebaseAuthException {
116+ this .getUserManager ().addAuthorizedDomain (domain );
117+ }
114118}
Original file line number Diff line number Diff line change 4646import com .google .firebase .internal .HttpRequestInfo ;
4747import com .google .firebase .internal .NonNull ;
4848import com .google .firebase .internal .Nullable ;
49+
50+ import java .util .ArrayList ;
4951import java .util .Collection ;
52+ import java .util .HashMap ;
5053import java .util .HashSet ;
5154import java .util .List ;
5255import java .util .Map ;
@@ -292,6 +295,15 @@ SamlProviderConfig getSamlProviderConfig(String providerId) throws FirebaseAuthE
292295 return httpClient .sendRequest (HttpRequestInfo .buildGetRequest (url ), SamlProviderConfig .class );
293296 }
294297
298+ void addAuthorizedDomain (String domain ) throws FirebaseAuthException {
299+ String url = idpConfigMgtBaseUrl + "/config" ;
300+ HashMap map = httpClient .sendRequest (HttpRequestInfo .buildGetRequest (url ), HashMap .class );
301+ map .put ("authorizedDomains" , ((ArrayList )map .get ("authorizedDomains" )).add (domain ));
302+ HttpRequestInfo requestInfo = HttpRequestInfo .buildJsonPatchRequest (url , map )
303+ .addParameter ("updateMask" , Joiner .on ("," ).join (AuthHttpClient .generateMask (map )));
304+ httpClient .sendRequest (requestInfo , Map .class );
305+ }
306+
295307 ListOidcProviderConfigsResponse listOidcProviderConfigs (int maxResults , String pageToken )
296308 throws FirebaseAuthException {
297309 ImmutableMap .Builder <String , Object > builder =
You can’t perform that action at this time.
0 commit comments