[java-plugin-shibd] branch main updated: Add override of "new" 5.3 base class method to control event to log.

Codeberg noreply at shibboleth.net
Tue Sep 15 18:35:16 UTC 2026


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

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

View the commit online:
https://codeberg.org/Shibboleth/java-plugin-shibd/commit/3205334173ec6179fa35c09b31a72200ef6959cd

The following commit(s) were added to refs/heads/main by this push:
     new 3205334  Add override of "new" 5.3 base class method to control event to log.
3205334 is described below

commit 3205334173ec6179fa35c09b31a72200ef6959cd
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Tue Sep 15 14:35:07 2026 -0400

    Add override of "new" 5.3 base class method to control event to log.
---
 .../shibboleth/sp/profile/impl/WriteAuditLog.java  | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/WriteAuditLog.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/WriteAuditLog.java
index 5241b4e..e96ee92 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/WriteAuditLog.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/WriteAuditLog.java
@@ -14,9 +14,17 @@
 
 package net.shibboleth.sp.profile.impl;
 
+import java.util.function.Function;
+
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import org.opensaml.profile.context.EventContext;
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.profile.context.navigate.CurrentOrPreviousEventLookup;
+
 import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.shared.logic.Constraint;
 
 /**
  * Subclass of IdP auditing action that overrides the {@link HttpServletRequest} accessor
@@ -27,6 +35,25 @@ import jakarta.servlet.http.HttpServletRequest;
  */
 public class WriteAuditLog extends net.shibboleth.idp.profile.audit.impl.WriteAuditLog {
 
+    /** Strategy function for access to {@link EventContext} to check. */
+    @Nonnull private Function<ProfileRequestContext,EventContext> eventContextLookupStrategy;
+
+    /** Constructor. */
+    public WriteAuditLog() {
+        eventContextLookupStrategy = new CurrentOrPreviousEventLookup();
+    }
+    
+    /**
+     * Set lookup strategy for {@link EventContext} to check.
+     * 
+     * @param strategy  lookup strategy
+     */
+    public void setEventContextLookupStrategy(@Nonnull final Function<ProfileRequestContext,EventContext> strategy) {
+        checkSetterPreconditions();
+        
+        eventContextLookupStrategy = Constraint.isNotNull(strategy, "EventContext lookup strategy cannot be null");
+    }
+    
     /** {@inheritDoc} */
     @Override
     @Nullable public HttpServletRequest getHttpServletRequest() {
@@ -37,4 +64,22 @@ public class WriteAuditLog extends net.shibboleth.idp.profile.audit.impl.WriteAu
         }
     }
     
+    /**
+     * This is a "new" method intended to override something that the base class in 5.2 doesn't call
+     * but the base class in 5.3 will.
+     * 
+     * @param profileRequestContext profile request context
+     * 
+     * @return event to log
+     */
+    @Nullable protected String getEvent(@Nonnull final ProfileRequestContext profileRequestContext) {
+        final EventContext eventCtx = eventContextLookupStrategy.apply(profileRequestContext);
+        final Object event = eventCtx != null ? eventCtx.getEvent() : null;
+        if (event != null) {
+            return event.toString();
+        }
+        
+        return null;
+    }
+    
 }
\ 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