tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r684081 - /tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
Date Fri, 08 Aug 2008 20:27:53 GMT
Author: markt
Date: Fri Aug  8 13:27:52 2008
New Revision: 684081

URL: http://svn.apache.org/viewvc?rev=684081&view=rev
Log:
Modify JAASMemoryLoginModule so it conforms to the contract with the JAASRealm regarding the
representation of roles.

Modified:
    tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java

Modified: tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java?rev=684081&r1=684080&r2=684081&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java Fri Aug  8 13:27:52
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);



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


Mime
View raw message