diff --git a/src/main/java/com/auth0/json/mgmt/client/Client.java b/src/main/java/com/auth0/json/mgmt/client/Client.java index b2596607c..a713afb0a 100644 --- a/src/main/java/com/auth0/json/mgmt/client/Client.java +++ b/src/main/java/com/auth0/json/mgmt/client/Client.java @@ -18,6 +18,8 @@ public class Client { @JsonProperty("name") private String name; + @JsonProperty("description") + private String description; @JsonProperty("client_id") private String clientId; @JsonProperty("client_secret") @@ -99,6 +101,26 @@ public void setName(String name) { this.name = name; } + /** + * Getter for the description of the application. + * + * @return the description. + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * Setter for the description of the application. + * + * @param description the description to use. + */ + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + /** * Getter for the application's client id. * diff --git a/src/test/java/com/auth0/json/mgmt/client/ClientTest.java b/src/test/java/com/auth0/json/mgmt/client/ClientTest.java index f3c98d58f..f2e0e256f 100644 --- a/src/test/java/com/auth0/json/mgmt/client/ClientTest.java +++ b/src/test/java/com/auth0/json/mgmt/client/ClientTest.java @@ -5,7 +5,6 @@ import org.hamcrest.collection.IsMapContaining; import org.junit.Test; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; @@ -15,7 +14,7 @@ public class ClientTest extends JsonTest { - private static final String json = "{\"name\":\"name\",\"client_secret\":\"secret\",\"app_type\":\"type\",\"logo_uri\":\"uri\",\"oidc_conformant\":true,\"callbacks\":[\"value\"],\"allowed_origins\":[\"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 json = "{\"name\":\"name\",\"description\":\"description\",\"client_secret\":\"secret\",\"app_type\":\"type\",\"logo_uri\":\"uri\",\"oidc_conformant\":true,\"callbacks\":[\"value\"],\"allowed_origins\":[\"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_first_party\":true,\"is_heroku_app\":true,\"signing_keys\":[{\"cert\":\"ce\",\"pkcs7\":\"pk\",\"subject\":\"su\"}]}"; @Test @@ -23,11 +22,12 @@ public void shouldSerialize() throws Exception { Client client = new Client("ignored"); client.setName("name"); + client.setDescription("description"); client.setClientSecret("secret"); client.setAppType("type"); client.setLogoUri("uri"); client.setOIDCConformant(true); - List stringList = Arrays.asList("value"); + List stringList = Collections.singletonList("value"); client.setCallbacks(stringList); client.setAllowedOrigins(stringList); client.setClientAliases(stringList); @@ -46,24 +46,25 @@ public void shouldSerialize() throws Exception { Addons addons = new Addons(new Addon(), new Addon(), new Addon(), new Addon()); client.setAddons(addons); client.setTokenEndpointAuthMethod("method"); - Map metadata = Collections.singletonMap("key", (Object) "value"); + Map metadata = Collections.singletonMap("key", "value"); client.setClientMetadata(metadata); - Mobile mobile = new Mobile(new Android("pkg", Arrays.asList("256")), new IOS("team", "id")); + Mobile mobile = new Mobile(new Android("pkg", Collections.singletonList("256")), new IOS("team", "id")); client.setMobile(mobile); String serialized = toJSON(client); assertThat(serialized, is(notNullValue())); assertThat(serialized, JsonMatcher.hasEntry("name", "name")); + assertThat(serialized, JsonMatcher.hasEntry("description", "description")); assertThat(serialized, JsonMatcher.hasEntry("client_secret", "secret")); 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("callbacks", Arrays.asList("value"))); - assertThat(serialized, JsonMatcher.hasEntry("allowed_origins", Arrays.asList("value"))); - assertThat(serialized, JsonMatcher.hasEntry("client_aliases", Arrays.asList("value"))); - assertThat(serialized, JsonMatcher.hasEntry("allowed_clients", Arrays.asList("value"))); - assertThat(serialized, JsonMatcher.hasEntry("allowed_logout_urls", Arrays.asList("value"))); + assertThat(serialized, JsonMatcher.hasEntry("callbacks", Collections.singletonList("value"))); + assertThat(serialized, JsonMatcher.hasEntry("allowed_origins", Collections.singletonList("value"))); + assertThat(serialized, JsonMatcher.hasEntry("client_aliases", Collections.singletonList("value"))); + assertThat(serialized, JsonMatcher.hasEntry("allowed_clients", Collections.singletonList("value"))); + assertThat(serialized, JsonMatcher.hasEntry("allowed_logout_urls", Collections.singletonList("value"))); assertThat(serialized, JsonMatcher.hasEntry("jwt_configuration", notNullValue())); assertThat(serialized, JsonMatcher.hasEntry("encryption_key", notNullValue())); assertThat(serialized, JsonMatcher.hasEntry("sso", true)); @@ -84,6 +85,7 @@ public void shouldDeserialize() throws Exception { assertThat(client, is(notNullValue())); assertThat(client.getName(), is("name")); + assertThat(client.getDescription(), is("description")); assertThat(client.getClientSecret(), is("secret")); assertThat(client.getAppType(), is("type")); assertThat(client.getLogoUri(), is("uri")); @@ -109,7 +111,7 @@ public void shouldDeserialize() throws Exception { assertThat(client.getAddons(), is(notNullValue())); assertThat(client.getTokenEndpointAuthMethod(), is("method")); - assertThat(client.getClientMetadata(), IsMapContaining.hasEntry("key", (Object) "value")); + assertThat(client.getClientMetadata(), IsMapContaining.hasEntry("key", "value")); assertThat(client.getMobile(), is(notNullValue())); }