Skip to content

Commit 5557e1c

Browse files
authored
[SDK-4736] support backchannel logout property on Client (#587)
1 parent 2f82901 commit 5557e1c

3 files changed

Lines changed: 60 additions & 1 deletion

File tree

src/main/java/com/auth0/json/mgmt/client/Client.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ public class Client {
9494
private ClientAuthenticationMethods clientAuthenticationMethods;
9595
@JsonProperty("require_pushed_authorization_requests")
9696
private Boolean requiresPushedAuthorizationRequests;
97+
@JsonProperty("oidc_backchannel_logout")
98+
private OIDCBackchannelLogout oidcBackchannelLogout;
9799

98100
/**
99101
* Getter for the name of the tenant this client belongs to.
@@ -820,5 +822,20 @@ public Boolean getRequiresPushedAuthorizationRequests() {
820822
public void setRequiresPushedAuthorizationRequests(Boolean requiresPushedAuthorizationRequests) {
821823
this.requiresPushedAuthorizationRequests = requiresPushedAuthorizationRequests;
822824
}
825+
826+
/**
827+
* @return the value of the {@code oidc_backchannel_logout} property.
828+
*/
829+
public OIDCBackchannelLogout getOidcBackchannelLogout() {
830+
return oidcBackchannelLogout;
831+
}
832+
833+
/**
834+
* Sets the {@code oidc_backchannel_logout} property.
835+
* @param oidcBackchannelLogout the value to set the {@code oidc_backchannel_logout} property to.
836+
*/
837+
public void setOidcBackchannelLogout(OIDCBackchannelLogout oidcBackchannelLogout) {
838+
this.oidcBackchannelLogout = oidcBackchannelLogout;
839+
}
823840
}
824841

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.auth0.json.mgmt.client;
2+
3+
import com.fasterxml.jackson.annotation.JsonCreator;
4+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5+
import com.fasterxml.jackson.annotation.JsonInclude;
6+
import com.fasterxml.jackson.annotation.JsonProperty;
7+
8+
import java.util.List;
9+
10+
/**
11+
* Represents the value of the {@code oidc_backchannel_logout} property on an Auth0 application.\
12+
* @see Client
13+
* @see com.auth0.client.mgmt.ClientsEntity
14+
*/
15+
@JsonIgnoreProperties(ignoreUnknown = true)
16+
@JsonInclude(JsonInclude.Include.NON_NULL)
17+
public class OIDCBackchannelLogout {
18+
19+
@JsonProperty("backchannel_logout_urls")
20+
private List<String> backchannelLogoutUrls;
21+
22+
/**
23+
* 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.
24+
* @param backchannelLogoutUrls the list of allowed backchannel logout URLs.
25+
*/
26+
public OIDCBackchannelLogout(@JsonProperty("backchannel_logout_urls") List<String> backchannelLogoutUrls) {
27+
this.backchannelLogoutUrls = backchannelLogoutUrls;
28+
}
29+
30+
/**
31+
* @return the list of Logout URIs that will receive a {@code logout_token} when selected Back-Channel Logout Initiators occur.
32+
*/
33+
public List<String> getBackchannelLogoutUrls() {
34+
return this.backchannelLogoutUrls;
35+
}
36+
}

src/test/java/com/auth0/json/mgmt/client/ClientTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ public class ClientTest extends JsonTest<Client> {
9999
" ]\n" +
100100
" }\n" +
101101
" },\n" +
102-
" \"require_pushed_authorization_requests\": true\n" +
102+
" \"require_pushed_authorization_requests\": true,\n" +
103+
" \"oidc_backchannel_logout\": {\n" +
104+
" \"backchannel_logout_urls\": [\"http://acme.eu.auth0.com/events\"]\n" +
105+
" }\n" +
103106
"}";
104107

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

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

189194
@Test
@@ -235,6 +240,7 @@ public void shouldDeserialize() throws Exception {
235240
assertThat(client.getClientAuthenticationMethods().getPrivateKeyJwt().getCredentials().get(0).getId(), is("cred_abc"));
236241
assertThat(client.getClientAuthenticationMethods().getPrivateKeyJwt().getCredentials().get(1).getId(), is("cred_123"));
237242
assertThat(client.getRequiresPushedAuthorizationRequests(), is(true));
243+
assertThat(client.getOidcBackchannelLogout().getBackchannelLogoutUrls().size(), is(1));
238244
}
239245

240246
@Test

0 commit comments

Comments
 (0)