[java-identity-provider] branch main updated: IDP-995 - Administrative logout features

Scott Cantor cantor.2 at osu.edu
Fri Aug 5 16:57:39 UTC 2022


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

scantor pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=487f1b82e6f3e33546484717d280627a1b4384b8

The following commit(s) were added to refs/heads/main by this push:
     new 487f1b82e IDP-995 - Administrative logout features
487f1b82e is described below

commit 487f1b82e6f3e33546484717d280627a1b4384b8
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Aug 5 12:56:31 2022 -0400

    IDP-995 - Administrative logout features
    
    https://shibboleth.atlassian.net/browse/IDP-995
    
    Allow for duration to be omitted from insertions.
    Allow duration parameter to be in ISO syntax.
---
 .../impl/DoRevocationCacheOperation.java           | 34 ++++++++++++++++------
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/DoRevocationCacheOperation.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/DoRevocationCacheOperation.java
index 122b8e1ef..90b674932 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/DoRevocationCacheOperation.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/DoRevocationCacheOperation.java
@@ -32,6 +32,7 @@ import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterI
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
 
 import org.opensaml.profile.action.ActionSupport;
 import org.opensaml.profile.action.EventIds;
@@ -244,20 +245,35 @@ public class DoRevocationCacheOperation extends AbstractProfileAction {
         final String value = getHttpServletRequest().getParameter("value");
         final String duration = getHttpServletRequest().getParameter("duration");
         
-        if (value == null || duration == null) {
-            sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad Request", "Request missing value/duration parameters.");
+        if (value == null) {
+            sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad Request", "Request missing value parameter.");
             return;
         }
         
-        final Long durationSeconds;
-        try {
-            durationSeconds = Long.valueOf(duration);
-        } catch (final NumberFormatException e) {
-            sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad Request", "Duration parameter was not a long integer.");
-            return;
+        Duration durationSeconds = null;
+        
+        if (duration != null) {
+            if (duration.startsWith("P")) {
+                durationSeconds = DOMTypeSupport.stringToDuration(duration);
+            } else {
+                try {
+                    durationSeconds = Duration.ofSeconds(Long.valueOf(duration));
+                } catch (final NumberFormatException e) {
+                    sendError(HttpServletResponse.SC_BAD_REQUEST, "Bad Request",
+                            "Duration parameter was not a long integer.");
+                    return;
+                }
+            }
+        }
+        
+        final boolean result;
+        if (durationSeconds != null) {
+            result = revocationCache.revoke(context, key, value, durationSeconds);
+        } else {
+            result = revocationCache.revoke(context, key, value);
         }
         
-        if (revocationCache.revoke(context, key, value, Duration.ofSeconds(durationSeconds))) {
+        if (result) {
             getHttpServletResponse().setStatus(HttpServletResponse.SC_ACCEPTED);
         } else {
             sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal Server Error",

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


More information about the commits mailing list