[java-plugin-shibd-oidc] branch dev/JSHIBDOIDC-28 updated: JCOMOIDC-176 - Add logout request handlers

Codeberg noreply at shibboleth.net
Fri Jul 3 13:48:56 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch dev/JSHIBDOIDC-28
in repository java-plugin-shibd-oidc.

View the commit online:
https://codeberg.org/Shibboleth/java-plugin-shibd-oidc/commit/5600ca0094c74c1e7453c8ef94a51754ca40b988

The following commit(s) were added to refs/heads/dev/JSHIBDOIDC-28 by this push:
     new 5600ca0  JCOMOIDC-176 - Add logout request handlers
5600ca0 is described below

commit 5600ca0094c74c1e7453c8ef94a51754ca40b988
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Jul 3 14:48:46 2026 +0100

    JCOMOIDC-176 - Add logout request handlers
    
     - Move the logout request handlers to oidc-common
    
    https://shibboleth.atlassian.net/browse/JCOMOIDC-176
---
 .../flows/sp/logout/initiator/oidc/oidc-beans.xml  | 10 +--
 .../sp/oidc/profile/impl/AddClientIDHandler.java   | 52 -------------
 .../oidc/profile/impl/AddIDTokenHintHandler.java   | 91 ----------------------
 .../sp/oidc/profile/impl/AddLogoutHintHandler.java | 54 -------------
 .../impl/AddPostLogoutRedirectURIHandler.java      | 55 -------------
 .../sp/oidc/profile/impl/AddUILocalesHandler.java  | 68 ----------------
 6 files changed, 5 insertions(+), 325 deletions(-)

diff --git a/sp-oidc-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/logout/initiator/oidc/oidc-beans.xml b/sp-oidc-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/logout/initiator/oidc/oidc-beans.xml
index 70120b9..05e2077 100644
--- a/sp-oidc-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/logout/initiator/oidc/oidc-beans.xml
+++ b/sp-oidc-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/logout/initiator/oidc/oidc-beans.xml
@@ -48,7 +48,7 @@
                 <property name="handlers">
                     <list>
                         <bean id="AddIDTokenHint" scope="prototype" parent="LogoutRequestHandler"
-                            class="net.shibboleth.sp.oidc.profile.impl.AddIDTokenHintHandler">
+                            class="net.shibboleth.oidc.profile.messaging.handler.impl.AddIDTokenHintHandler">
                             <property name="parameterValueLookupStrategy">
                                 <bean class="net.shibboleth.sp.oidc.profile.context.navigate.IDTokenHintLookupStrategy"
                                     c:oidcLogoutContextLookupStrategy-ref="shibboleth.ChildLookup.LogoutContext"
@@ -57,14 +57,14 @@
                         </bean>
                         <!-- Should this be conditional on the ID Token Hint being present? -->
                         <bean id="AddLogoutHint" scope="prototype" parent="LogoutRequestHandler"
-                            class="net.shibboleth.sp.oidc.profile.impl.AddLogoutHintHandler">
+                            class="net.shibboleth.oidc.profile.messaging.handler.impl.AddLogoutHintHandler">
                            <!--  <property name="parameterValueLookupStrategy">
                                 <bean class="net.shibboleth.sp.oidc.profile.config.navigate.ResponseTypeLookupStrategy"
                                     scope="prototype" />
                             </property> -->
                         </bean>
                         <bean id="AddClientID" scope="prototype" parent="LogoutRequestHandler"
-                            class="net.shibboleth.sp.oidc.profile.impl.AddClientIDHandler">
+                            class="net.shibboleth.oidc.profile.messaging.handler.impl.AddClientIDHandler">
                            <property name="parameterValueLookupStrategy">
                                 <bean class="net.shibboleth.sp.oidc.profile.config.navigate.ClientIDLookupStrategy"
                                     scope="prototype" 
@@ -72,14 +72,14 @@
                             </property>
                         </bean>
                         <bean id="AddPostLogoutRedirectURI" scope="prototype" parent="LogoutRequestHandler"
-                            class="net.shibboleth.sp.oidc.profile.impl.AddPostLogoutRedirectURIHandler">
+                            class="net.shibboleth.oidc.profile.messaging.handler.impl.AddPostLogoutRedirectURIHandler">
                            <!--  <property name="parameterValueLookupStrategy">
                                 <bean class="net.shibboleth.sp.oidc.profile.config.navigate.ResponseTypeLookupStrategy"
                                     scope="prototype" />
                             </property> -->
                         </bean>
                         <bean id="AddUILocales" scope="prototype" parent="LogoutRequestHandler"
