Skip to content

Commit

Permalink
[SDK-4736] support backchannel logout property on Client (#587)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjames authored Dec 6, 2023
1 parent 2f82901 commit 5557e1c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/main/java/com/auth0/json/mgmt/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public class Client {
private ClientAuthenticationMethods clientAuthenticationMethods;
@JsonProperty("require_pushed_authorization_requests")
private Boolean requiresPushedAuthorizationRequests;
@JsonProperty("oidc_backchannel_logout")
private OIDCBackchannelLogout oidcBackchannelLogout;

/**
* Getter for the name of the tenant this client belongs to.
Expand Down Expand Up @@ -820,5 +822,20 @@ public Boolean getRequiresPushedAuthorizationRequests() {
public void setRequiresPushedAuthorizationRequests(Boolean requiresPushedAuthorizationRequests) {
this.requiresPushedAuthorizationRequests = requiresPushedAuthorizationRequests;
}

/**
* @return the value of the {@code oidc_backchannel_logout} property.
*/
public OIDCBackchannelLogout getOidcBackchannelLogout() {
return oidcBackchannelLogout;
}

/**
* Sets the {@code oidc_backchannel_logout} property.
* @param oidcBackchannelLogout the value to set the {@code oidc_backchannel_logout} property to.
*/
public void setOidcBackchannelLogout(OIDCBackchannelLogout oidcBackchannelLogout) {
this.oidcBackchannelLogout = oidcBackchannelLogout;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.auth0.json.mgmt.client;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

/**
* Represents the value of the {@code oidc_backchannel_logout} property on an Auth0 application.\
* @see Client
* @see com.auth0.client.mgmt.ClientsEntity
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class OIDCBackchannelLogout {

@JsonProperty("backchannel_logout_urls")
private List<String> backchannelLogoutUrls;

/**
* Create a new instance with the given list of Logout URIs that will receive a {@code logout_token} when selected Back-Channel Logout Initiators occur.
* @param backchannelLogoutUrls the list of allowed backchannel logout URLs.
*/
public OIDCBackchannelLogout(@JsonProperty("backchannel_logout_urls") List<String> backchannelLogoutUrls) {
this.backchannelLogoutUrls = backchannelLogoutUrls;
}

/**
* @return the list of Logout URIs that will receive a {@code logout_token} when selected Back-Channel Logout Initiators occur.
*/
public List<String> getBackchannelLogoutUrls() {
return this.backchannelLogoutUrls;
}
}
8 changes: 7 additions & 1 deletion src/test/java/com/auth0/json/mgmt/client/ClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ public class ClientTest extends JsonTest<Client> {
" ]\n" +
" }\n" +
" },\n" +
" \"require_pushed_authorization_requests\": true\n" +
" \"require_pushed_authorization_requests\": true,\n" +
" \"oidc_backchannel_logout\": {\n" +
" \"backchannel_logout_urls\": [\"http://acme.eu.auth0.com/events\"]\n" +
" }\n" +
"}";

@Test
Expand Down Expand Up @@ -148,6 +151,7 @@ public void shouldSerialize() throws Exception {
ClientAuthenticationMethods cam = new ClientAuthenticationMethods(privateKeyJwt);
client.setClientAuthenticationMethods(cam);
client.setRequiresPushedAuthorizationRequests(true);
client.setOidcBackchannelLogout(new OIDCBackchannelLogout(Collections.singletonList("http://acme.eu.auth0.com/events")));

String serialized = toJSON(client);
assertThat(serialized, is(notNullValue()));
Expand Down Expand Up @@ -184,6 +188,7 @@ public void shouldSerialize() throws Exception {
assertThat(serialized, JsonMatcher.hasEntry("client_authentication_methods", notNullValue()));
assertThat(serialized, JsonMatcher.hasEntry("client_authentication_methods", containsString("{\"private_key_jwt\":{\"credentials\":[{\"credential_type\":\"public_key\",\"pem\":\"PEM\"}]}}")));
assertThat(serialized, JsonMatcher.hasEntry("require_pushed_authorization_requests", true));
assertThat(serialized, JsonMatcher.hasEntry("oidc_backchannel_logout", containsString("{\"backchannel_logout_urls\":[\"http://acme.eu.auth0.com/events\"]}")));
}

@Test
Expand Down Expand Up @@ -235,6 +240,7 @@ public void shouldDeserialize() throws Exception {
assertThat(client.getClientAuthenticationMethods().getPrivateKeyJwt().getCredentials().get(0).getId(), is("cred_abc"));
assertThat(client.getClientAuthenticationMethods().getPrivateKeyJwt().getCredentials().get(1).getId(), is("cred_123"));
assertThat(client.getRequiresPushedAuthorizationRequests(), is(true));
assertThat(client.getOidcBackchannelLogout().getBackchannelLogoutUrls().size(), is(1));
}

@Test
Expand Down

0 comments on commit 5557e1c

Please sign in to comment.