From e2578321ce82014418f69246b61776cd5dc54ddf Mon Sep 17 00:00:00 2001 From: tanya732 Date: Fri, 21 Feb 2025 13:12:59 +0530 Subject: [PATCH 1/3] Added support for SSO-FF --- .../selfserviceprofiles/ConnectionConfig.java | 118 +++++++++++++++++ .../DomainAliasesConfig.java | 31 +++++ .../EnabledOrganizations.java | 64 ++++++++++ .../selfserviceprofiles/Idpinitiated.java | 82 ++++++++++++ .../mgmt/selfserviceprofiles/Options.java | 66 ++++++++++ .../SsoAccessTicketRequest.java | 120 ++++++++++++++++++ .../SsoAccessTicketRequestTest.java | 102 +++++++++++++++ ...lf_service_profile_sso_ticket_request.json | 38 ++++++ 8 files changed, 621 insertions(+) create mode 100644 src/main/java/com/auth0/json/mgmt/selfserviceprofiles/ConnectionConfig.java create mode 100644 src/main/java/com/auth0/json/mgmt/selfserviceprofiles/DomainAliasesConfig.java create mode 100644 src/main/java/com/auth0/json/mgmt/selfserviceprofiles/EnabledOrganizations.java create mode 100644 src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Idpinitiated.java create mode 100644 src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Options.java create mode 100644 src/main/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequest.java create mode 100644 src/test/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequestTest.java create mode 100644 src/test/resources/mgmt/self_service_profile_sso_ticket_request.json diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/ConnectionConfig.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/ConnectionConfig.java new file mode 100644 index 000000000..f1d1d486d --- /dev/null +++ b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/ConnectionConfig.java @@ -0,0 +1,118 @@ +package com.auth0.json.mgmt.selfserviceprofiles; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ConnectionConfig { + @JsonProperty("name") + private String name; + @JsonProperty("display_name") + private String displayName; + @JsonProperty("is_domain_connection") + private boolean isDomainConnection; + @JsonProperty("show_as_button") + private boolean showAsButton; + @JsonProperty("metadata") + private Object metadata; + @JsonProperty("options") + private Options options; + + /** + * Creates a new instance of the ConnectionConfig class. + * @return the new instance. + */ + public String getName() { + return name; + } + + /** + * Setter for the name. + * @param name the name to set. + */ + public void setName(String name) { + this.name = name; + } + + /** + * Getter for the display name. + * @return the display name. + */ + public String getDisplayName() { + return displayName; + } + + /** + * Setter for the display name. + * @param displayName the display name to set. + */ + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + /** + * Getter for the domain connection. + * @return the domain connection. + */ + public boolean isDomainConnection() { + return isDomainConnection; + } + + /** + * Setter for the domain connection. + * @param domainConnection the domain connection to set. + */ + public void setDomainConnection(boolean domainConnection) { + isDomainConnection = domainConnection; + } + + /** + * Getter for the show as button. + * @return the show as button. + */ + public boolean isShowAsButton() { + return showAsButton; + } + + /** + * Setter for the show as button. + * @param showAsButton the show as button to set. + */ + public void setShowAsButton(boolean showAsButton) { + this.showAsButton = showAsButton; + } + + /** + * Getter for the metadata. + * @return the metadata. + */ + public Object getMetadata() { + return metadata; + } + + /** + * Setter for the metadata. + * @param metadata the metadata to set. + */ + public void setMetadata(Object metadata) { + this.metadata = metadata; + } + + /** + * Getter for the options. + * @return the options. + */ + public Options getOptions() { + return options; + } + + /** + * Setter for the options. + * @param options the options to set. + */ + public void setOptions(Options options) { + this.options = options; + } +} diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/DomainAliasesConfig.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/DomainAliasesConfig.java new file mode 100644 index 000000000..4012d5b6f --- /dev/null +++ b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/DomainAliasesConfig.java @@ -0,0 +1,31 @@ +package com.auth0.json.mgmt.selfserviceprofiles; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class DomainAliasesConfig { + @JsonProperty("domain_verification") + private String domainVerification; + + public DomainAliasesConfig() {} + + /** + * Creates a new instance of the DomainAliasesConfig class. + */ + @JsonCreator + public DomainAliasesConfig(@JsonProperty("domain_verification") String domainVerification) { + this.domainVerification = domainVerification; + } + + /** + * Getter for the domain verification. + * @return the domain verification. + */ + public String getDomainVerification() { + return domainVerification; + } +} diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/EnabledOrganizations.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/EnabledOrganizations.java new file mode 100644 index 000000000..fada60683 --- /dev/null +++ b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/EnabledOrganizations.java @@ -0,0 +1,64 @@ +package com.auth0.json.mgmt.selfserviceprofiles; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class EnabledOrganizations { + @JsonProperty("organization_id") + private String organizationId; + @JsonProperty("assign_membership_on_login") + private boolean assignMembershipOnLogin; + @JsonProperty("show_as_button") + private boolean showAsButton; + + /** + * Getter for the organization id. + * @return the organization id. + */ + public String getOrganizationId() { + return organizationId; + } + + /** + * Setter for the organization id. + * @param organizationId the organization id to set. + */ + public void setOrganizationId(String organizationId) { + this.organizationId = organizationId; + } + + /** + * Getter for the assign membership on login. + * @return the assign membership on login. + */ + public boolean isAssignMembershipOnLogin() { + return assignMembershipOnLogin; + } + + /** + * Setter for the assign membership on login. + * @param assignMembershipOnLogin the assign membership on login to set. + */ + public void setAssignMembershipOnLogin(boolean assignMembershipOnLogin) { + this.assignMembershipOnLogin = assignMembershipOnLogin; + } + + /** + * Getter for the show as button. + * @return the show as button. + */ + public boolean isShowAsButton() { + return showAsButton; + } + + /** + * Setter for the show as button. + * @param showAsButton the show as button to set. + */ + public void setShowAsButton(boolean showAsButton) { + this.showAsButton = showAsButton; + } +} diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Idpinitiated.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Idpinitiated.java new file mode 100644 index 000000000..a380bf7bf --- /dev/null +++ b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Idpinitiated.java @@ -0,0 +1,82 @@ +package com.auth0.json.mgmt.selfserviceprofiles; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Idpinitiated { + @JsonProperty("enabled") + private boolean enabled; + @JsonProperty("client_id") + private String clientId; + @JsonProperty("client_protocol") + private String clientProtocol; + @JsonProperty("client_authorizequery") + private String clientAuthorizequery; + + /** + * Creates a new instance. + * @return a new instance. + */ + public boolean isEnabled() { + return enabled; + } + + /** + * Setter for the enabled. + * @param enabled the enabled to set. + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + /** + * Getter for the client id. + * @return the client id. + */ + public String getClientId() { + return clientId; + } + + /** + * Setter for the client id. + * @param clientId the client id to set. + */ + public void setClientId(String clientId) { + this.clientId = clientId; + } + + /** + * Getter for the client protocol. + * @return the client protocol. + */ + public String getClientProtocol() { + return clientProtocol; + } + + /** + * Setter for the client protocol. + * @param clientProtocol the client protocol to set. + */ + public void setClientProtocol(String clientProtocol) { + this.clientProtocol = clientProtocol; + } + + /** + * Getter for the client authorizequery. + * @return the client authorizequery. + */ + public String getClientAuthorizequery() { + return clientAuthorizequery; + } + + /** + * Setter for the client authorizequery. + * @param clientAuthorizequery the client authorizequery to set. + */ + public void setClientAuthorizequery(String clientAuthorizequery) { + this.clientAuthorizequery = clientAuthorizequery; + } +} diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Options.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Options.java new file mode 100644 index 000000000..abc04d235 --- /dev/null +++ b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Options.java @@ -0,0 +1,66 @@ +package com.auth0.json.mgmt.selfserviceprofiles; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Options { + @JsonProperty("icon_url") + private String iconUrl; + @JsonProperty("domain_aliases") + private List domainAliases; + @JsonProperty("idpinitiated") + private Idpinitiated idpinitiated; + + /** + * Getter for the icon URL. + * @return the icon URL. + */ + public String getIconUrl() { + return iconUrl; + } + + /** + * Setter for the icon URL. + * @param iconUrl the icon URL to set. + */ + public void setIconUrl(String iconUrl) { + this.iconUrl = iconUrl; + } + + /** + * Getter for the domain aliases. + * @return the domain aliases. + */ + public List getDomainAliases() { + return domainAliases; + } + + /** + * Setter for the domain aliases. + * @param domainAliases the domain aliases to set. + */ + public void setDomainAliases(List domainAliases) { + this.domainAliases = domainAliases; + } + + /** + * Getter for the Idpinitiated. + * @return the Idpinitiated. + */ + public Idpinitiated getIdpinitiated() { + return idpinitiated; + } + + /** + * Setter for the Idpinitiated. + * @param idpinitiated the Idpinitiated to set. + */ + public void setIdpinitiated(Idpinitiated idpinitiated) { + this.idpinitiated = idpinitiated; + } +} diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequest.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequest.java new file mode 100644 index 000000000..98eb7384e --- /dev/null +++ b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequest.java @@ -0,0 +1,120 @@ +package com.auth0.json.mgmt.selfserviceprofiles; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class SsoAccessTicketRequest { + @JsonProperty("connection_id") + private String connectionId; + @JsonProperty("connection_config") + private ConnectionConfig connectionConfig; + @JsonProperty("enabled_clients") + private List enabledClients; + @JsonProperty("enabled_organizations") + private List enabledOrganizations; + @JsonProperty("ttl_sec") + private int ttlSec; + @JsonProperty("domain_aliases_config") + private DomainAliasesConfig domainAliasesConfig; + + /** + * Creates a new instance. + * @return the new instance. + */ + public String getConnectionId() { + return connectionId; + } + + /** + * Sets the connection ID. + * @param connectionId the connection ID to set. + */ + public void setConnectionId(String connectionId) { + this.connectionId = connectionId; + } + + /** + * Getter for the connection configuration. + * @return the connection configuration. + */ + public ConnectionConfig getConnectionConfig() { + return connectionConfig; + } + + /** + * Setter for the connection configuration. + * @param connectionConfig the connection configuration to set. + */ + public void setConnectionConfig(ConnectionConfig connectionConfig) { + this.connectionConfig = connectionConfig; + } + + /** + * Getter for the enabled clients. + * @return the enabled clients. + */ + public List getEnabledClients() { + return enabledClients; + } + + /** + * Setter for the enabled clients. + * @param enabledClients the enabled clients to set. + */ + public void setEnabledClients(List enabledClients) { + this.enabledClients = enabledClients; + } + + /** + * Getter for the enabled organizations. + * @return the enabled organizations. + */ + public List getEnabledOrganizations() { + return enabledOrganizations; + } + + /** + * Setter for the enabled organizations. + * @param enabledOrganizations the enabled organizations to set. + */ + public void setEnabledOrganizations(List enabledOrganizations) { + this.enabledOrganizations = enabledOrganizations; + } + + /** + * Getter for the TTL in seconds. + * @return the TTL in seconds. + */ + public int getTtlSec() { + return ttlSec; + } + + /** + * Setter for the TTL in seconds. + * @param ttlSec the TTL in seconds to set. + */ + public void setTtlSec(int ttlSec) { + this.ttlSec = ttlSec; + } + + /** + * Getter for the domain aliases configuration. + * @return the domain aliases configuration. + */ + public DomainAliasesConfig getDomainAliasesConfig() { + return domainAliasesConfig; + } + + /** + * Setter for the domain aliases configuration. + * @param domainAliasesConfig the domain aliases configuration to set. + */ + public void setDomainAliasesConfig(DomainAliasesConfig domainAliasesConfig) { + this.domainAliasesConfig = domainAliasesConfig; + } +} diff --git a/src/test/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequestTest.java b/src/test/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequestTest.java new file mode 100644 index 000000000..8fed9c883 --- /dev/null +++ b/src/test/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequestTest.java @@ -0,0 +1,102 @@ +package com.auth0.json.mgmt.selfserviceprofiles; + +import com.auth0.json.JsonTest; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static com.auth0.json.JsonMatcher.hasEntry; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; + +public class SsoAccessTicketRequestTest extends JsonTest { + private final static String SELF_SERVICE_PROFILE_SSO_ACCESS_TICKET_REQUEST_JSON = "src/test/resources/mgmt/self_service_profile_sso_ticket_request.json"; + + @Test + public void deserialize() throws Exception { + SsoAccessTicketRequest deserialized = fromJSON(readTextFile(SELF_SERVICE_PROFILE_SSO_ACCESS_TICKET_REQUEST_JSON), SsoAccessTicketRequest.class); + + assertThat(deserialized.getConnectionConfig().getName(), is("sso-test1")); + assertThat(deserialized.getConnectionConfig().getDisplayName(), is("sso-test1")); + assertThat(deserialized.getConnectionConfig().isDomainConnection(), is(true)); + assertThat(deserialized.getConnectionConfig().isShowAsButton(), is(true)); + assertThat(deserialized.getConnectionConfig().getOptions().getIconUrl(), is("url")); + assertThat(deserialized.getConnectionConfig().getOptions().getDomainAliases().get(0), is("acme.corp")); + assertThat(deserialized.getConnectionConfig().getOptions().getIdpinitiated().isEnabled(), is(true)); + assertThat(deserialized.getConnectionConfig().getOptions().getIdpinitiated().getClientId(), is("client-id")); + assertThat(deserialized.getConnectionConfig().getOptions().getIdpinitiated().getClientProtocol(), is("client-protocol")); + assertThat(deserialized.getConnectionConfig().getOptions().getIdpinitiated().getClientAuthorizequery(), is("client-authorizequery")); + + assertThat(deserialized.getEnabledClients().get(0), is("client-id")); + + assertThat(deserialized.getEnabledOrganizations().get(0).getOrganizationId(), is("org_1")); + assertThat(deserialized.getEnabledOrganizations().get(0).isAssignMembershipOnLogin(), is(true)); + assertThat(deserialized.getEnabledOrganizations().get(0).isShowAsButton(), is(true)); + + assertThat(deserialized.getTtlSec(), is(0)); + + assertThat(deserialized.getDomainAliasesConfig().getDomainVerification(), is("domain-verification")); + } + + @Test + public void serialize() throws Exception { + SsoAccessTicketRequest ssoAccessTicketRequest = new SsoAccessTicketRequest(); + ConnectionConfig connectionConfig = new ConnectionConfig(); + connectionConfig.setName("sso-test1"); + connectionConfig.setDisplayName("sso-test1"); + connectionConfig.setDomainConnection(true); + connectionConfig.setShowAsButton(true); + + Options options = new Options(); + options.setIconUrl("url"); + + options.setDomainAliases(new ArrayList() {{ + add("acme.corp"); + }}); + + Idpinitiated idpinitiated = new Idpinitiated(); + idpinitiated.setEnabled(true); + idpinitiated.setClientId("client-id"); + idpinitiated.setClientProtocol("client-protocol"); + idpinitiated.setClientAuthorizequery("client-authorizequery"); + options.setIdpinitiated(idpinitiated); + + connectionConfig.setOptions(options); + + ssoAccessTicketRequest.setConnectionConfig(connectionConfig); + ssoAccessTicketRequest.setEnabledClients(new ArrayList() {{ + add("client-id"); + }}); + + EnabledOrganizations enabledOrganizations = new EnabledOrganizations(); + enabledOrganizations.setOrganizationId("org_1"); + enabledOrganizations.setAssignMembershipOnLogin(true); + enabledOrganizations.setShowAsButton(true); + + ssoAccessTicketRequest.setEnabledOrganizations(new ArrayList() {{ + add(enabledOrganizations); + }}); + + ssoAccessTicketRequest.setTtlSec(0); + + ssoAccessTicketRequest.setDomainAliasesConfig(new DomainAliasesConfig("domain-verification")); + + String serialized = toJSON(ssoAccessTicketRequest); + assertThat(ssoAccessTicketRequest, is(notNullValue())); + + + assertThat(serialized, containsString("\"name\":\"sso-test1\"")); + assertThat(serialized, containsString("\"display_name\":\"sso-test1\"")); + assertThat(serialized, containsString("\"is_domain_connection\":true")); + assertThat(serialized, containsString("\"show_as_button\":true")); + assertThat(serialized, containsString("\"icon_url\":\"url\"")); + assertThat(serialized, containsString("\"domain_aliases\":[\"acme.corp\"]")); + assertThat(serialized, containsString("\"idpinitiated\":{\"enabled\":true,\"client_id\":\"client-id\",\"client_protocol\":\"client-protocol\",\"client_authorizequery\":\"client-authorizequery\"}")); + assertThat(serialized, containsString("\"enabled_clients\":[\"client-id\"]")); + assertThat(serialized, containsString("\"enabled_organizations\":[{\"organization_id\":\"org_1\",\"assign_membership_on_login\":true,\"show_as_button\":true}]")); + assertThat(serialized, containsString("\"ttl_sec\":0")); + assertThat(serialized, containsString("\"domain_aliases_config\":{\"domain_verification\":\"domain-verification\"}")); + + } +} diff --git a/src/test/resources/mgmt/self_service_profile_sso_ticket_request.json b/src/test/resources/mgmt/self_service_profile_sso_ticket_request.json new file mode 100644 index 000000000..234467797 --- /dev/null +++ b/src/test/resources/mgmt/self_service_profile_sso_ticket_request.json @@ -0,0 +1,38 @@ +{ + "connection_config": { + "name": "sso-test1", + "display_name": "sso-test1", + "is_domain_connection": true, + "show_as_button": true, + "metadata": { + "key1":"value1" + }, + "options":{ + "icon_url":"url", + "domain_aliases":[ + "acme.corp", + "okta.com" + ], + "idpinitiated": { + "enabled": true, + "client_id": "client-id", + "client_protocol": "client-protocol", + "client_authorizequery": "client-authorizequery" + } + } + }, + "enabled_clients": [ + "client-id" + ], + "enabled_organizations": [ + { + "organization_id": "org_1", + "assign_membership_on_login": true, + "show_as_button": true + } + ], + "ttl_sec": 0, + "domain_aliases_config": { + "domain_verification": "domain-verification" + } +} From 9bb04518fa8d09242dae76639296b689394c6d3d Mon Sep 17 00:00:00 2001 From: tanya732 Date: Mon, 24 Mar 2025 16:58:02 +0530 Subject: [PATCH 2/3] Updated fields in connection object --- .../mgmt/SelfServiceProfilesEntity.java | 13 +- .../json/mgmt/connections/Connection.java | 38 ++++++ .../selfserviceprofiles/ConnectionConfig.java | 118 ------------------ .../DomainAliasesConfig.java | 2 - .../selfserviceprofiles/Idpinitiated.java | 82 ------------ .../mgmt/selfserviceprofiles/Options.java | 66 ---------- .../SsoAccessTicketRequest.java | 7 +- .../client/mgmt/ConnectionsEntityTest.java | 4 +- .../mgmt/SelfServiceProfilesEntityTest.java | 16 +-- .../SsoAccessTicketRequestTest.java | 72 +++++------ ...lf_service_profile_sso_ticket_request.json | 14 +-- 11 files changed, 91 insertions(+), 341 deletions(-) delete mode 100644 src/main/java/com/auth0/json/mgmt/selfserviceprofiles/ConnectionConfig.java delete mode 100644 src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Idpinitiated.java delete mode 100644 src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Options.java diff --git a/src/main/java/com/auth0/client/mgmt/SelfServiceProfilesEntity.java b/src/main/java/com/auth0/client/mgmt/SelfServiceProfilesEntity.java index cf1cbdfe5..10edf576b 100644 --- a/src/main/java/com/auth0/client/mgmt/SelfServiceProfilesEntity.java +++ b/src/main/java/com/auth0/client/mgmt/SelfServiceProfilesEntity.java @@ -1,10 +1,7 @@ package com.auth0.client.mgmt; import com.auth0.client.mgmt.filter.PageBasedPaginationFilter; -import com.auth0.json.mgmt.selfserviceprofiles.SelfServiceProfile; -import com.auth0.json.mgmt.selfserviceprofiles.SelfServiceProfileResponse; -import com.auth0.json.mgmt.selfserviceprofiles.SelfServiceProfileResponsePage; -import com.auth0.json.mgmt.selfserviceprofiles.SsoAccessTicketResponse; +import com.auth0.json.mgmt.selfserviceprofiles.*; import com.auth0.net.*; import com.auth0.net.client.Auth0HttpClient; import com.auth0.net.client.HttpMethod; @@ -192,12 +189,12 @@ public Request setCustomText(String id, String language, String page, Ob * A token with {@code create:sso_access_tickets} scope is needed * @see https://auth0.com/docs/api/management/v2#!/self-service-profiles/post-sso-ticket * @param id the self-service profile ID. - * @param payload the payload. + * @param requestBody the payload. * @return a Request to execute. */ - public Request createSsoAccessTicket(String id, Object payload) { + public Request createSsoAccessTicket(String id, SsoAccessTicketRequest requestBody) { Asserts.assertNotNull(id, "id"); - Asserts.assertNotNull(payload, "payload"); + Asserts.assertNotNull(requestBody, "request body"); HttpUrl.Builder builder = baseUrl.newBuilder() .addPathSegments(ORGS_PATH) @@ -208,7 +205,7 @@ public Request createSsoAccessTicket(String id, Object BaseRequest request = new BaseRequest<>(this.client, tokenProvider, url, HttpMethod.POST, new TypeReference() { }); - request.setBody(payload); + request.setBody(requestBody); return request; } diff --git a/src/main/java/com/auth0/json/mgmt/connections/Connection.java b/src/main/java/com/auth0/json/mgmt/connections/Connection.java index d39574a53..5cf63cc8d 100644 --- a/src/main/java/com/auth0/json/mgmt/connections/Connection.java +++ b/src/main/java/com/auth0/json/mgmt/connections/Connection.java @@ -34,6 +34,10 @@ public class Connection { private Map metadata; @JsonProperty("realms") private List realms; + @JsonProperty("show_as_button") + private boolean showAsButton; + @JsonProperty("is_domain_connection") + private boolean isDomainConnection; public Connection() { } @@ -183,4 +187,38 @@ public List getRealms() { public void setRealms(List realms) { this.realms = realms; } + + /** + * Getter for the show as button flag. + * + * @return the show as button flag. + */ + public boolean isShowAsButton() { + return showAsButton; + } + + /** + * Setter for the show as button flag. + * + * @param showAsButton the show as button flag to set. + */ + public void setShowAsButton(boolean showAsButton) { + this.showAsButton = showAsButton; + } + + /** + * Getter for the domain connection flag. + * @return the domain connection flag. + */ + public boolean isDomainConnection() { + return isDomainConnection; + } + + /** + * Setter for the domain connection flag. + * @param domainConnection the domain connection flag to set. + */ + public void setDomainConnection(boolean domainConnection) { + isDomainConnection = domainConnection; + } } diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/ConnectionConfig.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/ConnectionConfig.java deleted file mode 100644 index f1d1d486d..000000000 --- a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/ConnectionConfig.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.auth0.json.mgmt.selfserviceprofiles; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class ConnectionConfig { - @JsonProperty("name") - private String name; - @JsonProperty("display_name") - private String displayName; - @JsonProperty("is_domain_connection") - private boolean isDomainConnection; - @JsonProperty("show_as_button") - private boolean showAsButton; - @JsonProperty("metadata") - private Object metadata; - @JsonProperty("options") - private Options options; - - /** - * Creates a new instance of the ConnectionConfig class. - * @return the new instance. - */ - public String getName() { - return name; - } - - /** - * Setter for the name. - * @param name the name to set. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Getter for the display name. - * @return the display name. - */ - public String getDisplayName() { - return displayName; - } - - /** - * Setter for the display name. - * @param displayName the display name to set. - */ - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - /** - * Getter for the domain connection. - * @return the domain connection. - */ - public boolean isDomainConnection() { - return isDomainConnection; - } - - /** - * Setter for the domain connection. - * @param domainConnection the domain connection to set. - */ - public void setDomainConnection(boolean domainConnection) { - isDomainConnection = domainConnection; - } - - /** - * Getter for the show as button. - * @return the show as button. - */ - public boolean isShowAsButton() { - return showAsButton; - } - - /** - * Setter for the show as button. - * @param showAsButton the show as button to set. - */ - public void setShowAsButton(boolean showAsButton) { - this.showAsButton = showAsButton; - } - - /** - * Getter for the metadata. - * @return the metadata. - */ - public Object getMetadata() { - return metadata; - } - - /** - * Setter for the metadata. - * @param metadata the metadata to set. - */ - public void setMetadata(Object metadata) { - this.metadata = metadata; - } - - /** - * Getter for the options. - * @return the options. - */ - public Options getOptions() { - return options; - } - - /** - * Setter for the options. - * @param options the options to set. - */ - public void setOptions(Options options) { - this.options = options; - } -} diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/DomainAliasesConfig.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/DomainAliasesConfig.java index 4012d5b6f..2502578b3 100644 --- a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/DomainAliasesConfig.java +++ b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/DomainAliasesConfig.java @@ -11,8 +11,6 @@ public class DomainAliasesConfig { @JsonProperty("domain_verification") private String domainVerification; - public DomainAliasesConfig() {} - /** * Creates a new instance of the DomainAliasesConfig class. */ diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Idpinitiated.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Idpinitiated.java deleted file mode 100644 index a380bf7bf..000000000 --- a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Idpinitiated.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.auth0.json.mgmt.selfserviceprofiles; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Idpinitiated { - @JsonProperty("enabled") - private boolean enabled; - @JsonProperty("client_id") - private String clientId; - @JsonProperty("client_protocol") - private String clientProtocol; - @JsonProperty("client_authorizequery") - private String clientAuthorizequery; - - /** - * Creates a new instance. - * @return a new instance. - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Setter for the enabled. - * @param enabled the enabled to set. - */ - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - /** - * Getter for the client id. - * @return the client id. - */ - public String getClientId() { - return clientId; - } - - /** - * Setter for the client id. - * @param clientId the client id to set. - */ - public void setClientId(String clientId) { - this.clientId = clientId; - } - - /** - * Getter for the client protocol. - * @return the client protocol. - */ - public String getClientProtocol() { - return clientProtocol; - } - - /** - * Setter for the client protocol. - * @param clientProtocol the client protocol to set. - */ - public void setClientProtocol(String clientProtocol) { - this.clientProtocol = clientProtocol; - } - - /** - * Getter for the client authorizequery. - * @return the client authorizequery. - */ - public String getClientAuthorizequery() { - return clientAuthorizequery; - } - - /** - * Setter for the client authorizequery. - * @param clientAuthorizequery the client authorizequery to set. - */ - public void setClientAuthorizequery(String clientAuthorizequery) { - this.clientAuthorizequery = clientAuthorizequery; - } -} diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Options.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Options.java deleted file mode 100644 index abc04d235..000000000 --- a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/Options.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.auth0.json.mgmt.selfserviceprofiles; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Options { - @JsonProperty("icon_url") - private String iconUrl; - @JsonProperty("domain_aliases") - private List domainAliases; - @JsonProperty("idpinitiated") - private Idpinitiated idpinitiated; - - /** - * Getter for the icon URL. - * @return the icon URL. - */ - public String getIconUrl() { - return iconUrl; - } - - /** - * Setter for the icon URL. - * @param iconUrl the icon URL to set. - */ - public void setIconUrl(String iconUrl) { - this.iconUrl = iconUrl; - } - - /** - * Getter for the domain aliases. - * @return the domain aliases. - */ - public List getDomainAliases() { - return domainAliases; - } - - /** - * Setter for the domain aliases. - * @param domainAliases the domain aliases to set. - */ - public void setDomainAliases(List domainAliases) { - this.domainAliases = domainAliases; - } - - /** - * Getter for the Idpinitiated. - * @return the Idpinitiated. - */ - public Idpinitiated getIdpinitiated() { - return idpinitiated; - } - - /** - * Setter for the Idpinitiated. - * @param idpinitiated the Idpinitiated to set. - */ - public void setIdpinitiated(Idpinitiated idpinitiated) { - this.idpinitiated = idpinitiated; - } -} diff --git a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequest.java b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequest.java index 98eb7384e..d521bec42 100644 --- a/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequest.java +++ b/src/main/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequest.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; +import java.util.Map; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) @@ -12,7 +13,7 @@ public class SsoAccessTicketRequest { @JsonProperty("connection_id") private String connectionId; @JsonProperty("connection_config") - private ConnectionConfig connectionConfig; + private Map connectionConfig; @JsonProperty("enabled_clients") private List enabledClients; @JsonProperty("enabled_organizations") @@ -42,7 +43,7 @@ public void setConnectionId(String connectionId) { * Getter for the connection configuration. * @return the connection configuration. */ - public ConnectionConfig getConnectionConfig() { + public Map getConnectionConfig() { return connectionConfig; } @@ -50,7 +51,7 @@ public ConnectionConfig getConnectionConfig() { * Setter for the connection configuration. * @param connectionConfig the connection configuration to set. */ - public void setConnectionConfig(ConnectionConfig connectionConfig) { + public void setConnectionConfig(Map connectionConfig) { this.connectionConfig = connectionConfig; } diff --git a/src/test/java/com/auth0/client/mgmt/ConnectionsEntityTest.java b/src/test/java/com/auth0/client/mgmt/ConnectionsEntityTest.java index 211d13cb3..d2b22b848 100644 --- a/src/test/java/com/auth0/client/mgmt/ConnectionsEntityTest.java +++ b/src/test/java/com/auth0/client/mgmt/ConnectionsEntityTest.java @@ -142,7 +142,7 @@ public void shouldCreateConnection() throws Exception { assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); Map body = bodyFromRequest(recordedRequest); - assertThat(body.size(), is(2)); + assertThat(body.size(), is(5)); assertThat(body, hasEntry("name", "my-connection")); assertThat(body, hasEntry("strategy", "auth0")); @@ -198,7 +198,7 @@ public void shouldUpdateConnection() throws Exception { assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken")); Map body = bodyFromRequest(recordedRequest); - assertThat(body.size(), is(2)); + assertThat(body.size(), is(5)); assertThat(body, hasEntry("name", "my-connection")); assertThat(body, hasEntry("strategy", "auth0")); diff --git a/src/test/java/com/auth0/client/mgmt/SelfServiceProfilesEntityTest.java b/src/test/java/com/auth0/client/mgmt/SelfServiceProfilesEntityTest.java index 227bcfe07..08d66d578 100644 --- a/src/test/java/com/auth0/client/mgmt/SelfServiceProfilesEntityTest.java +++ b/src/test/java/com/auth0/client/mgmt/SelfServiceProfilesEntityTest.java @@ -1,10 +1,7 @@ package com.auth0.client.mgmt; import com.auth0.client.mgmt.filter.PageBasedPaginationFilter; -import com.auth0.json.mgmt.selfserviceprofiles.SelfServiceProfile; -import com.auth0.json.mgmt.selfserviceprofiles.SelfServiceProfileResponse; -import com.auth0.json.mgmt.selfserviceprofiles.SelfServiceProfileResponsePage; -import com.auth0.json.mgmt.selfserviceprofiles.SsoAccessTicketResponse; +import com.auth0.json.mgmt.selfserviceprofiles.*; import com.auth0.net.Request; import com.auth0.net.client.HttpMethod; import okhttp3.mockwebserver.RecordedRequest; @@ -268,22 +265,21 @@ public void shouldSetCustomText() throws Exception { @Test public void shouldThrowOnCreateSsoAccessTicketWhenIdIsNull() { verifyThrows(IllegalArgumentException.class, - () -> api.selfServiceProfiles().createSsoAccessTicket(null, new Object()), "'id' cannot be null!"); + () -> api.selfServiceProfiles().createSsoAccessTicket(null, new SsoAccessTicketRequest()), "'id' cannot be null!"); } @Test public void shouldThrowOnCreateSsoAccessTicketWhenPayloadIsNull() { verifyThrows(IllegalArgumentException.class, - () -> api.selfServiceProfiles().createSsoAccessTicket("id", null), "'payload' cannot be null!"); + () -> api.selfServiceProfiles().createSsoAccessTicket("id", null), "'request body' cannot be null!"); } @Test public void shouldCreateSsoAccessTicket() throws Exception{ - Map payload = new HashMap<>(); + SsoAccessTicketRequest requestBody = new SsoAccessTicketRequest(); + requestBody.setConnectionId("test-connection"); - payload.put("connection_id", "test-connection"); - - Request request = api.selfServiceProfiles().createSsoAccessTicket("id", payload); + Request request = api.selfServiceProfiles().createSsoAccessTicket("id", requestBody); assertThat(request, is(notNullValue())); server.jsonResponse(SELF_SERVICE_PROFILE_SSO_TICKET, 200); diff --git a/src/test/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequestTest.java b/src/test/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequestTest.java index 8fed9c883..41097b646 100644 --- a/src/test/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequestTest.java +++ b/src/test/java/com/auth0/json/mgmt/selfserviceprofiles/SsoAccessTicketRequestTest.java @@ -4,7 +4,9 @@ import org.junit.jupiter.api.Test; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import static com.auth0.json.JsonMatcher.hasEntry; import static org.hamcrest.MatcherAssert.assertThat; @@ -17,18 +19,8 @@ public class SsoAccessTicketRequestTest extends JsonTest public void deserialize() throws Exception { SsoAccessTicketRequest deserialized = fromJSON(readTextFile(SELF_SERVICE_PROFILE_SSO_ACCESS_TICKET_REQUEST_JSON), SsoAccessTicketRequest.class); - assertThat(deserialized.getConnectionConfig().getName(), is("sso-test1")); - assertThat(deserialized.getConnectionConfig().getDisplayName(), is("sso-test1")); - assertThat(deserialized.getConnectionConfig().isDomainConnection(), is(true)); - assertThat(deserialized.getConnectionConfig().isShowAsButton(), is(true)); - assertThat(deserialized.getConnectionConfig().getOptions().getIconUrl(), is("url")); - assertThat(deserialized.getConnectionConfig().getOptions().getDomainAliases().get(0), is("acme.corp")); - assertThat(deserialized.getConnectionConfig().getOptions().getIdpinitiated().isEnabled(), is(true)); - assertThat(deserialized.getConnectionConfig().getOptions().getIdpinitiated().getClientId(), is("client-id")); - assertThat(deserialized.getConnectionConfig().getOptions().getIdpinitiated().getClientProtocol(), is("client-protocol")); - assertThat(deserialized.getConnectionConfig().getOptions().getIdpinitiated().getClientAuthorizequery(), is("client-authorizequery")); - - assertThat(deserialized.getEnabledClients().get(0), is("client-id")); + assertThat(deserialized.getConnectionConfig(), is(notNullValue())); + assertThat(deserialized.getEnabledClients().get(0), is("client-1")); assertThat(deserialized.getEnabledOrganizations().get(0).getOrganizationId(), is("org_1")); assertThat(deserialized.getEnabledOrganizations().get(0).isAssignMembershipOnLogin(), is(true)); @@ -36,37 +28,39 @@ public void deserialize() throws Exception { assertThat(deserialized.getTtlSec(), is(0)); - assertThat(deserialized.getDomainAliasesConfig().getDomainVerification(), is("domain-verification")); + assertThat(deserialized.getDomainAliasesConfig().getDomainVerification(), is("none")); } @Test public void serialize() throws Exception { - SsoAccessTicketRequest ssoAccessTicketRequest = new SsoAccessTicketRequest(); - ConnectionConfig connectionConfig = new ConnectionConfig(); - connectionConfig.setName("sso-test1"); - connectionConfig.setDisplayName("sso-test1"); - connectionConfig.setDomainConnection(true); - connectionConfig.setShowAsButton(true); - - Options options = new Options(); - options.setIconUrl("url"); - options.setDomainAliases(new ArrayList() {{ + Map connectionConfig = new HashMap<>(); + connectionConfig.put("name", "okta"); + connectionConfig.put("display_name", "okta connection"); + connectionConfig.put("is_domain_connection", true); + connectionConfig.put("show_as_button", true); + connectionConfig.put("metadata", new HashMap<>()); + + Map idpInitiated = new HashMap<>(); + idpInitiated.put("enabled", true); + idpInitiated.put("client_id", "client-1"); + idpInitiated.put("client_protocol", "oauth2"); + idpInitiated.put("client_authorizequery", "response_type=code&scope=openid%20profile%20email"); + + Map options = new HashMap<>(); + options.put("idpinitiated", idpInitiated); + options.put("icon_url", "https://cdn.auth0.com/connections/okta.png"); + options.put("domain_aliases", new ArrayList() {{ add("acme.corp"); }}); - Idpinitiated idpinitiated = new Idpinitiated(); - idpinitiated.setEnabled(true); - idpinitiated.setClientId("client-id"); - idpinitiated.setClientProtocol("client-protocol"); - idpinitiated.setClientAuthorizequery("client-authorizequery"); - options.setIdpinitiated(idpinitiated); + connectionConfig.put("options", options); - connectionConfig.setOptions(options); + SsoAccessTicketRequest ssoAccessTicketRequest = new SsoAccessTicketRequest(); ssoAccessTicketRequest.setConnectionConfig(connectionConfig); ssoAccessTicketRequest.setEnabledClients(new ArrayList() {{ - add("client-id"); + add("client-1"); }}); EnabledOrganizations enabledOrganizations = new EnabledOrganizations(); @@ -80,23 +74,15 @@ public void serialize() throws Exception { ssoAccessTicketRequest.setTtlSec(0); - ssoAccessTicketRequest.setDomainAliasesConfig(new DomainAliasesConfig("domain-verification")); + ssoAccessTicketRequest.setDomainAliasesConfig(new DomainAliasesConfig("none")); String serialized = toJSON(ssoAccessTicketRequest); assertThat(ssoAccessTicketRequest, is(notNullValue())); - - - assertThat(serialized, containsString("\"name\":\"sso-test1\"")); - assertThat(serialized, containsString("\"display_name\":\"sso-test1\"")); - assertThat(serialized, containsString("\"is_domain_connection\":true")); - assertThat(serialized, containsString("\"show_as_button\":true")); - assertThat(serialized, containsString("\"icon_url\":\"url\"")); - assertThat(serialized, containsString("\"domain_aliases\":[\"acme.corp\"]")); - assertThat(serialized, containsString("\"idpinitiated\":{\"enabled\":true,\"client_id\":\"client-id\",\"client_protocol\":\"client-protocol\",\"client_authorizequery\":\"client-authorizequery\"}")); - assertThat(serialized, containsString("\"enabled_clients\":[\"client-id\"]")); + assertThat(serialized, containsString("{\"connection_config\":{\"metadata\":{},\"is_domain_connection\":true,\"show_as_button\":true,\"name\":\"okta\",\"options\":{\"icon_url\":\"https://cdn.auth0.com/connections/okta.png\",\"domain_aliases\":[\"acme.corp\"],\"idpinitiated\":{\"client_authorizequery\":\"response_type=code&scope=openid%20profile%20email\",\"client_protocol\":\"oauth2\",\"enabled\":true,\"client_id\":\"client-1\"}},\"display_name\":\"okta connection\"},\"enabled_clients\":[\"client-1\"],\"enabled_organizations\":[{\"organization_id\":\"org_1\",\"assign_membership_on_login\":true,\"show_as_button\":true}],\"ttl_sec\":0,\"domain_aliases_config\":{\"domain_verification\":\"none\"}}")); + assertThat(serialized, containsString("\"enabled_clients\":[\"client-1\"]")); assertThat(serialized, containsString("\"enabled_organizations\":[{\"organization_id\":\"org_1\",\"assign_membership_on_login\":true,\"show_as_button\":true}]")); assertThat(serialized, containsString("\"ttl_sec\":0")); - assertThat(serialized, containsString("\"domain_aliases_config\":{\"domain_verification\":\"domain-verification\"}")); + assertThat(serialized, containsString("\"domain_aliases_config\":{\"domain_verification\":\"none\"}")); } } diff --git a/src/test/resources/mgmt/self_service_profile_sso_ticket_request.json b/src/test/resources/mgmt/self_service_profile_sso_ticket_request.json index 234467797..cd18124f4 100644 --- a/src/test/resources/mgmt/self_service_profile_sso_ticket_request.json +++ b/src/test/resources/mgmt/self_service_profile_sso_ticket_request.json @@ -1,7 +1,7 @@ { "connection_config": { - "name": "sso-test1", - "display_name": "sso-test1", + "name": "okta", + "display_name": "okta connection", "is_domain_connection": true, "show_as_button": true, "metadata": { @@ -15,14 +15,14 @@ ], "idpinitiated": { "enabled": true, - "client_id": "client-id", - "client_protocol": "client-protocol", - "client_authorizequery": "client-authorizequery" + "client_id": "client-1", + "client_protocol": "oauth2", + "client_authorizequery": "response_type=code&scope=openid%20profile%20email" } } }, "enabled_clients": [ - "client-id" + "client-1" ], "enabled_organizations": [ { @@ -33,6 +33,6 @@ ], "ttl_sec": 0, "domain_aliases_config": { - "domain_verification": "domain-verification" + "domain_verification": "none" } } From 3aaaa71d636062f3e531dbda91f17b12ed2b0176 Mon Sep 17 00:00:00 2001 From: tanya732 Date: Mon, 24 Mar 2025 19:05:10 +0530 Subject: [PATCH 3/3] Added another support for existing users --- .../mgmt/SelfServiceProfilesEntity.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/java/com/auth0/client/mgmt/SelfServiceProfilesEntity.java b/src/main/java/com/auth0/client/mgmt/SelfServiceProfilesEntity.java index 10edf576b..38d9373b3 100644 --- a/src/main/java/com/auth0/client/mgmt/SelfServiceProfilesEntity.java +++ b/src/main/java/com/auth0/client/mgmt/SelfServiceProfilesEntity.java @@ -1,5 +1,6 @@ package com.auth0.client.mgmt; +import com.auth0.client.auth.AuthAPI; import com.auth0.client.mgmt.filter.PageBasedPaginationFilter; import com.auth0.json.mgmt.selfserviceprofiles.*; import com.auth0.net.*; @@ -209,6 +210,34 @@ public Request createSsoAccessTicket(String id, SsoAcce return request; } + + /** + * Create a new SSO access ticket. + * A token with {@code create:sso_access_tickets} scope is needed + * @see https://auth0.com/docs/api/management/v2#!/self-service-profiles/post-sso-ticket + * @param id the self-service profile ID. + * @param payload the payload. + * @return a Request to execute. + * + * @deprecated Use {@link #createSsoAccessTicket(String, SsoAccessTicketRequest)} to create sso access ticket. + */ + @Deprecated + public Request createSsoAccessTicket(String id, Object payload) { + Asserts.assertNotNull(id, "id"); + Asserts.assertNotNull(payload, "payload"); + + HttpUrl.Builder builder = baseUrl.newBuilder() + .addPathSegments(ORGS_PATH) + .addPathSegment(id) + .addPathSegment("sso-ticket"); + String url = builder.build().toString(); + + BaseRequest request = new BaseRequest<>(this.client, tokenProvider, url, HttpMethod.POST, new TypeReference() { + }); + request.setBody(payload); + return request; + } + /** * Revoke an SSO ticket. * A token with {@code delete:sso_access_tickets} scope is needed