File tree Expand file tree Collapse file tree
main/java/dev/openfga/sdk/api/configuration
test/java/dev/openfga/sdk/api/configuration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ public void assertValid() throws FgaInvalidParameterException {
2222 assertParamExists (clientId , "clientId" , "ClientCredentials" );
2323 assertParamExists (clientSecret , "clientSecret" , "ClientCredentials" );
2424 assertParamExists (apiTokenIssuer , "apiTokenIssuer" , "ClientCredentials" );
25- assertParamExists (apiAudience , "apiAudience" , "ClientCredentials" );
2625 }
2726
2827 public String getClientId () {
Original file line number Diff line number Diff line change @@ -80,4 +80,29 @@ public void assertValid_invalidApiTokenIssuer() {
8080 "Required parameter apiTokenIssuer was invalid when calling ClientCredentials." ,
8181 exception .getMessage ()));
8282 }
83+
84+ @ Test
85+ public void assertValid_withoutApiAudience () throws FgaInvalidParameterException {
86+ // audience is optional for standard OAuth2 servers
87+ ClientCredentials creds = new ClientCredentials ()
88+ .clientId (VALID_CLIENT_ID )
89+ .clientSecret (VALID_CLIENT_SECRET )
90+ .apiTokenIssuer (VALID_API_TOKEN_ISSUER );
91+
92+ // Should not throw
93+ creds .assertValid ();
94+ assertNull (creds .getApiAudience ());
95+ }
96+
97+ @ Test
98+ public void assertValid_withScopes () throws FgaInvalidParameterException {
99+ ClientCredentials creds = new ClientCredentials ()
100+ .clientId (VALID_CLIENT_ID )
101+ .clientSecret (VALID_CLIENT_SECRET )
102+ .apiTokenIssuer (VALID_API_TOKEN_ISSUER )
103+ .scopes ("read write" );
104+
105+ creds .assertValid ();
106+ assertEquals ("read write" , creds .getScopes ());
107+ }
83108}
You can’t perform that action at this time.
0 commit comments