From 8f6ab01c1e4451c988bbb08abaf25b2768eb10c0 Mon Sep 17 00:00:00 2001 From: Joris Basiglio Date: Wed, 26 Jul 2017 13:35:42 -0400 Subject: [PATCH 1/2] Update the POJO to support provisioning_ticket_url for AD/LDAP connection --- src/main/java/com/auth0/json/mgmt/Connection.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/auth0/json/mgmt/Connection.java b/src/main/java/com/auth0/json/mgmt/Connection.java index c2a8218b5..70c6cdeeb 100644 --- a/src/main/java/com/auth0/json/mgmt/Connection.java +++ b/src/main/java/com/auth0/json/mgmt/Connection.java @@ -26,6 +26,8 @@ public class Connection { private String strategy; @JsonProperty("enabled_clients") private List enabledClients = null; + @JsonProperty("provisioning_ticket_url") + private String provisioningTicketUrl; public Connection() { } @@ -105,5 +107,15 @@ public List getEnabledClients() { public void setEnabledClients(List enabledClients) { this.enabledClients = enabledClients; } + + /** + * Getter for the ad/ldap connection's ticket url. + * + * @return the provisioning ticket url. + */ + @JsonProperty("provisioning_ticket_url") + public String getProvisioningTicketUrl() { + return provisioningTicketUrl; + } -} \ No newline at end of file +} From 4fc83f5ce28bca40fa63bfb8ea6f676a016cbd33 Mon Sep 17 00:00:00 2001 From: Joris Basiglio Date: Mon, 31 Jul 2017 22:56:34 -0400 Subject: [PATCH 2/2] Add test for ad ticket url support --- .../java/com/auth0/json/mgmt/ConnectionTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/test/java/com/auth0/json/mgmt/ConnectionTest.java b/src/test/java/com/auth0/json/mgmt/ConnectionTest.java index a4da034e3..042068947 100644 --- a/src/test/java/com/auth0/json/mgmt/ConnectionTest.java +++ b/src/test/java/com/auth0/json/mgmt/ConnectionTest.java @@ -15,6 +15,8 @@ public class ConnectionTest extends JsonTest { private static final String json = "{\"name\":\"my-connection\",\"strategy\":\"auth0\",\"options\":{},\"enabled_clients\":[\"client1\",\"client2\"]}"; private static final String readOnlyJson = "{\"id\":\"connectionId\"}"; + private static final String jsonAd = "{\"name\":\"my-ad-connection\",\"strategy\":\"ad\",\"provisioning_ticket_url\":\"https://demo.auth0.com/p/ad/ddQTRlVt\",\"options\":{},\"enabled_clients\":[\"client1\",\"client2\"]}"; + @Test public void shouldSerialize() throws Exception { Connection connection = new Connection("my-connection", "auth0"); @@ -27,6 +29,7 @@ public void shouldSerialize() throws Exception { assertThat(serialized, JsonMatcher.hasEntry("strategy", "auth0")); assertThat(serialized, JsonMatcher.hasEntry("options", notNullValue())); assertThat(serialized, JsonMatcher.hasEntry("enabled_clients", Arrays.asList("client1", "client2"))); + assertThat(serialized, JsonMatcher.hasEntry("provisioning_ticket_url", null)); } @Test @@ -38,6 +41,19 @@ public void shouldDeserialize() throws Exception { assertThat(connection.getOptions(), is(notNullValue())); assertThat(connection.getStrategy(), is("auth0")); assertThat(connection.getEnabledClients(), contains("client1", "client2")); + assertThat(connection.getProvisioningTicketUrl(), is(nullValue())); + } + + @Test + public void shouldDeserializeAd() throws Exception { + Connection connection = fromJSON(jsonAd, Connection.class); + + assertThat(connection, is(notNullValue())); + assertThat(connection.getName(), is("my-ad-connection")); + assertThat(connection.getOptions(), is(notNullValue())); + assertThat(connection.getStrategy(), is("ad")); + assertThat(connection.getEnabledClients(), contains("client1", "client2")); + assertThat(connection.getProvisioningTicketUrl(), is("https://demo.auth0.com/p/ad/ddQTRlVt")); } @Test