[java-shib-shared] branch main updated: Adjust service wrapper to handle errors as before.

Scott Cantor cantor.2 at osu.edu
Mon Nov 28 18:42:10 UTC 2022


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

scantor pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=8eb77d486d85904c1c724c8c1c7310e228e342ac

The following commit(s) were added to refs/heads/main by this push:
     new 8eb77d48 Adjust service wrapper to handle errors as before.
8eb77d48 is described below

commit 8eb77d486d85904c1c724c8c1c7310e228e342ac
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Nov 28 13:42:07 2022 -0500

    Adjust service wrapper to handle errors as before.
---
 .../security/impl/DelegatingAccessControlService.java | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/shib-service/src/main/java/net/shibboleth/shared/service/security/impl/DelegatingAccessControlService.java b/shib-service/src/main/java/net/shibboleth/shared/service/security/impl/DelegatingAccessControlService.java
index b4561888..8be32ca0 100644
--- a/shib-service/src/main/java/net/shibboleth/shared/service/security/impl/DelegatingAccessControlService.java
+++ b/shib-service/src/main/java/net/shibboleth/shared/service/security/impl/DelegatingAccessControlService.java
@@ -18,13 +18,19 @@
 package net.shibboleth.shared.service.security.impl;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import jakarta.servlet.ServletRequest;
 import net.shibboleth.shared.annotation.ParameterName;
 import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent;
 import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.shared.security.AccessControl;
 import net.shibboleth.shared.security.AccessControlService;
 import net.shibboleth.shared.service.ReloadableService;
+import net.shibboleth.shared.service.ServiceException;
 import net.shibboleth.shared.service.ServiceableComponent;
 
 /**
@@ -34,8 +40,11 @@ import net.shibboleth.shared.service.ServiceableComponent;
 public class DelegatingAccessControlService extends AbstractIdentifiableInitializableComponent
     implements AccessControlService {
 
+    /** Class logger. */
+    @Nonnull private final Logger log = LoggerFactory.getLogger(DelegatingAccessControlService.class);
+
     /** The service which manages the reloading. */
-    @Nonnull private final ReloadableService<AccessControlService> service;
+    private final ReloadableService<AccessControlService> service;
 
     /**
      * Constructor.
@@ -54,6 +63,14 @@ public class DelegatingAccessControlService extends AbstractIdentifiableInitiali
 
         try (final ServiceableComponent<AccessControlService> component = service.getServiceableComponent()){
             return component.getComponent().getInstance(name);
+        } catch (final ServiceException e) {
+            log.error("AccessControlService '{}': Invalid configuration", getId(), e);
+            return new AccessControl() {
+                public boolean checkAccess(@Nonnull final ServletRequest request, @Nullable final String operation,
+                        @Nullable final String resource) {
+                    return false;
+                }
+            };
         }
     }
     

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


More information about the commits mailing list