ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1697397 - /webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
Date Mon, 24 Aug 2015 13:56:11 GMT
Author: coheigea
Date: Mon Aug 24 13:56:11 2015
New Revision: 1697397

URL: http://svn.apache.org/r1697397
Log:
[WSS-551] - Property passwordEncryptorInstance is not honored. Thanks to  Wladislaw Mitzel
for the patch.

Modified:
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java?rev=1697397&r1=1697396&r2=1697397&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
Mon Aug 24 13:56:11 2015
@@ -1082,16 +1082,28 @@ public abstract class WSHandler {
     }
     
     protected PasswordEncryptor getPasswordEncryptor(RequestData requestData) {
-        if (requestData.getPasswordEncryptor() != null) {
-            return requestData.getPasswordEncryptor();
+        PasswordEncryptor passwordEncryptor = requestData.getPasswordEncryptor();
+        if (passwordEncryptor == null) {
+            Object o = getOption(WSHandlerConstants.PASSWORD_ENCRYPTOR_INSTANCE);
+            if (o instanceof PasswordEncryptor) {
+                passwordEncryptor = (PasswordEncryptor) o;
+            }
         }
-        
-        CallbackHandler callbackHandler = requestData.getCallbackHandler();
-        if (callbackHandler != null) {
-            return new JasyptPasswordEncryptor(callbackHandler);
+        if (passwordEncryptor == null) {
+            Object mc = requestData.getMsgContext();
+            Object o = getProperty(mc, WSHandlerConstants.PASSWORD_ENCRYPTOR_INSTANCE);
+            if (o instanceof PasswordEncryptor) {
+                passwordEncryptor = (PasswordEncryptor) o;
+            }
+        }
+        if (passwordEncryptor == null) {
+            CallbackHandler callbackHandler = requestData.getCallbackHandler();
+            if (callbackHandler != null) {
+                passwordEncryptor = new JasyptPasswordEncryptor(callbackHandler);
+            }
         }
         
-        return null;
+        return passwordEncryptor;
     }
     
     /**



Mime
View raw message