incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r991500 - in /sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl: AuthenticatorWebConsolePlugin.java SlingAuthenticator.java
Date Wed, 01 Sep 2010 10:43:31 GMT
Author: fmeschbe
Date: Wed Sep  1 10:43:31 2010
New Revision: 991500

URL: http://svn.apache.org/viewvc?rev=991500&view=rev
Log:
SLING-1712 use a Map<String, List<String>> to prepare the authentication handlers
to present them on the Authenticator page in the Web Console

Modified:
    sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/AuthenticatorWebConsolePlugin.java
    sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java

Modified: sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/AuthenticatorWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/AuthenticatorWebConsolePlugin.java?rev=991500&r1=991499&r2=991500&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/AuthenticatorWebConsolePlugin.java
(original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/AuthenticatorWebConsolePlugin.java
Wed Sep  1 10:43:31 2010
@@ -81,15 +81,15 @@ public class AuthenticatorWebConsolePlug
         pw.println("<th class='content' colspan='2'>Handler</td>");
         pw.println("</tr>");
 
-        final Map<String, String> handlerMap = slingAuthenticator.getAuthenticationHandler();
-        for (Map.Entry<String, String> handler : handlerMap.entrySet()) {
-
-            pw.println("<tr class='content'>");
-            pw.println("<td class='content'>" + handler.getKey() + "</td>");
-            pw.println("<td class='content' colspan='2'>" + handler.getValue()
-                + "</td>");
-            pw.println("</tr>");
-
+        final Map<String, List<String>> handlerMap = slingAuthenticator.getAuthenticationHandler();
+        for (Map.Entry<String, List<String>> handler : handlerMap.entrySet())
{
+            final String path = handler.getKey();
+            for (String name : handler.getValue()) {
+                pw.println("<tr class='content'>");
+                pw.println("<td class='content'>" + path + "</td>");
+                pw.println("<td class='content' colspan='2'>" + name + "</td>");
+                pw.println("</tr>");
+            }
         }
     }
 

Modified: sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java?rev=991500&r1=991499&r2=991500&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java
(original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/impl/SlingAuthenticator.java
Wed Sep  1 10:43:31 2010
@@ -543,14 +543,24 @@ public class SlingAuthenticator implemen
     /**
      * Returns the list of registered authentication handlers as a map
      */
-    Map<String, String> getAuthenticationHandler() {
+    Map<String, List<String>> getAuthenticationHandler() {
         List<AbstractAuthenticationHandlerHolder> registeredHolders = authHandlerCache.getHolders();
-        LinkedHashMap<String, String> handlerMap = new LinkedHashMap<String, String>();
+        LinkedHashMap<String, List<String>> handlerMap = new LinkedHashMap<String,
List<String>>();
         for (AbstractAuthenticationHandlerHolder holder : registeredHolders) {
-            handlerMap.put(holder.fullPath, holder.getProvider());
+            List<String> provider = handlerMap.get(holder.fullPath);
+            if (provider == null) {
+                provider = new ArrayList<String>();
+                handlerMap.put(holder.fullPath, provider);
+            }
+            provider.add(holder.getProvider());
         }
         if (httpBasicHandler != null) {
-            handlerMap.put("/", httpBasicHandler.toString());
+            List<String> provider = handlerMap.get("/");
+            if (provider == null) {
+                provider = new ArrayList<String>();
+                handlerMap.put("/", provider);
+            }
+            provider.add(httpBasicHandler.toString());
         }
         return handlerMap;
     }



Mime
View raw message