-                            class="net.shibboleth.sp.oidc.profile.impl.AddUILocalesHandler">
+                            class="net.shibboleth.oidc.profile.messaging.handler.impl.AddLogoutUILocalesHandler">
                             <property name="parameterValueLookupStrategy">
                                 <bean class="net.shibboleth.sp.oidc.profile.config.navigate.UiLocalesLookupStrategy"
                                     scope="prototype" />
diff --git a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddClientIDHandler.java b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddClientIDHandler.java
deleted file mode 100644
index 172ec36..0000000
--- a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddClientIDHandler.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.oidc.profile.impl;
-
-import javax.annotation.Nonnull;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.messaging.handler.MessageHandlerException;
-import org.slf4j.Logger;
-
-import com.nimbusds.oauth2.sdk.id.ClientID;
-
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.shared.primitive.StringSupport;
-
-/**
- * A message handler that populates the client_id parameter into the logout request.
- */
-public class AddClientIDHandler extends AbstractLogoutRequestParameterValueMessageHandler<String> {
-
-    /** Logger. */
-    @Nonnull private final Logger log = LoggerFactory.getLogger(AddClientIDHandler.class);
-    
-    /** Constructor.*/
-    public AddClientIDHandler() {
-        super(String.class);
-    }    
-    
-    /** {@inheritDoc} */
-    @Override
-    protected void doInvoke(@Nonnull final MessageContext messageContext) throws MessageHandlerException {
-        
-        final String clientId = getParameterValue(messageContext);
-        if (StringSupport.trimOrNull(clientId) == null) {
-            return;
-        }
-        getLogoutRequest().setClientID(new ClientID(clientId));
-        log.trace("{}: Set client_id to '{}'", getLogPrefix(), clientId);          
-    }
-}
\ No newline at end of file
diff --git a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddIDTokenHintHandler.java b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddIDTokenHintHandler.java
deleted file mode 100644
index 3b16477..0000000
--- a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddIDTokenHintHandler.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.oidc.profile.impl;
-
-import java.text.ParseException;
-
-import javax.annotation.Nonnull;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.messaging.handler.MessageHandlerException;
-import org.slf4j.Logger;
-
-import com.nimbusds.jwt.EncryptedJWT;
-import com.nimbusds.jwt.JWT;
-import com.nimbusds.jwt.JWTClaimsSet;
-
-import net.shibboleth.shared.primitive.LoggerFactory;
-
-/**
- * A message handler that populates the id_token_hint parameter into the logout request.
- */
-public class AddIDTokenHintHandler extends AbstractLogoutRequestParameterValueMessageHandler<JWT> {
-
-    /** Logger. */
-    @Nonnull private final Logger log = LoggerFactory.getLogger(AddIDTokenHintHandler.class);
-    
-    /** Constructor.*/
-    public AddIDTokenHintHandler() {
-        super(JWT.class);
-    }    
-    
-    /** {@inheritDoc} */
-    @Override
-    protected void doInvoke(@Nonnull final MessageContext messageContext) throws MessageHandlerException {
-        
-        final JWT idTokenHint = getParameterValue(messageContext);
-        if (idTokenHint == null) {
-            return;
-        }
-        if (idTokenHint instanceof EncryptedJWT) {
-            log.trace("{}: ID Token is still encrypted, possibly for the wrong target, this maybe ignored by "
-                    + "the OP", getLogPrefix());
-        }
-        getLogoutRequest().setIdTokenHint(idTokenHint);
-        if (log.isTraceEnabled()) {
-            log.trace("{}: Set id_token_hint for subject '{}'", getLogPrefix(), 
-                    getSubjectOrDefault(idTokenHint,"not-available"));
-        }
-        
-    }
-    
-    /**
-     * Get the subject from the id_token, else return the default value.
-     * 
-     * @param idToken the id_token to extract the subject from
-     * @param defaultSubject the default subject to return if the subject can not be extracted
-     * 
-     * @return the subject, either from the id_token or the default value
-     */
-    private String getSubjectOrDefault(final JWT idToken, final String defaultSubject) {
-
-        if (idToken instanceof EncryptedJWT) {
-            return defaultSubject;
-        }
-
-        try {
-            final JWTClaimsSet claims = idToken.getJWTClaimsSet();
-            if (claims != null) {
-                return claims.getSubject() != null ? claims.getSubject() : defaultSubject;
-            }
-        } catch (final ParseException e) {
-            // Ignore
-        }
-        return defaultSubject;
-        
-    }
-
-
-}
\ No newline at end of file
diff --git a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddLogoutHintHandler.java b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddLogoutHintHandler.java
deleted file mode 100644
index c20e4f7..0000000
--- a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddLogoutHintHandler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.oidc.profile.impl;
-
-import javax.annotation.Nonnull;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.messaging.handler.MessageHandlerException;
-import org.slf4j.Logger;
-
-import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.shared.primitive.StringSupport;
-
-/**
- * A message handler that populates the logout_hint parameter into the logout request.
- */
-public class AddLogoutHintHandler extends AbstractLogoutRequestParameterValueMessageHandler<String> {
-
-    /** Logger. */
-    @Nonnull private final Logger log = LoggerFactory.getLogger(AddLogoutHintHandler.class);
-    
-    /** Constructor.*/
-    public AddLogoutHintHandler() {
-        super(String.class);
-    }    
-    
-    /** {@inheritDoc} */
-    @Override
-    protected void doInvoke(@Nonnull final MessageContext messageContext) throws MessageHandlerException {
-        
-        final String logoutHint = getParameterValue(messageContext);
-        if (StringSupport.trimOrNull(logoutHint) == null) {
-            return;
-        }
-        getLogoutRequest().setLogoutHint(logoutHint);
-        log.trace("{}: Set logout_hint to '{}'", getLogPrefix(), logoutHint);
-        
-    }
-    
-
-
-}
\ No newline at end of file
diff --git a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddPostLogoutRedirectURIHandler.java b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddPostLogoutRedirectURIHandler.java
deleted file mode 100644
index aaf5e0e..0000000
--- a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddPostLogoutRedirectURIHandler.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.oidc.profile.impl;
-
-import java.net.URI;
-
-import javax.annotation.Nonnull;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.messaging.handler.MessageHandlerException;
-import org.slf4j.Logger;
-
-import net.shibboleth.shared.primitive.LoggerFactory;
-
-/**
- * A message handler that populates the client_id parameter into the logout request.
- */
-public class AddPostLogoutRedirectURIHandler extends AbstractLogoutRequestParameterValueMessageHandler<URI> {
-
-    /** Logger. */
-    @Nonnull private final Logger log = LoggerFactory.getLogger(AddPostLogoutRedirectURIHandler.class);
-    
-    /** Constructor.*/
-    public AddPostLogoutRedirectURIHandler() {
-        super(URI.class);
-    }    
-    
-    /** {@inheritDoc} */
-    @Override
-    protected void doInvoke(@Nonnull final MessageContext messageContext) throws MessageHandlerException {
-        
-        final URI postRedirectUri = getParameterValue(messageContext);
-        if (postRedirectUri == null) {
-            return;
-        }
-        getLogoutRequest().setPostLogoutRedirectURI(postRedirectUri);
-        log.trace("{}: Set post_logout_redirect_uri to '{}'", getLogPrefix(), postRedirectUri);
-        
-    }
-    
-
-
-}
\ No newline at end of file
diff --git a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddUILocalesHandler.java b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddUILocalesHandler.java
deleted file mode 100644
index 6691be0..0000000
--- a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/AddUILocalesHandler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.sp.oidc.profile.impl;
-
-import java.util.List;
-import java.util.Objects;
-
-import javax.annotation.Nonnull;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.messaging.handler.MessageHandlerException;
-import org.slf4j.Logger;
-
-import com.nimbusds.langtag.LangTag;
-import com.nimbusds.langtag.LangTagException;
-
-import net.shibboleth.shared.primitive.LoggerFactory;
-
-/**
- * A message handler that populates the client_id parameter into the logout request.
- */
-public class AddUILocalesHandler extends AbstractLogoutRequestParameterValueMessageHandler<List<String>> {
-
-    /** Class logger. */
-    @Nonnull private final Logger log = LoggerFactory.getLogger(AddUILocalesHandler.class);
-
-    /** Constructor.*/
-    public AddUILocalesHandler() {
-        super((Class)List.class);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void doInvoke(@Nonnull final MessageContext messageContext) throws MessageHandlerException {
-
-        final List<String> locales = getParameterValue(messageContext);
-        if (locales != null && !locales.isEmpty()) {
-            if (log.isTraceEnabled()) {
-                log.trace("{} Setting 'ui_locales={}'", getLogPrefix(), locales);
-            }
-            final List<LangTag> uiLocals = locales.stream().map(tag -> {
-                try {
-                    return LangTag.parse(tag);
-                } catch (final LangTagException e) {
-                    log.warn("Can not parse language tag '{}'", tag);
-                }
-                return null;
-            }).filter(Objects::nonNull).toList();
-            
-            getLogoutRequest().setUiLocales(uiLocals);            
-        }
-    }
-    
-
-
-}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list