diff --git a/src/main/java/com/auth0/json/mgmt/tickets/EmailVerificationTicket.java b/src/main/java/com/auth0/json/mgmt/tickets/EmailVerificationTicket.java index ae6122aa..bcfc6633 100644 --- a/src/main/java/com/auth0/json/mgmt/tickets/EmailVerificationTicket.java +++ b/src/main/java/com/auth0/json/mgmt/tickets/EmailVerificationTicket.java @@ -25,6 +25,10 @@ public class EmailVerificationTicket { private String ticket; @JsonProperty("includeEmailInRedirect") private Boolean includeEmailInRedirect; + @JsonProperty("client_id") + private String clientId; + @JsonProperty("organization_id") + private String organizationId; @JsonProperty("identity") private EmailVerificationIdentity identity; @@ -72,6 +76,31 @@ public void setIncludeEmailInRedirect(Boolean includeEmailInRedirect) { this.includeEmailInRedirect = includeEmailInRedirect; } + /** + * Sets the ID of the client. If provided for tenants using New Universal Login experience, the user will be prompted + * to redirect to the default login route of the corresponding application once the ticket is used. + * + * @param clientId the ID of the client + * + * @see Configuring Default Login Routes + */ + @JsonProperty("client_id") + public void setClientId(String clientId) { + this.clientId = clientId; + } + + /** + * Sets the ID of the Organization. If provided, organization parameters will be made available to the email template + * and organization branding will be applied to the prompt. In addition, the redirect link in the prompt will include + * {@code organization_id} and {@code organization_name} query string parameters. + * + * @param organizationId the ID of the organization + */ + @JsonProperty("organization_id") + public void setOrganizationId(String organizationId) { + this.organizationId = organizationId; + } + /** * Sets the identity. Needed to verify primary identities when using social, enterprise, or passwordless connections. * It is also required to verify secondary identities. diff --git a/src/main/java/com/auth0/json/mgmt/tickets/PasswordChangeTicket.java b/src/main/java/com/auth0/json/mgmt/tickets/PasswordChangeTicket.java index b6ef52d2..fd58a3b0 100644 --- a/src/main/java/com/auth0/json/mgmt/tickets/PasswordChangeTicket.java +++ b/src/main/java/com/auth0/json/mgmt/tickets/PasswordChangeTicket.java @@ -32,6 +32,10 @@ public class PasswordChangeTicket { private Boolean markEmailAsVerified; @JsonProperty("organization_id") private String orgId; + @JsonProperty("client_id") + private String clientId; + @JsonProperty("includeEmailInRedirect") + private Boolean includeEmailInRedirect; @JsonCreator public PasswordChangeTicket(@JsonProperty("user_id") String userId) { @@ -44,7 +48,7 @@ public PasswordChangeTicket(String email, String connectionId) { } /** - * Setter for the id of the user this ticket is meant to. + * Setter for the id of the user for whom the ticket should be created. * * @param userId the user id to set. */ @@ -53,6 +57,18 @@ public void setUserId(String userId) { this.userId = userId; } + /** + * Setter for the client_id + * @param clientId the ID of the client to set + */ + public void setClientId(String clientId) { + this.clientId = clientId; + } + + public void setIncludeEmailInRedirect(Boolean includeEmailInRedirect) { + this.includeEmailInRedirect = includeEmailInRedirect; + } + /** * Setter for the url the user will be redirected to after using the ticket. * diff --git a/src/test/java/com/auth0/json/mgmt/tickets/EmailVerificationTicketTest.java b/src/test/java/com/auth0/json/mgmt/tickets/EmailVerificationTicketTest.java index c78aaf80..cf31eb4a 100644 --- a/src/test/java/com/auth0/json/mgmt/tickets/EmailVerificationTicketTest.java +++ b/src/test/java/com/auth0/json/mgmt/tickets/EmailVerificationTicketTest.java @@ -22,6 +22,8 @@ public void shouldSerialize() throws Exception { ticket.setResultUrl("https://page.auth0.com/result"); ticket.setTTLSeconds(36000); ticket.setIncludeEmailInRedirect(true); + ticket.setClientId("client_abc"); + ticket.setOrganizationId("org_abc"); String serialized = toJSON(ticket); assertThat(serialized, is(notNullValue())); @@ -29,6 +31,8 @@ public void shouldSerialize() throws Exception { assertThat(serialized, JsonMatcher.hasEntry("result_url", "https://page.auth0.com/result")); assertThat(serialized, JsonMatcher.hasEntry("ttl_sec", 36000)); assertThat(serialized, JsonMatcher.hasEntry("includeEmailInRedirect", true)); + assertThat(serialized, JsonMatcher.hasEntry("client_id", "client_abc")); + assertThat(serialized, JsonMatcher.hasEntry("organization_id", "org_abc")); } @Test @@ -59,4 +63,4 @@ public void shouldIncludeReadOnlyValuesOnDeserialize() throws Exception { assertThat(ticket.getTicket(), is("https://page.auth0.com/tickets/123")); } -} \ No newline at end of file +} diff --git a/src/test/java/com/auth0/json/mgmt/tickets/PasswordChangeTicketTest.java b/src/test/java/com/auth0/json/mgmt/tickets/PasswordChangeTicketTest.java index 024ab1b8..74996f5e 100644 --- a/src/test/java/com/auth0/json/mgmt/tickets/PasswordChangeTicketTest.java +++ b/src/test/java/com/auth0/json/mgmt/tickets/PasswordChangeTicketTest.java @@ -23,6 +23,8 @@ public void shouldSerialize() throws Exception { ticket.setNewPassword("pass123"); ticket.setMarkEmailAsVerified(true); ticket.setOrganizationId("org_abc"); + ticket.setClientId("client_abc"); + ticket.setIncludeEmailInRedirect(false); String serialized = toJSON(ticket); assertThat(serialized, is(notNullValue())); @@ -34,6 +36,8 @@ public void shouldSerialize() throws Exception { assertThat(serialized, JsonMatcher.hasEntry("email", "me@auth0.com")); assertThat(serialized, JsonMatcher.hasEntry("mark_email_as_verified", true)); assertThat(serialized, JsonMatcher.hasEntry("organization_id", "org_abc")); + assertThat(serialized, JsonMatcher.hasEntry("client_id", "client_abc")); + assertThat(serialized, JsonMatcher.hasEntry("includeEmailInRedirect", false)); } @SuppressWarnings("deprecation")