[java-plugin-shibd] branch main updated: Flow test for revocation check.

Codeberg noreply at shibboleth.net
Fri Oct 30 18:52:25 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/332828ca04ebea75f104610e95a6942bb132191d

The following commit(s) were added to refs/heads/main by this push:
     new 332828c  Flow test for revocation check.
332828c is described below

commit 332828ca04ebea75f104610e95a6942bb132191d
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Fri Oct 30 14:52:15 2026 -0400

    Flow test for revocation check.
---
 .../shibboleth/sp/flows/RevocationFlowTest.java    | 161 +++++++++++++++++++++
 .../sp/profile/impl/CheckRevocation.java           |   2 +-
 2 files changed, 162 insertions(+), 1 deletion(-)

diff --git a/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/RevocationFlowTest.java b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/RevocationFlowTest.java
new file mode 100644
index 0000000..b1efb30
--- /dev/null
+++ b/sp-conf-impl/src/test/java/net/shibboleth/sp/flows/RevocationFlowTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.sp.flows;
+
+import java.io.IOException;
+import java.time.Duration;
+import java.time.Instant;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.action.EventIds;
+import org.opensaml.storage.StorageService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.webflow.executor.FlowExecutionResult;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import net.shibboleth.sp.ddf.DDF;
+import net.shibboleth.sp.profile.SPConstants;
+import net.shibboleth.sp.profile.impl.CheckRevocation;
+
+/**
+ * Unit test for the SP revocation flow
+ */
+public class RevocationFlowTest extends AbstractSPFlowTest {
+    
+    /** Flow ID. */
+    @Nonnull public static final String FLOW_ID = "sp/revocation";
+
+    @Autowired
+    @Qualifier("shibboleth.StorageService")
+    @Nullable StorageService storageService;
+
+    protected RevocationFlowTest() {
+        super(FLOW_ID);
+    }
+    
+    /**
+     * Get the auto-wired storage service.
+     * 
+     * @return storage service
+     */
+    @Nonnull public StorageService getStorageService() {
+        assert storageService != null;
+        return storageService;
+    }
+    
+    /**
+     * Test flow with no application specified.
+     * @throws IOException 
+     */
+    @Test
+    public void testNoApplication() throws IOException {
+        setDefaultAuth();
+        setRequest("POST", new DDF(null));
+        final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+        assertFlowExecutionResult(result, FLOW_ID);
+        assertFlowExecutionOutcome(result.getOutcome());
+        assertOutputMessageEvent(result, EventIds.INVALID_MESSAGE);
+    }
+    
+    /**
+     * Test flow with invalid application ID.
+     * @throws IOException 
+     */
+    @Test
+    public void testBadApplication() throws IOException {
+        setDefaultAuth();
+
+        final DDF input = new DDF(null).structure();
+        input.addmember(SPConstants.APPLICATION).string("foo");
+        setRequest("POST", input);
+        
+        final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+        assertFlowExecutionResult(result, FLOW_ID);
+        assertFlowExecutionOutcome(result.getOutcome());
+        assertOutputMessageEvent(result, EventIds.INVALID_MESSAGE);
+    }
+    
+    /**
+     * Test flow with no input.
+     * @throws IOException 
+     */
+    @Test
+    public void testNoInput() throws IOException {
+        setDefaultAuth();
+        
+        final DDF input = new DDF(null).structure();
+        input.addmember(SPConstants.APPLICATION).string(APPLICATION_ID);
+        setRequest("POST", input);
+
+        final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+        assertFlowExecutionResult(result, FLOW_ID);
+        assertFlowExecutionOutcome(result.getOutcome());
+        assertOutputMessageEvent(result, EventIds.INVALID_MESSAGE);
+    }
+
+    /**
+     * Test flow with unrevoked session.
+     * @throws IOException 
+     */
+    @Test
+    public void testAbsent() throws IOException {
+        setDefaultAuth();
+        
+        final DDF input = new DDF(null).structure();
+        input.addmember(CheckRevocation.SESSION_ID).string("ABCDEF");
+        input.addmember(SPConstants.APPLICATION).string(APPLICATION_ID);
+        setRequest("POST", input);
+
+        final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+        assertFlowExecutionResult(result, FLOW_ID);
+        assertFlowExecutionOutcome(result.getOutcome());
+        
+        final DDF output = assertOutputMessageSuccess(result);
+        assert output != null;
+        Assert.assertEquals(output.getmember(CheckRevocation.RESULT).integer(), 0);
+    }
+
+    /**
+     * Test flow with unrevoked session.
+     * @throws IOException 
+     */
+    @Test
+    public void testRevoked() throws IOException {
+        
+        getStorageService().create(CheckRevocation.STORAGE_CONTEXT + '!' + AGENT_ID + '!' + APPLICATION_ID,
+                "ABCDEF", "1", Instant.now().plusSeconds(300).toEpochMilli());
+        
+        setDefaultAuth();
+        
+        final DDF input = new DDF(null).structure();
+        input.addmember(CheckRevocation.SESSION_ID).string("ABCDEF");
+        input.addmember(SPConstants.APPLICATION).string(APPLICATION_ID);
+        setRequest("POST", input);
+
+        final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+        assertFlowExecutionResult(result, FLOW_ID);
+        assertFlowExecutionOutcome(result.getOutcome());
+        
+        final DDF output = assertOutputMessageSuccess(result);
+        assert output != null;
+        Assert.assertEquals(output.getmember(CheckRevocation.RESULT).integer(), 1);
+        
+    }
+
+}
\ No newline at end of file
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/CheckRevocation.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/CheckRevocation.java
index c6af9a2..9736def 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/CheckRevocation.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/CheckRevocation.java
@@ -102,7 +102,7 @@ public class CheckRevocation extends AbstractRevocationAction {
         try {
             final StorageRecord<String> record = localStorage.read(getStorageContext(), getSessionID());
             if (record == null) {
-                log.debug("No revocation record for session ({})", getLogPrefix(), getSessionID());
+                log.debug("{} No revocation record for session ({})", getLogPrefix(), getSessionID());
                 return false;
             }
             log.info("{} Found revocation record for session ({})", getLogPrefix(), getSessionID());

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


More information about the commits mailing list