[java-oidc-common] branch main updated: JCOMOIDC-172 - Add OIDCLogoutRequest message class

Codeberg noreply at shibboleth.net
Fri Jun 26 16:06:11 UTC 2026


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

codeberg pushed a commit to branch main
in repository java-oidc-common.

View the commit online:
https://codeberg.org/Shibboleth/java-oidc-common/commit/a97518946923af2eb6c2562e47e64f247e089a0d

The following commit(s) were added to refs/heads/main by this push:
     new a9751894 JCOMOIDC-172 - Add OIDCLogoutRequest message class
a9751894 is described below

commit a97518946923af2eb6c2562e47e64f247e089a0d
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Jun 26 17:05:59 2026 +0100

    JCOMOIDC-172 - Add OIDCLogoutRequest message class
    
     - Add LogoutRequest to carry logout parameters as the logout request is
    being built.
     - Add a new OIDC Event if the logout endpoint can not be located for an
    OP
    
    https://shibboleth.atlassian.net/browse/JCOMOIDC-172
---
 .../oidc/profile/core/OIDCLogoutRequest.java       | 212 +++++++++++++++++++++
 .../shibboleth/oidc/profile/core/OidcEventIds.java |   7 +
 2 files changed, 219 insertions(+)

diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OIDCLogoutRequest.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OIDCLogoutRequest.java
new file mode 100644
index 00000000..08430d60
--- /dev/null
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OIDCLogoutRequest.java
@@ -0,0 +1,212 @@
+/*
+ * 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.oidc.profile.core;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.annotation.concurrent.NotThreadSafe;
+
+import com.nimbusds.jwt.JWT;
+import com.nimbusds.langtag.LangTag;
+import com.nimbusds.oauth2.sdk.id.ClientID;
+import com.nimbusds.oauth2.sdk.id.State;
+
+import net.shibboleth.shared.annotation.constraint.NonnullElements;
+import net.shibboleth.shared.annotation.constraint.NotLive;
+import net.shibboleth.shared.annotation.constraint.Unmodifiable;
+import net.shibboleth.shared.collection.CollectionSupport;
+import net.shibboleth.shared.logic.Constraint;
+
+/**
+ * OpenID Connect RP-Initiated Logout Request.
+ *
+ * <p>This class is intentionally mutable and not thread-safe.</p>
+ * 
+ * @since 3.4.0
+ */
+ at NotThreadSafe
+public class OIDCLogoutRequest {
+
+    /** The logout endpoint. */
+    @Nonnull private URI logoutEndpoint;
+
+    /** The ID Token hint. Optional but typically required by OPs. */
+    @Nullable private JWT idTokenHint;
+    
+    /** The login hint. Optional. */
+    @Nullable private String loginHint;
+    
+    /** The client identifier. Optional.*/
+    @Nullable private ClientID clientID;
+
+    /** The post logout redirect URI. Optional. */
+    @Nullable private URI postLogoutRedirectURI;
+
+    /** Opaque state value. Optional but recommended. */
+    @Nullable private State state;
+    
+    /** End-User's preferred languages and scripts for the user interface. Optional. */
+    @Nonnull @NotLive private List<LangTag> uiLocales;
+    
+    /**
+     * Constructor.
+     *
+     * @param endpoint the end_session_endpoint logout endpoint.
+     */
+    public OIDCLogoutRequest(@Nonnull final URI endpoint) {
+        logoutEndpoint =  Constraint.isNotNull(endpoint, "Logout endpoint can not be null");
+        uiLocales = CollectionSupport.emptyList();
+    }
+
+    /**
+     * Get the logout endpoint to send the request to.
+     * 
+     * @return the logout endpoint.
+     */
+    @Nonnull
+    public URI getLogoutEndpoint() {
+        return logoutEndpoint;
+    }
+
+    /**
+     * Set the logout endpoint to send the request to.
+     * 
+     * @param endpoint the logout endpoint.
+     */
+    public void setLogoutEndpoint(@Nonnull final URI endpoint) {
+        logoutEndpoint = Constraint.isNotNull(endpoint, "Logout endpoint can not be null");
+    }
+
+    /**
+     * Get the id_token_hint parameter.
+     * 
+     * @return the ID token hint.
+     */
+    @Nullable public JWT getIdTokenHint() {
+        return idTokenHint;
+    }
+
+    /**
+     * Set the id_token_hint parameter.
+     * 
+     * @param hint the ID token hint
+     */
+    public void setIdTokenHint(@Nullable final JWT hint) {
+        idTokenHint = hint;
+    }
+    
+    /**
+     * Get the login_hint parameter.
+     * 
+     * @return the login hint.
+     */
+    @Nullable public String getLoginHint() {
+        return loginHint;
+    }
+    
+    /**
+     * Set the login_hint parameter.
+     * 
+     * @param hint The login hint to set.
+     */
+    public void setLoginHint(@Nullable final String hint) {
+        loginHint = hint;
+    }
+    
+    /**
+     * Get the client ID. 
+     * 
+     * @return the clientID.
+     */
+    @Nullable public ClientID getClientID() {
+        return clientID;
+    }
+    
+    /**
+     * Set the client ID. 
+     * 
+     * @param id The clientID.
+     */
+    public void setClientID(@Nullable final ClientID id) {
+        clientID = id;
+    }
+
+    /**
+     * Get the post_logout_redirect_uri parameter.
+     * 
+     * @return the post logout redirect URI parameter.
+     */
+    @Nullable
+    public URI getPostLogoutRedirectURI() {
+        return postLogoutRedirectURI;
+    }
+
+    /**
+     * Set the post_logout_redirect_uri parameter.
+     * 
+     * @param uri the post logout redirect URI parameter.
+     */
+    public void setPostLogoutRedirectURI(@Nullable final URI uri) {
+        postLogoutRedirectURI = uri;
+    }
+
+    /** 
+     * Get the state parameter.
+     * 
+     * @return the state parameter.
+     */
+    @Nullable
+    public State getState() {
+        return state;
+    }
+
+    /**
+     * Set the state parameter.
+     * 
+     * @param stateIn he state parameter.
+     */
+    public void setState(@Nullable final State stateIn) {
+        state = stateIn;
+    }
+    
+    /**
+     * Set the list of optional ui_locales that specifies the End-User's preferred languages and scripts for the 
+     * user interface.
+     *  
+     * @param locales The uiLocales to set.
+     */
+    public void setUiLocales(@Nullable @NonnullElements final List<LangTag> locales) {
+        if (locales != null) {
+            uiLocales = locales.stream().filter(Objects::nonNull)
+                    .collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableList())).get();
+        }
+    }
+    
+    /**
+     * Get the list of optional ui_locales that specifies the End-User's preferred languages and scripts for the 
+     * user interface.
+     * 
+     * @return the uiLocales.
+     */
+    @Nonnull @NotLive @Unmodifiable public List<LangTag> getUiLocales() {
+        return CollectionSupport.copyToList(uiLocales);
+    }
+
+}
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OidcEventIds.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OidcEventIds.java
index f8253b6c..93f8351f 100644
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OidcEventIds.java
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OidcEventIds.java
@@ -195,6 +195,13 @@ public final class OidcEventIds {
      * @since 3.2.0
      */
     @Nonnull @NotEmpty public static final String MISSING_MANDATORY_PAR_REQUEST_URI = "MissingMandatoryParRequest";
+    
+    /**
+     * ID of an event returned if the end session endpoint (logout endpoint) for an OP can not be found.
+     * 
+     * @since 3.4.0
+     */
+    @Nonnull @NotEmpty public static final String MISSING_END_SESSION_ENDPOINT = "MissingEndSessionEndpoint";
 
     /**
      * Constructor.

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


More information about the commits mailing list