From 8bab5f83615677428d0e2848b9878a6b3d27f0fb Mon Sep 17 00:00:00 2001
From: ulrich
Date: Wed, 21 Feb 2024 13:43:58 +0000
Subject: [PATCH] Verarbeitung von Routen um variable Elemente erweitert (einstweilen noch experimentell)

---
 src/de/uhilger/neon/Factory.java |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/de/uhilger/neon/Factory.java b/src/de/uhilger/neon/Factory.java
index b6550ba..4f9e14a 100644
--- a/src/de/uhilger/neon/Factory.java
+++ b/src/de/uhilger/neon/Factory.java
@@ -161,6 +161,7 @@
           IllegalAccessException, IllegalArgumentException, InvocationTargetException, IOException {
     Map<String, HttpHandler> sharedHandlers = new HashMap();
     Iterator<ContextDescriptor> contextIterator = contextList.iterator();
+    Authenticator auth = null;
     while (contextIterator.hasNext()) {
       ContextDescriptor cd = contextIterator.next();
       HttpHandler h = buildHandler(cd, sharedHandlers);
@@ -180,12 +181,24 @@
               ctx.getAttributes().put("serverDataProviderList", sdp);
           }
         }        
-        Authenticator auth = createAuthenticator(d);
-        if (auth instanceof Authenticator && cd.authenticator instanceof String) {
+        if(cd.authenticator instanceof String) {
+          if(!(auth instanceof Authenticator)) {
+            auth = createAuthenticator(d);
+          }
+          if(auth instanceof Authenticator) {
             ctx.setAuthenticator(auth);      
             ctx.getAttributes().putAll(d.authenticator.attributes);
-            fireAuthenticatorCreated(ctx, auth);
+            fireAuthenticatorCreated(ctx, auth); // event umbenennen in etwas wie authAdded oder so
+          }
+          
         }
+        
+        //Authenticator auth = createAuthenticator(d);
+        //if (auth instanceof Authenticator && cd.authenticator instanceof String) {
+        //    ctx.setAuthenticator(auth);      
+        //    ctx.getAttributes().putAll(d.authenticator.attributes);
+        //    fireAuthenticatorCreated(ctx, auth);
+        //}
         fireHandlerCreated(ctx, h);
         fireContextCreated(ctx);
       } else {

--
Gitblit v1.9.3