You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/08/14 00:47:09 UTC

svn commit: r685718 - in /tomcat/tc6.0.x/trunk: ./ STATUS.txt java/org/apache/catalina/realm/JAASMemoryLoginModule.java webapps/docs/changelog.xml

Author: markt
Date: Wed Aug 13 15:47:09 2008
New Revision: 685718

URL: http://svn.apache.org/viewvc?rev=685718&view=rev
Log:
JAASMemoryLoginModule didn't conform to JAASRealm contract. This prevented any user from being assigned a role.

Modified:
    tomcat/tc6.0.x/trunk/   (props changed)
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc6.0.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 13 15:47:09 2008
@@ -1 +1 @@
-/tomcat/trunk:673796,673820,683982,684001
+/tomcat/trunk:673796,673820,683982,684001,684081

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=685718&r1=685717&r2=685718&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Aug 13 15:47:09 2008
@@ -71,12 +71,6 @@
    0: remm (looks risky, very minor problem)
   -1: 
 
-* JAASMemoryLoginModule didn't conform to JAASRealm contract. This prevented any
-  user from being assigned a role.
-  http://svn.apache.org/viewvc?rev=684081&view=rev
-  +1: markt, remm, funkman
-  -1: 
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45576
   Add support for DIGEST to the JAASRealm
   http://svn.apache.org/viewvc?rev=684234&view=rev

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java?rev=685718&r1=685717&r2=685718&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java Wed Aug 13 15:47:09 2008
@@ -194,8 +194,19 @@
             return (false);
 
         // Add our Principal to the Subject if needed
-        if (!subject.getPrincipals().contains(principal))
+        if (!subject.getPrincipals().contains(principal)) {
             subject.getPrincipals().add(principal);
+            // Add the roles as additional sudjucts as per the contract with the
+            // JAASRealm
+            if (principal instanceof GenericPrincipal) {
+                String roles[] = ((GenericPrincipal) principal).getRoles();
+                for (int i = 0; i < roles.length; i++) {
+                    subject.getPrincipals().add(
+                            new GenericPrincipal(null, roles[i], null));
+                }
+                
+            }
+        }
 
         committed = true;
         return (true);

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=685718&r1=685717&r2=685718&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Wed Aug 13 15:47:09 2008
@@ -44,6 +44,9 @@
         <code>$CATALINA_BASE</code> but not JULI. Patch based on a suggestion by
         Ian Ward Comfort. (markt)
       </fix>
+      <fix>
+        The JAAS Realm did not assign roles to authenticated users. (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