[java-plugin-shibd] branch main updated: Defer output message to later actions and allow for GET.

Scott Cantor cantor.2 at osu.edu
Thu May 30 16:42:23 UTC 2024


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

scantor pushed a commit to branch main
in repository java-plugin-shibd.

View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-shibd.git;a=commit;h=570424d359f29f4240df9c6a8d05b25079441312

The following commit(s) were added to refs/heads/main by this push:
     new 570424d  Defer output message to later actions and allow for GET.
570424d is described below

commit 570424d359f29f4240df9c6a8d05b25079441312
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu May 30 12:42:18 2024 -0400

    Defer output message to later actions and allow for GET.
---
 .../shibboleth/sp/profile/impl/DecodeAgentRequest.java  | 17 ++++++++---------
 .../java/net/shibboleth/sp/profile/impl/DoPing.java     | 10 ++--------
 2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DecodeAgentRequest.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DecodeAgentRequest.java
index f999262..f1e3386 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DecodeAgentRequest.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DecodeAgentRequest.java
@@ -42,13 +42,10 @@ import net.shibboleth.sp.ddf.DDF;
  * to use. The only supported type at present is "text/plain" representing a record-oriented
  * syntax.</p>
  * 
- * <p>An empty output message object is also created.</p>
- * 
  * @event {@link EventIds#PROCEED_EVENT_ID}
  * @event {@link EventIds#INVALID_PROFILE_CTX}
  * @event {@link EventIds#INVALID_MESSAGE}
  * @post <pre>AgentRequestContext.getInput() != null</pre>
- * @post <pre>AgentRequestContext.getOutput() != null</pre>
  */
 public class DecodeAgentRequest extends AbstractProfileAction {
 
@@ -107,9 +104,13 @@ public class DecodeAgentRequest extends AbstractProfileAction {
             ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
             return;
         }
-        
-        if (!"POST".equalsIgnoreCase(request.getMethod())) {
-            log.warn("{} Invalid HTTP request method, only POST supported: ", getLogPrefix(), request.getMethod());
+
+        if ("GET".equals(request.getMethod())) {
+            log.debug("{} GET request, ignoring request body, if any", getLogPrefix());
+            return;
+        } else if (!"POST".equalsIgnoreCase(request.getMethod())) {
+            log.warn("{} Invalid HTTP request method, only GET or POST supported: ", getLogPrefix(),
+                    request.getMethod());
             ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MESSAGE);
             return;
         }
@@ -134,10 +135,8 @@ public class DecodeAgentRequest extends AbstractProfileAction {
                 return;
             }
         } else {
-            log.debug("{} No input message found in HttpServletRequest", getLogPrefix());
+            log.debug("{} No request body", getLogPrefix());
         }
-        
-        agentRequestContext.setOutput(new DDF());
     }
 
 }
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoPing.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoPing.java
index 731dad2..8e161a1 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoPing.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoPing.java
@@ -18,8 +18,6 @@ import java.time.Instant;
 
 import javax.annotation.Nonnull;
 
-import org.opensaml.profile.action.ActionSupport;
-import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
 
 import net.shibboleth.idp.profile.AbstractProfileAction;
@@ -35,12 +33,8 @@ public class DoPing extends AbstractProfileAction {
     @Override
     protected void doExecute(@Nonnull ProfileRequestContext profileRequestContext) {
 
-        final DDF out = profileRequestContext.ensureSubcontext(AgentRequestContext.class).getOutput();
-        if (out != null) {
-            out.longinteger(Instant.now().getEpochSecond());
-        } else {
-            ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MESSAGE);
-        }
+        final DDF out = new DDF().longinteger(Instant.now().getEpochSecond());
+        profileRequestContext.ensureSubcontext(AgentRequestContext.class).setOutput(out);
     }
     
 }
\ 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