Support for SAML 1.1 SecurityTokenReferences in  
/org/apache/ws/security/processor/DerivedKeyTokenProcessor
-----------------------------------------------------------------------------------------------------------

                 Key: WSS-118
                 URL: https://issues.apache.org/jira/browse/WSS-118
             Project: WSS4J
          Issue Type: Improvement
         Environment: Trunk
            Reporter: Rasmus Rhein Helwigh
            Assignee: Ruchith Udayanga Fernando


This patch enables handling of SecurityTokenReference is of type SAML_ID_URI in 
DerivedKeyTokenProcessor.



Index: 
C:/src/Main/java/wss4j-svn/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
===================================================================
--- 
C:/src/Main/java/wss4j-svn/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
       (revision 654702)
+++ 
C:/src/Main/java/wss4j-svn/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
       (working copy)
@@ -200,20 +200,29 @@
        if (keyIdentifierType.equals
                        (SecurityTokenReference.ENC_KEY_SHA1_URI)) {
 
-            pwcb = new WSPasswordCallback(keyIdentifierValue,
+               pwcb = new WSPasswordCallback(keyIdentifierValue,
                                                
WSPasswordCallback.ENCRYPTED_KEY_TOKEN);
-            try {
-               cb.handle(new Callback[]{pwcb});
-            } catch (IOException e) {
-                throw new WSSecurityException(WSSecurityException.FAILURE, 
"noKey",
-                        new Object[] { id });
-            } catch (UnsupportedCallbackException e) {
-                throw new WSSecurityException(WSSecurityException.FAILURE, 
"noKey",
-                        new Object[] { id });
-            }
-            
-        }
-       return pwcb.getKey();
+               }
+               else if ( 
keyIdentifierType.equals(SecurityTokenReference.SAML_ID_URI))
+               {
+                       pwcb = new WSPasswordCallback(keyIdentifierValue,
+                                           WSPasswordCallback.CUSTOM_TOKEN);
+               }
+               else
+               {
+                       throw new 
WSSecurityException(WSSecurityException.FAILURE, "Keyidentifier unsupported",
+                new Object[] { keyIdentifierType });
+               }
+        try {
+               cb.handle(new Callback[]{pwcb});
+        } catch (IOException e) {
+            throw new WSSecurityException(WSSecurityException.FAILURE, "noKey",
+                    new Object[] { id });
+        } catch (UnsupportedCallbackException e) {
+            throw new WSSecurityException(WSSecurityException.FAILURE, "noKey",
+                    new Object[] { id });
+        }            
+        return pwcb.getKey();                  
     }
     
     /**


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to