Skip to content

Commit

Permalink
Merge pull request #230 from auth0/fix-client
Browse files Browse the repository at this point in the history
Allow to set the client is_first_party property
  • Loading branch information
damieng committed Nov 11, 2019
2 parents 1bc48eb + 99f275e commit 3780d13
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/auth0/json/mgmt/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@ public Boolean isFirstParty() {
return isFirstParty;
}

/**
* Setter for whether this application is a first party client or not.
*/
@JsonProperty("is_first_party")
public void setIsFirstParty(Boolean isFirstParty) {
this.isFirstParty = isFirstParty;
}

/**
* Whether this application will conform to strict Open ID Connect specifications or not.
*
Expand Down
8 changes: 5 additions & 3 deletions src/test/java/com/auth0/json/mgmt/client/ClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

public class ClientTest extends JsonTest<Client> {

private static final String readOnlyJson = "{\"client_id\":\"clientId\",\"is_first_party\":true,\"is_heroku_app\":true,\"signing_keys\":[{\"cert\":\"ce\",\"pkcs7\":\"pk\",\"subject\":\"su\"}]}";
private static final String json = "{\"name\":\"name\",\"description\":\"description\",\"client_secret\":\"secret\",\"app_type\":\"type\",\"logo_uri\":\"uri\",\"oidc_conformant\":true,\"callbacks\":[\"value\"],\"allowed_origins\":[\"value\"],\"web_origins\":[\"value\"],\"grant_types\":[\"value\"],\"client_aliases\":[\"value\"],\"allowed_clients\":[\"value\"],\"allowed_logout_urls\":[\"value\"],\"jwt_configuration\":{\"lifetime_in_seconds\":100,\"scopes\":\"openid\",\"alg\":\"alg\"},\"encryption_key\":{\"pub\":\"pub\",\"cert\":\"cert\"},\"sso\":true,\"sso_disabled\":true,\"custom_login_page_on\":true,\"custom_login_page\":\"custom\",\"custom_login_page_preview\":\"preview\",\"form_template\":\"template\",\"addons\":{\"rms\":{},\"mscrm\":{},\"slack\":{},\"layer\":{}},\"token_endpoint_auth_method\":\"method\",\"client_metadata\":{\"key\":\"value\"},\"mobile\":{\"android\":{\"app_package_name\":\"pkg\",\"sha256_cert_fingerprints\":[\"256\"]},\"ios\":{\"team_id\":\"team\",\"app_bundle_identifier\":\"id\"}}}";
private static final String readOnlyJson = "{\"client_id\":\"clientId\",\"is_heroku_app\":true,\"signing_keys\":[{\"cert\":\"ce\",\"pkcs7\":\"pk\",\"subject\":\"su\"}]}";
private static final String json = "{\"name\":\"name\",\"description\":\"description\",\"client_secret\":\"secret\",\"app_type\":\"type\",\"logo_uri\":\"uri\",\"oidc_conformant\":true,\"is_first_party\":true,\"callbacks\":[\"value\"],\"allowed_origins\":[\"value\"],\"web_origins\":[\"value\"],\"grant_types\":[\"value\"],\"client_aliases\":[\"value\"],\"allowed_clients\":[\"value\"],\"allowed_logout_urls\":[\"value\"],\"jwt_configuration\":{\"lifetime_in_seconds\":100,\"scopes\":\"openid\",\"alg\":\"alg\"},\"encryption_key\":{\"pub\":\"pub\",\"cert\":\"cert\"},\"sso\":true,\"sso_disabled\":true,\"custom_login_page_on\":true,\"custom_login_page\":\"custom\",\"custom_login_page_preview\":\"preview\",\"form_template\":\"template\",\"addons\":{\"rms\":{},\"mscrm\":{},\"slack\":{},\"layer\":{}},\"token_endpoint_auth_method\":\"method\",\"client_metadata\":{\"key\":\"value\"},\"mobile\":{\"android\":{\"app_package_name\":\"pkg\",\"sha256_cert_fingerprints\":[\"256\"]},\"ios\":{\"team_id\":\"team\",\"app_bundle_identifier\":\"id\"}}}";

@Test
public void shouldSerialize() throws Exception {
Expand All @@ -27,6 +27,7 @@ public void shouldSerialize() throws Exception {
client.setAppType("type");
client.setLogoUri("uri");
client.setOIDCConformant(true);
client.setIsFirstParty(true);
List<String> stringList = Collections.singletonList("value");
client.setCallbacks(stringList);
client.setAllowedOrigins(stringList);
Expand Down Expand Up @@ -62,6 +63,7 @@ public void shouldSerialize() throws Exception {
assertThat(serialized, JsonMatcher.hasEntry("app_type", "type"));
assertThat(serialized, JsonMatcher.hasEntry("logo_uri", "uri"));
assertThat(serialized, JsonMatcher.hasEntry("oidc_conformant", true));
assertThat(serialized, JsonMatcher.hasEntry("is_first_party", true));
assertThat(serialized, JsonMatcher.hasEntry("callbacks", Collections.singletonList("value")));
assertThat(serialized, JsonMatcher.hasEntry("grant_types", Collections.singletonList("value")));
assertThat(serialized, JsonMatcher.hasEntry("allowed_origins", Collections.singletonList("value")));
Expand Down Expand Up @@ -94,6 +96,7 @@ public void shouldDeserialize() throws Exception {
assertThat(client.getLogoUri(), is("uri"));

assertThat(client.isOIDCConformant(), is(true));
assertThat(client.isFirstParty(), is(true));

assertThat(client.getCallbacks(), contains("value"));
assertThat(client.getWebOrigins(), contains("value"));
Expand Down Expand Up @@ -126,7 +129,6 @@ public void shouldIncludeReadOnlyValuesOnDeserialize() throws Exception {
assertThat(client, is(notNullValue()));

assertThat(client.getClientId(), is("clientId"));
assertThat(client.isFirstParty(), is(true));
assertThat(client.isHerokuApp(), is(true));
assertThat(client.getSigningKeys(), is(notNullValue()));
}
Expand Down

0 comments on commit 3780d13

Please sign in to comment.