You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2022/09/26 07:25:49 UTC

[sling-org-apache-sling-auth-core] branch master updated: SLING-11598 : Don't reactivate authenticator on configuration change

This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-auth-core.git


The following commit(s) were added to refs/heads/master by this push:
     new fb8d4c9  SLING-11598 : Don't reactivate authenticator on configuration change
fb8d4c9 is described below

commit fb8d4c91037e041206c42e2f053ecf410f340fee
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Sep 26 09:25:44 2022 +0200

    SLING-11598 : Don't reactivate authenticator on configuration change
---
 .../sling/auth/core/impl/AuthenticationHandlersManager.java       | 8 +++++++-
 .../sling/auth/core/impl/AuthenticatorWebConsolePlugin.java       | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/auth/core/impl/AuthenticationHandlersManager.java b/src/main/java/org/apache/sling/auth/core/impl/AuthenticationHandlersManager.java
index 012469e..2541a03 100644
--- a/src/main/java/org/apache/sling/auth/core/impl/AuthenticationHandlersManager.java
+++ b/src/main/java/org/apache/sling/auth/core/impl/AuthenticationHandlersManager.java
@@ -31,6 +31,7 @@ import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Modified;
 import org.osgi.service.component.annotations.Reference;
 import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.osgi.service.component.annotations.ReferencePolicy;
@@ -43,10 +44,15 @@ public class AuthenticationHandlersManager extends PathBasedHolderCache<Abstract
     /** Handler map for authentication handlers */
     private final Map<String, List<AbstractAuthenticationHandlerHolder>> handlerMap = new ConcurrentHashMap<>();
     
-    private final Boolean httpSupport;
+    private volatile Boolean httpSupport;
 
     @Activate
     public AuthenticationHandlersManager(final SlingAuthenticator.Config config) {
+        this.modified(config);
+    }
+
+    @Modified
+    public void modified(final SlingAuthenticator.Config config) {
         final String http = SlingAuthenticator.getHttpAuth(config);
         if (SlingAuthenticator.HTTP_AUTH_DISABLED.equals(http)) {
             this.httpSupport = null;
diff --git a/src/main/java/org/apache/sling/auth/core/impl/AuthenticatorWebConsolePlugin.java b/src/main/java/org/apache/sling/auth/core/impl/AuthenticatorWebConsolePlugin.java
index 640ed1e..741e01e 100644
--- a/src/main/java/org/apache/sling/auth/core/impl/AuthenticatorWebConsolePlugin.java
+++ b/src/main/java/org/apache/sling/auth/core/impl/AuthenticatorWebConsolePlugin.java
@@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletResponse;
 import org.apache.sling.api.request.ResponseUtil;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Modified;
 import org.osgi.service.component.annotations.Reference;
 import org.osgi.service.component.propertytypes.ServiceDescription;
 import org.osgi.service.component.propertytypes.ServiceVendor;
@@ -59,10 +60,15 @@ public class AuthenticatorWebConsolePlugin extends HttpServlet {
     @Reference
     private AuthenticationHandlersManager authenticationHoldersManager; // NOSONAR
 
-    private final SlingAuthenticator.Config config;
+    private volatile SlingAuthenticator.Config config;
 
     @Activate
     public AuthenticatorWebConsolePlugin(final SlingAuthenticator.Config config) {
+        this.modified(config);
+    }
+
+    @Modified
+    public void modified(final SlingAuthenticator.Config config) {
         this.config = config;
     }