Author: ruchithf
Date: Sun Oct  1 02:25:14 2006
New Revision: 451728

URL: http://svn.apache.org/viewvc?view=rev&rev=451728
Log:
adding a few inline comments and a null check

Modified:
    
webservices/sandesha/trunk/java/src/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java?view=diff&rev=451728&r1=451727&r2=451728
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/security/rampart/RampartBasedSecurityManager.java
 Sun Oct  1 02:25:14 2006
@@ -105,16 +105,22 @@
                         // first verify the base token
                         Principal principal = wser.getPrincipal();
                         if(principal instanceof WSDerivedKeyTokenPrincipal) {
+                            //Get the id of the SCT that was used to create 
the DKT 
                             String baseTokenId = 
((WSDerivedKeyTokenPrincipal)principal).getBasetokenId();
+                            //Get the token that matches the id
                             SecurityToken recoveredToken = 
this.recoverSecurityToken(baseTokenId);
-                            String recoverdTokenId = 
((RampartSecurityToken)recoveredToken).getToken().getId();
-                            String id = 
((RampartSecurityToken)token).getToken().getId();
-                            if(recoverdTokenId.equals(id)) {
-                                //Token matched with a token that signed the 
message part
-                                //Now check signature parts
-                                OMAttribute idattr = 
messagePart.getAttribute(new QName(WSConstants.WSU_NS, "Id"));
-                                verified = 
wser.getSignedElements().contains(idattr);
-                                break;
+                            if(recoveredToken != null) {
+                                //check whether the SCT used in the message is 
+                                //similar to the one given into the method
+                                String recoverdTokenId = 
((RampartSecurityToken)recoveredToken).getToken().getId();
+                                String id = 
((RampartSecurityToken)token).getToken().getId();
+                                if(recoverdTokenId.equals(id)) {
+                                    //Token matched with a token that signed 
the message part
+                                    //Now check signature parts
+                                    OMAttribute idattr = 
messagePart.getAttribute(new QName(WSConstants.WSU_NS, "Id"));
+                                    verified = 
wser.getSignedElements().contains(idattr);
+                                    break;
+                                }
                             }
                         }
                     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to