tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1815806 - in /tomcat/trunk: java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java webapps/docs/changelog.xml
Date Mon, 20 Nov 2017 13:38:30 GMT
Author: markt
Date: Mon Nov 20 13:38:30 2017
New Revision: 1815806

URL: http://svn.apache.org/viewvc?rev=1815806&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=61780
Only include the default JASPIC registration ID in the return value for a call to AuthConfigFactory.getRegistrationIDs()
if a RegistrationContext has been registered using the default registration ID.
Patch provided by Lazar.
This closes #88

Modified:
    tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
    tomcat/trunk/test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java?rev=1815806&r1=1815805&r2=1815806&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/jaspic/AuthConfigFactoryImpl.java
Mon Nov 20 13:38:30 2017
@@ -60,7 +60,7 @@ public class AuthConfigFactoryImpl exten
             new ConcurrentHashMap<>();
     // Note: Although there will only ever be a maximum of one entry in this
     //       Map, use a ConcurrentHashMap for consistency
-    private volatile Map<String,RegistrationContextImpl> defaultRegistration =
+    private final Map<String,RegistrationContextImpl> defaultRegistration =
             new ConcurrentHashMap<>(1);
 
 
@@ -259,7 +259,7 @@ public class AuthConfigFactoryImpl exten
             result.addAll(layerAppContextRegistrations.keySet());
             result.addAll(appContextRegistrations.keySet());
             result.addAll(layerRegistrations.keySet());
-            if (defaultRegistration != null) {
+            if (!defaultRegistration.isEmpty()) {
                 result.add(DEFAULT_REGISTRATION_ID);
             }
         } else {

Modified: tomcat/trunk/test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java?rev=1815806&r1=1815805&r2=1815806&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java
(original)
+++ tomcat/trunk/test/org/apache/catalina/authenticator/jaspic/TestAuthConfigFactoryImpl.java
Mon Nov 20 13:38:30 2017
@@ -17,7 +17,10 @@
 package org.apache.catalina.authenticator.jaspic;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import javax.security.auth.message.config.AuthConfigFactory;
 import javax.security.auth.message.config.AuthConfigProvider;
@@ -287,6 +290,22 @@ public class TestAuthConfigFactoryImpl {
     }
 
 
+    @Test
+    public void testAllRegistrationIds() {
+        AuthConfigFactory factory = new AuthConfigFactoryImpl();
+        AuthConfigProvider acp1 = new SimpleAuthConfigProvider(null, null);
+        String registrationId1 = factory.registerConfigProvider(acp1, "L_1", "AC_1", null);
+        AuthConfigProvider acp2 = new SimpleAuthConfigProvider(null, null);
+        String registrationId2 = factory.registerConfigProvider(acp2, "L_2", "AC_2", null);
+
+        String[] registrationIds = factory.getRegistrationIDs(null);
+        Assert.assertTrue(registrationIds.length == 2);
+        Set<String> ids = new HashSet<>(Arrays.asList(registrationIds));
+        Assert.assertTrue(ids.contains(registrationId1));
+        Assert.assertTrue(ids.contains(registrationId2));
+    }
+
+
     private static class SimpleRegistrationListener implements RegistrationListener {
 
         private final String layer;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1815806&r1=1815805&r2=1815806&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Nov 20 13:38:30 2017
@@ -97,6 +97,13 @@
         <code>AuthConfigFactory.getConfigProvider()</code>. Patch provided by
         Lazar. (markt)
       </fix>
+      <fix>
+        <bug>61780</bug>: Only include the default JASPIC registration ID in
the
+        return value for a call to
+        <code>AuthConfigFactory.getRegistrationIDs()</code> if a
+        <code>RegistrationContext</code> has been registered using the default
+        registration ID. Patch provided by Lazar. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message