[java-plugin-shibd] branch main updated: Migrate action base classes into API.

Scott Cantor cantor.2 at osu.edu
Tue Jul 9 13:45:39 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=ee76270e8b1d467ad77f0b5658d0041e041840f4

The following commit(s) were added to refs/heads/main by this push:
     new ee76270  Migrate action base classes into API.
ee76270 is described below

commit ee76270e8b1d467ad77f0b5658d0041e041840f4
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jul 9 09:45:32 2024 -0400

    Migrate action base classes into API.
---
 .../sp/profile}/AbstractAgentAction.java           |  4 +--
 .../sp/profile}/AbstractAgentRequestAction.java    |  2 +-
 .../sp/profile/AbstractApplicationAction.java      | 38 +++++++++++-----------
 .../net/shibboleth/sp/profile/package-info.java    | 18 ++++++++++
 .../sp/authn/impl/ValidateAgentAddress.java        |  2 +-
 .../authn/impl/ValidateCachedAuthentication.java   |  2 +-
 .../sp/config/impl/ParseAgentRequestMap.java       |  2 +-
 .../sp/profile/impl/DecodeAgentRequest.java        |  1 +
 .../net/shibboleth/sp/profile/impl/DoPing.java     |  1 +
 .../sp/profile/impl/DoSealerOperation.java         |  1 +
 .../sp/profile/impl/DoStorageOperation.java        |  1 +
 .../sp/profile/impl/EncodeAgentResponse.java       |  1 +
 .../sp/profile/impl/PrepareAgentErrorResponse.java |  1 +
 13 files changed, 49 insertions(+), 25 deletions(-)

diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/AbstractAgentAction.java b/sp-server-api/src/main/java/net/shibboleth/sp/profile/AbstractAgentAction.java
similarity index 94%
copy from sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/AbstractAgentAction.java
copy to sp-server-api/src/main/java/net/shibboleth/sp/profile/AbstractAgentAction.java
index 2c5fa8e..3bc3170 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/AbstractAgentAction.java
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/profile/AbstractAgentAction.java
@@ -12,7 +12,7 @@
  * limitations under the License.
  */
 
-package net.shibboleth.sp.profile.impl;
+package net.shibboleth.sp.profile;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -31,7 +31,7 @@ import net.shibboleth.sp.context.AgentRequestContext;
 /**
  * Base class for actions that need access to the {@link Agent} in an {@link AgentRequestContext}.
  * 
- * <p>This class guarantees that the context exists after {@link #doPreExecute(ProfileRequestContext)}
+ * <p>This class guarantees that the context and agent exists after {@link #doPreExecute(ProfileRequestContext)}
  * runs and returns true.</p>
  * 
  * @event {@link EventIds#PROCEED_EVENT_ID}
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/AbstractAgentRequestAction.java b/sp-server-api/src/main/java/net/shibboleth/sp/profile/AbstractAgentRequestAction.java
similarity index 99%
rename from sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/AbstractAgentRequestAction.java
rename to sp-server-api/src/main/java/net/shibboleth/sp/profile/AbstractAgentRequestAction.java
index 2e22eae..93037c1 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/AbstractAgentRequestAction.java
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/profile/AbstractAgentRequestAction.java
@@ -12,7 +12,7 @@
  * limitations under the License.
  */
 
-package net.shibboleth.sp.profile.impl;
+package net.shibboleth.sp.profile;
 
 import java.util.function.Function;
 
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/AbstractAgentAction.java b/sp-server-api/src/main/java/net/shibboleth/sp/profile/AbstractApplicationAction.java
similarity index 61%
rename from sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/AbstractAgentAction.java
rename to sp-server-api/src/main/java/net/shibboleth/sp/profile/AbstractApplicationAction.java
index 2c5fa8e..48e0b6e 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/AbstractAgentAction.java
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/profile/AbstractApplicationAction.java
@@ -12,7 +12,7 @@
  * limitations under the License.
  */
 
-package net.shibboleth.sp.profile.impl;
+package net.shibboleth.sp.profile;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -25,26 +25,26 @@ import org.slf4j.Logger;
 import net.shibboleth.shared.annotation.constraint.NonnullBeforeExec;
 import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.primitive.LoggerFactory;
