From bf74a9a9c0f812ada4a9c5602842ff9a0019a148 Mon Sep 17 00:00:00 2001 From: Jim Anderson Date: Wed, 17 Apr 2024 12:43:38 -0500 Subject: [PATCH] [SDK-4769] - add show_as_button to Organization Enabled Connections --- .../mgmt/organizations/EnabledConnection.java | 18 ++++++++++++++++++ .../client/mgmt/OrganizationEntityTest.java | 8 ++++++-- .../mgmt/organization_connection.json | 3 ++- .../mgmt/organization_connections_list.json | 2 ++ .../organization_connections_paged_list.json | 2 ++ 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/auth0/json/mgmt/organizations/EnabledConnection.java b/src/main/java/com/auth0/json/mgmt/organizations/EnabledConnection.java index 1233e607..af9d0588 100644 --- a/src/main/java/com/auth0/json/mgmt/organizations/EnabledConnection.java +++ b/src/main/java/com/auth0/json/mgmt/organizations/EnabledConnection.java @@ -18,6 +18,8 @@ public class EnabledConnection { private boolean assignMembershipOnLogin; @JsonProperty("connection_id") private String connectionId; + @JsonProperty("show_as_button") + private Boolean showAsButton; public EnabledConnection() {} @@ -77,4 +79,20 @@ public String getConnectionId() { public void setConnectionId(String connectionId) { this.connectionId = connectionId; } + + /** + * @return the value of the {@code show_as_button} field. + */ + public Boolean getShowAsButton() { + return showAsButton; + } + + /** + * Sets the {@code show_as_button} value. + * + * @param showAsButton the value for {@code show_as_button}. + */ + public void setShowAsButton(Boolean showAsButton) { + this.showAsButton = showAsButton; + } } diff --git a/src/test/java/com/auth0/client/mgmt/OrganizationEntityTest.java b/src/test/java/com/auth0/client/mgmt/OrganizationEntityTest.java index be99e6f1..7dc06479 100644 --- a/src/test/java/com/auth0/client/mgmt/OrganizationEntityTest.java +++ b/src/test/java/com/auth0/client/mgmt/OrganizationEntityTest.java @@ -584,6 +584,7 @@ public void shouldAddConnection() throws Exception { EnabledConnection connection = new EnabledConnection(); connection.setAssignMembershipOnLogin(false); connection.setConnectionId("con_123"); + connection.setShowAsButton(true); Request request = api.organizations().addConnection("org_abc", connection); assertThat(request, is(notNullValue())); @@ -597,9 +598,10 @@ public void shouldAddConnection() throws Exception { assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); Map body = bodyFromRequest(recordedRequest); - assertThat(body, aMapWithSize(2)); + assertThat(body, aMapWithSize(3)); assertThat(body, hasEntry("connection_id", "con_123")); assertThat(body, hasEntry("assign_membership_on_login", false)); + assertThat(body, hasEntry("show_as_button", true)); } @Test @@ -656,6 +658,7 @@ public void shouldThrowOnUpdateConnectionWhenConnectionIsNull() { public void shouldUpdateOrgConnection() throws Exception { EnabledConnection connection = new EnabledConnection(); connection.setAssignMembershipOnLogin(true); + connection.setShowAsButton(false); Request request = api.organizations().updateConnection("org_abc", "con_123", connection); assertThat(request, is(notNullValue())); @@ -669,8 +672,9 @@ public void shouldUpdateOrgConnection() throws Exception { assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); Map body = bodyFromRequest(recordedRequest); - assertThat(body, aMapWithSize(1)); + assertThat(body, aMapWithSize(2)); assertThat(body, hasEntry("assign_membership_on_login", true)); + assertThat(body, hasEntry("show_as_button", false)); } // Organization roles diff --git a/src/test/resources/mgmt/organization_connection.json b/src/test/resources/mgmt/organization_connection.json index fc1c5141..32d04390 100644 --- a/src/test/resources/mgmt/organization_connection.json +++ b/src/test/resources/mgmt/organization_connection.json @@ -1,4 +1,5 @@ { "connection_id": "con_At4BWXhV3lKv82jd", - "assign_membership_on_login": false + "assign_membership_on_login": false, + "show_as_button": true } diff --git a/src/test/resources/mgmt/organization_connections_list.json b/src/test/resources/mgmt/organization_connections_list.json index 9c602251..e0bff656 100644 --- a/src/test/resources/mgmt/organization_connections_list.json +++ b/src/test/resources/mgmt/organization_connections_list.json @@ -2,6 +2,7 @@ { "connection_id": "con_At4BWXhV3lKv82jd", "assign_membership_on_login": false, + "show_as_button": true, "connection": { "name": "google-oauth2", "strategy": "google-oauth2" @@ -10,6 +11,7 @@ { "connection_id": "con_kai93HmEDCs8ai3d", "assign_membership_on_login": true, + "show_as_button": true, "connection": { "name": "Username-Password-Authentication", "strategy": "auth0" diff --git a/src/test/resources/mgmt/organization_connections_paged_list.json b/src/test/resources/mgmt/organization_connections_paged_list.json index 4772fe11..7ecbe34c 100644 --- a/src/test/resources/mgmt/organization_connections_paged_list.json +++ b/src/test/resources/mgmt/organization_connections_paged_list.json @@ -3,6 +3,7 @@ { "connection_id": "con_At4BWXhV3lKv82jd", "assign_membership_on_login": false, + "show_as_button": true, "connection": { "name": "google-oauth2", "strategy": "google-oauth2" @@ -11,6 +12,7 @@ { "connection_id": "con_kai93HmEDCs8ai3d", "assign_membership_on_login": true, + "show_as_button": true, "connection": { "name": "Username-Password-Authentication", "strategy": "auth0"