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/27 23:09:22 UTC

svn commit: r689619 - in /tomcat: container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JAASMemoryLoginModule.java container/tc5.5.x/webapps/docs/changelog.xml current/tc5.5.x/STATUS.txt

Author: markt
Date: Wed Aug 27 14:09:21 2008
New Revision: 689619

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

Modified:
    tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JAASMemoryLoginModule.java
    tomcat/container/tc5.5.x/webapps/docs/changelog.xml
    tomcat/current/tc5.5.x/STATUS.txt

Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JAASMemoryLoginModule.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JAASMemoryLoginModule.java?rev=689619&r1=689618&r2=689619&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JAASMemoryLoginModule.java (original)
+++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/realm/JAASMemoryLoginModule.java Wed Aug 27 14:09:21 2008
@@ -194,8 +194,18 @@
             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 subjects 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/container/tc5.5.x/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=689619&r1=689618&r2=689619&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original)
+++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Wed Aug 27 14:09:21 2008
@@ -115,6 +115,9 @@
         <bug>45453</bug>: Fix race condition in JDBC Realm. Based on a patch
         provided by Santtu Hyrkk. (markt)
       </fix>
+      <fix>
+        JAAS Realm did not read role information for users. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Connectors">

Modified: tomcat/current/tc5.5.x/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/current/tc5.5.x/STATUS.txt?rev=689619&r1=689618&r2=689619&view=diff
==============================================================================
--- tomcat/current/tc5.5.x/STATUS.txt (original)
+++ tomcat/current/tc5.5.x/STATUS.txt Wed Aug 27 14:09:21 2008
@@ -31,13 +31,6 @@
    0: fhanik - silently swallow an error, and default to the default config file, yoavs: don't like silent swallowing
   -1:
 
-* JAASMemoryLoginModule didn't confirm to JAASRealm contract. This prevented any
-  user from being assigned a role.
-  http://svn.apache.org/viewvc?rev=684081&view=rev
-  +1: markt, fhanik, rjung
-  -1: 
-  rjung: sudjucts -> subjects ;)
-
 * 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



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