You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by na...@apache.org on 2008/06/26 15:44:18 UTC

svn commit: r671899 - /webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java

Author: nandana
Date: Thu Jun 26 06:44:18 2008
New Revision: 671899

URL: http://svn.apache.org/viewvc?rev=671899&view=rev
Log:
RAMPART-178 setting the username as a message context property

Modified:
    webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java

Modified: webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java?rev=671899&r1=671898&r2=671899&view=diff
==============================================================================
--- webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java (original)
+++ webservices/rampart/trunk/java/modules/rampart-core/src/main/java/org/apache/rampart/RampartEngine.java Thu Jun 26 06:44:18 2008
@@ -47,6 +47,7 @@
 
 import javax.xml.namespace.QName;
 
+import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Iterator;
@@ -159,7 +160,9 @@
                 //Store symm tokens
                 //Pick the first SAML token
                 //TODO : This is a hack , MUST FIX
-                //get the sec context id from the req msg ctx
+                //get the sec context id from the req msg ctx 
+		
+		//Store username in MessageContext property
                 
                 for (int j = 0; j < results.size(); j++) {
                     WSSecurityEngineResult wser = (WSSecurityEngineResult) results.get(j);
@@ -186,6 +189,10 @@
                                     "errorInAddingTokenIntoStore", e);
                         }
                         
+                    } else if (WSConstants.UT == actInt.intValue()) {
+                        String username = ((Principal)wser.get(WSSecurityEngineResult.TAG_PRINCIPAL))
+                                .getName();
+                        msgCtx.setProperty(RampartMessageData.USERNAME, username);
                     }
         
                 }