[java-oidc-common] 20/20: Cleanups before merging back to main

Codeberg noreply at shibboleth.net
Tue Feb 17 20:14:55 UTC 2026


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

codeberg pushed a commit to branch dev/JCOMOIDC-139
in repository java-oidc-common.

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

commit 0f6434d258e39e0a411ff2b1679a8c05a6927c52
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Tue Feb 17 20:05:09 2026 +0000

    Cleanups before merging back to main
---
 .../impl/AbstractTokenResponseLookupStrategy.java  |  4 +-
 .../oidc/profile/context/OIDCAuthnContext.java     | 94 ----------------------
 .../context/OutboundMessageHandlerContext.java     | 69 ----------------
 .../AbstractTokenResponseLookupStrategy.java       |  2 +-
 .../profile/core/OAuthAuthorizationRequest.java    |  6 +-
 .../shibboleth/oidc/profile/core/StateToken.java   |  6 +-
 .../messaging/handler/impl/AddStateHandler.java    |  2 +-
 7 files changed, 11 insertions(+), 172 deletions(-)

diff --git a/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/jwt/claims/impl/AbstractTokenResponseLookupStrategy.java b/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/jwt/claims/impl/AbstractTokenResponseLookupStrategy.java
index 4239fab3..986ca243 100644
--- a/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/jwt/claims/impl/AbstractTokenResponseLookupStrategy.java
+++ b/oidc-common-crypto-impl/src/main/java/net/shibboleth/oidc/security/jwt/claims/impl/AbstractTokenResponseLookupStrategy.java
@@ -25,10 +25,10 @@ import org.opensaml.profile.context.navigate.InboundMessageContextLookup;
 import net.shibboleth.oidc.profile.context.AccessTokenResponseContext;
 import net.shibboleth.shared.logic.Constraint;
 