-import net.shibboleth.sp.Agent;
+import net.shibboleth.sp.Application;
 import net.shibboleth.sp.context.AgentRequestContext;
 
 /**
- * Base class for actions that need access to the {@link Agent} in an {@link AgentRequestContext}.
+ * Base class for actions that need access to the {@link Application} in an {@link AgentRequestContext}.
  * 
- * <p>This class guarantees that the context exists after {@link #doPreExecute(ProfileRequestContext)}
+ * <p>This class guarantees that the context and application exists after {@link #doPreExecute(ProfileRequestContext)}
  * runs and returns true.</p>
  * 
  * @event {@link EventIds#PROCEED_EVENT_ID}
  * @event {@link EventIds#INVALID_PROFILE_CTX}
- * @pre <pre>ensureAgentRequestContext().getAgent() != null</pre>
+ * @pre <pre>ensureAgentRequestContext().getApplication() != null</pre>
  */
-public abstract class AbstractAgentAction extends AbstractAgentRequestAction {
+public abstract class AbstractApplicationAction extends AbstractAgentAction {
 
     /** Class logger. */
-    @Nonnull private final Logger log = LoggerFactory.getLogger(AbstractAgentAction.class);
+    @Nonnull private final Logger log = LoggerFactory.getLogger(AbstractApplicationAction.class);
     
     /** Cached agent from context. */
-    @NonnullBeforeExec private Agent agent;
+    @NonnullBeforeExec private Application application;
 
     /** {@inheritDoc} */
     @Override
@@ -54,9 +54,9 @@ public abstract class AbstractAgentAction extends AbstractAgentRequestAction {
             return false;
         }
         
-        agent = ensureAgentRequestContext().getAgent();
-        if (agent == null) {
-            log.error("{} No Agent found in context", getLogPrefix());
+        application = ensureAgentRequestContext().getApplication();
+        if (application == null) {
+            log.error("{} No Application found in context", getLogPrefix());
             ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
             return false;
         }
@@ -65,21 +65,21 @@ public abstract class AbstractAgentAction extends AbstractAgentRequestAction {
     }
     
     /**
-     * Gets the {@link Agent} for this request.
+     * Gets the {@link Application} for this request.
      * 
-     * @return the agent, or null
+     * @return the application, or null
      */
-    @Nullable public Agent getAgent() {
-        return agent;
+    @Nullable public Application getApplication() {
+        return application;
     }
     
     /**
-     * Gets the {@link Agent} for this request.
+     * Gets the {@link Application} for this request.
      * 
-     * @return the agent
+     * @return the application
      */
-    @Nonnull public Agent ensureAgent() {
-        return Constraint.isNotNull(agent, "Agent was null");
+    @Nonnull public Application ensureApplication() {
+        return Constraint.isNotNull(application, "Application was null");
     }
         
 }
\ No newline at end of file
diff --git a/sp-server-api/src/main/java/net/shibboleth/sp/profile/package-info.java b/sp-server-api/src/main/java/net/shibboleth/sp/profile/package-info.java
new file mode 100644
index 0000000..1e8bfd7
--- /dev/null
+++ b/sp-server-api/src/main/java/net/shibboleth/sp/profile/package-info.java
@@ -0,0 +1,18 @@
+/*
+ * 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.
+ */
+
+/**
+ * API classes for SP profile actions.
+ */
+package net.shibboleth.sp.profile;
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/authn/impl/ValidateAgentAddress.java b/sp-server-impl/src/main/java/net/shibboleth/sp/authn/impl/ValidateAgentAddress.java
index 7637d38..234b6a2 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/authn/impl/ValidateAgentAddress.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/authn/impl/ValidateAgentAddress.java
@@ -29,7 +29,7 @@ import jakarta.servlet.http.HttpServletRequest;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.shared.servlet.HttpServletSupport;
 import net.shibboleth.sp.Agent;
-import net.shibboleth.sp.profile.impl.AbstractAgentAction;
+import net.shibboleth.sp.profile.AbstractAgentAction;
 
 /**
  * An action that validates the requesting client address is allowed for the identified
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/authn/impl/ValidateCachedAuthentication.java b/sp-server-impl/src/main/java/net/shibboleth/sp/authn/impl/ValidateCachedAuthentication.java
index c5621e9..4d72b2c 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/authn/impl/ValidateCachedAuthentication.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/authn/impl/ValidateCachedAuthentication.java
@@ -29,7 +29,7 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.shared.servlet.HttpServletSupport;
 import net.shibboleth.sp.Agent;
-import net.shibboleth.sp.profile.impl.AbstractAgentAction;
+import net.shibboleth.sp.profile.AbstractAgentAction;
 
 /**
  * An action that checks for a record in the {@link HttpSession} to bypass agent authentication.
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/config/impl/ParseAgentRequestMap.java b/sp-server-impl/src/main/java/net/shibboleth/sp/config/impl/ParseAgentRequestMap.java
index 6b64e1b..1ac6826 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/config/impl/ParseAgentRequestMap.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/config/impl/ParseAgentRequestMap.java
@@ -42,7 +42,7 @@ import net.shibboleth.shared.xml.XMLParserException;
 import net.shibboleth.sp.SPConstants;
 import net.shibboleth.sp.ddf.DDF;
 import net.shibboleth.sp.ddf.DDFSupport;
-import net.shibboleth.sp.profile.impl.AbstractAgentRequestAction;
+import net.shibboleth.sp.profile.AbstractAgentRequestAction;
 
 /**
  * Action that handles parsing the legacy 3.0 XML configuration for an agent.
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 ccac3fe..b178687 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
@@ -29,6 +29,7 @@ import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.sp.context.AgentRequestContext;
 import net.shibboleth.sp.ddf.DDF;
 import net.shibboleth.sp.messaging.impl.RemotedHttpServletRequest;
+import net.shibboleth.sp.profile.AbstractAgentRequestAction;
 
 /**
  * A profile action to decode an agent request and stash the resulting {@link DDF} in the
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 2d05219..ae3a234 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
@@ -21,6 +21,7 @@ import javax.annotation.Nonnull;
 import org.opensaml.profile.context.ProfileRequestContext;
 
 import net.shibboleth.sp.ddf.DDF;
+import net.shibboleth.sp.profile.AbstractAgentRequestAction;
 
 /**
  * Simple action for testing.
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoSealerOperation.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoSealerOperation.java
index 521e4f3..15d687c 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoSealerOperation.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoSealerOperation.java
@@ -34,6 +34,7 @@ import net.shibboleth.shared.security.DataSealer;
 import net.shibboleth.shared.security.DataSealerException;
 import net.shibboleth.sp.Agent;
 import net.shibboleth.sp.ddf.DDF;
+import net.shibboleth.sp.profile.AbstractAgentAction;
 import jakarta.servlet.http.HttpServletRequest;
 
 /**
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoStorageOperation.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoStorageOperation.java
index d9abfee..467e49d 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoStorageOperation.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/DoStorageOperation.java
@@ -34,6 +34,7 @@ import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.sp.Agent;
 import net.shibboleth.sp.ddf.DDF;
+import net.shibboleth.sp.profile.AbstractAgentAction;
 import jakarta.servlet.http.HttpServletRequest;
 
 /**
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/EncodeAgentResponse.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/EncodeAgentResponse.java
index 2ae2e48..ac4d234 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/EncodeAgentResponse.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/EncodeAgentResponse.java
@@ -29,6 +29,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullBeforeExec;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.sp.context.AgentRequestContext;
 import net.shibboleth.sp.ddf.DDF;
+import net.shibboleth.sp.profile.AbstractAgentRequestAction;
 
 /**
  * A profile action to encode an agent response from the output {@link DDF} in the
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/PrepareAgentErrorResponse.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/PrepareAgentErrorResponse.java
index 339fd87..c27cbdb 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/PrepareAgentErrorResponse.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/PrepareAgentErrorResponse.java
@@ -28,6 +28,7 @@ import net.shibboleth.shared.annotation.constraint.NonnullBeforeExec;
 import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.sp.context.AgentRequestContext;
 import net.shibboleth.sp.ddf.DDF;
+import net.shibboleth.sp.profile.AbstractAgentRequestAction;
 
 /**
  * A profile action to encode the current event (typically an error) into an agent response in a

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


More information about the commits mailing list