Repository: cxf Updated Branches: refs/heads/master 156b166b0 -> f6b153c1c
Support for the dyn reg of the OIDC rp initoated logout uris Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f6b153c1 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f6b153c1 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f6b153c1 Branch: refs/heads/master Commit: f6b153c1c3d828ddd113cd446b4849d0c0b8d636 Parents: 156b166 Author: Sergey Beryozkin <[email protected]> Authored: Mon Feb 27 16:23:54 2017 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Mon Feb 27 16:23:54 2017 +0000 ---------------------------------------------------------------------- .../idp/OidcDynamicRegistrationService.java | 31 +++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/f6b153c1/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcDynamicRegistrationService.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcDynamicRegistrationService.java b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcDynamicRegistrationService.java index cbd0c6c..39cf8b2 100644 --- a/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcDynamicRegistrationService.java +++ b/rt/rs/security/sso/oidc/src/main/java/org/apache/cxf/rs/security/oidc/idp/OidcDynamicRegistrationService.java @@ -18,24 +18,47 @@ */ package org.apache.cxf.rs.security.oidc.idp; +import java.util.LinkedList; +import java.util.List; + import org.apache.cxf.rs.security.oauth2.common.Client; import org.apache.cxf.rs.security.oauth2.services.ClientRegistration; import org.apache.cxf.rs.security.oauth2.services.ClientRegistrationResponse; import org.apache.cxf.rs.security.oauth2.services.DynamicRegistrationService; public class OidcDynamicRegistrationService extends DynamicRegistrationService { + private static final String RP_INITIATED_LOGOUT_URIS = "post_logout_redirect_uris"; private boolean protectIdTokenWithClientSecret; @Override protected Client createNewClient(ClientRegistration request) { - //TODO: set OIDC specific properties as Client extra properties - return super.createNewClient(request); + Client client = super.createNewClient(request); + List<String> logoutUris = request.getListStringProperty(RP_INITIATED_LOGOUT_URIS); + if (logoutUris != null) { + StringBuilder sb = new StringBuilder(); + for (String uri : logoutUris) { + if (sb.length() > 0) { + sb.append(" "); + } + sb.append(uri); + } + client.getProperties().put(RP_INITIATED_LOGOUT_URIS, sb.toString()); + } + return client; } @Override protected ClientRegistrationResponse fromClientToRegistrationResponse(Client client) { - //TODO: check OIDC specific properties in Client extra properties - return super.fromClientToRegistrationResponse(client); + ClientRegistrationResponse resp = super.fromClientToRegistrationResponse(client); + String logoutUris = client.getProperties().get(RP_INITIATED_LOGOUT_URIS); + if (logoutUris != null) { + List<String> list = new LinkedList<String>(); + for (String s : logoutUris.split(" ")) { + list.add(s); + } + resp.setProperty(RP_INITIATED_LOGOUT_URIS, list); + } + return resp; } @Override