-/** Base class for looking up the token response context.*/
+/** Base class for looking up the access token response context.*/
 public abstract class AbstractTokenResponseLookupStrategy {
     
-    /** Strategy used to locate the {@link AccessTokenResponseContext} to extract the id_token from.*/
+    /** Strategy used to locate the {@link AccessTokenResponseContext}.*/
     @Nonnull 
     private final Function<ProfileRequestContext, AccessTokenResponseContext> tokenResponseContextLookupStrategy;
     
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/context/OIDCAuthnContext.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/context/OIDCAuthnContext.java
deleted file mode 100644
index e70a71a6..00000000
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/context/OIDCAuthnContext.java
+++ /dev/null
@@ -1,94 +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.oidc.profile.context;
-
-import java.util.function.Function;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.opensaml.messaging.context.BaseContext;
-import org.opensaml.messaging.decoder.MessageDecoder;
-import org.opensaml.messaging.handler.MessageHandler;
-import org.opensaml.profile.action.ProfileAction;
-
-import net.shibboleth.shared.logic.Constraint;
-
-/**
- * Manages state during proxied OIDC authentication via a Spring Controller.
- */
-public class OIDCAuthnContext extends BaseContext {
-    
-    /** Outbound message handler to run prior to encoding. */
-    @Nullable private MessageHandler outboundMessageHandler;
-    
-    /** Profile action to execute to produce outbound message response. */
-    @Nonnull private final ProfileAction encodeMessageAction;
-    
-    /** The function to use to obtain a decoder. */
-    @Nonnull private final Function<String,MessageDecoder> decoderFactory;
-    
-    /**
-     * Constructor.
-     *
-     * @param action message-encoding profile action
-     * @param factory the message descoder factory
-     */
-    public OIDCAuthnContext(@Nonnull final ProfileAction action,
-            @Nonnull final Function<String,MessageDecoder> factory) {
-        encodeMessageAction = Constraint.isNotNull(action, "Profile action cannot be null");
-        decoderFactory = Constraint.isNotNull(factory, "MessageDecoder factory cannot be null");
-    }
-    
-    /**
-     * Get the message-encoding profile action.
-     * 
-     * @return profile action
-     */
-    @Nonnull public ProfileAction getEncodeMessageAction() {
-        return encodeMessageAction;
-    }
-    
-    /**
-     * Get the outbound {@link MessageHandler} to run prior to encoding.
-     * 
-     * @return the outbound {@link MessageHandler}
-     */
-    @Nullable public MessageHandler getOutboundMessageHandler() {
-        return outboundMessageHandler;
-    }
-    
-    /**
-     * Set the outbound {@link MessageHandler} to run prior to encoding.
-     * 
-     * @param handler outbound {@link MessageHandler} to set
-     * 
-     * @return this context
-     */
-    @Nonnull public OIDCAuthnContext setOutboundMessageHandler(@Nullable final MessageHandler handler) {
-        outboundMessageHandler = handler;        
-        return this;
-    }
-    
-    /**
-     * Get the factory function to obtain message decoders.
-     * 
-     * @return factory function
-     */
-    @Nonnull public Function<String,MessageDecoder> getMessageDecoderFactory() {
-        return decoderFactory;
-    }
-
-}
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/context/OutboundMessageHandlerContext.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/context/OutboundMessageHandlerContext.java
deleted file mode 100644
index 0c42af1d..00000000
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/context/OutboundMessageHandlerContext.java
+++ /dev/null
@@ -1,69 +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.oidc.profile.context;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import org.opensaml.messaging.context.BaseContext;
-
-import net.shibboleth.shared.logic.Constraint;
-
-/** 
- * A context to stash controller parameters for use by message handlers.
- * For example, the OIDC RP preEncodeMessageHandlers.
- */
-public class OutboundMessageHandlerContext extends BaseContext {
-    
-    /** The spring webflow key.*/
-    @Nullable private String webflowKey;
-
-    /**
-     * Convenience constructor.
-     *
-     * @param key the swf key
-     */
-    public OutboundMessageHandlerContext(@Nonnull final String key) {
-        super();       
-        webflowKey = Constraint.isNotNull(key, "Spring Webflow Key can not be null");
-    }
-    
-    /** Constructor to allow no-arg construction.*/
-    public OutboundMessageHandlerContext() {
-        // Do nothing
-    }
-    
-    /**
-     * Set the Spring Webflow execution key.
-     *  
-     * @param key the swf execution key
-     * 
-     * @return this
-     */
-    public OutboundMessageHandlerContext setWebflowKey(@Nonnull final String key) {
-        webflowKey = Constraint.isNotNull(key, "Spring Webflow Key can not be null");
-        return this;
-    }
-
-    /**
-     * Get the Spring Webflow execution key.
-     * 
-     * @return Returns the webflowKey.
-     */
-    @Nullable public String getWebflowKey() {
-        return webflowKey;
-    } 
-
-}
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/context/navigate/AbstractTokenResponseLookupStrategy.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/context/navigate/AbstractTokenResponseLookupStrategy.java
index 0a28dde9..621b25a3 100644
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/context/navigate/AbstractTokenResponseLookupStrategy.java
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/context/navigate/AbstractTokenResponseLookupStrategy.java
@@ -28,7 +28,7 @@ import net.shibboleth.shared.logic.Constraint;
 /** Base class for looking up the token response context.*/
 public abstract class AbstractTokenResponseLookupStrategy {
     
-    /** Strategy used to locate the {@link AccessTokenResponseContext} to extract the id_token from.*/
+    /** Strategy used to locate the {@link AccessTokenResponseContext}.*/
     @Nonnull 
     private final Function<ProfileRequestContext, AccessTokenResponseContext> tokenResponseContextLookupStrategy;
     
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OAuthAuthorizationRequest.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OAuthAuthorizationRequest.java
index dc40caa2..f6629798 100644
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OAuthAuthorizationRequest.java
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/OAuthAuthorizationRequest.java
@@ -173,7 +173,7 @@ public class OAuthAuthorizationRequest {
      * 
      * @param theState The state to set.
      */
-    public void setState(@Nullable final StateToken theState) {
+    public void setStateToken(@Nullable final StateToken theState) {
         state = theState;
     }
     
@@ -185,7 +185,9 @@ public class OAuthAuthorizationRequest {
     public void setState(@Nullable final State theState) {
         if (theState != null){
             state = new StateToken(theState.getValue(), null);
-        }
+        } else {
+            state = null;
+        }        
     }
 
     /**
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/StateToken.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/StateToken.java
index 87ee8ce1..602446fe 100644
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/StateToken.java
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/core/StateToken.java
@@ -24,7 +24,7 @@ import net.minidev.json.JSONObject;
 public class StateToken {
     
     
-    /** The value of the state token in its string form ready to be added to an OAuth request. */
+    /** The value of the state token in its serialized form ready to be added to an OAuth request. */
     private final String value;
     
     /** The JSON object form of the state token if the state is encoded as a JSON object. */
@@ -34,7 +34,7 @@ public class StateToken {
      * 
      * Constructor.
      *
-     * @param stateValue the value of the state token in its string, can be null
+     * @param stateValue the value of the state token in its serialized form, can be null
      * @param jsonState the JSON object form of the state token, can be null.
      */
     public StateToken(@Nullable final String stateValue, @Nullable final JSONObject jsonState) {
@@ -43,7 +43,7 @@ public class StateToken {
     }
     
     /**
-     * Get the value of the state token in its string form ready to be added to an OAuth request.
+     * Get the value of the state token in its serialized form ready to be added to an OAuth request.
      * 
      * @return the state token value
      */
diff --git a/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/messaging/handler/impl/AddStateHandler.java b/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/messaging/handler/impl/AddStateHandler.java
index 2e24316e..06d54131 100644
--- a/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/messaging/handler/impl/AddStateHandler.java
+++ b/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/messaging/handler/impl/AddStateHandler.java
@@ -61,7 +61,7 @@ public class AddStateHandler extends AbstractAuthenticationRequestParameterValue
         log.trace("{} Generated state '{}'", getLogPrefix(), stateToken.getValue());
         
         // Add to outer request
-        getAuthenticationRequest().setState(stateToken);
+        getAuthenticationRequest().setStateToken(stateToken);
         
         // Add to Request Object if exists
         final ClaimsSet claims = getAuthenticationRequest().getRequestObjectClaimsSet();

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


More information about the commits mailing list