Author: coheigea
Date: Thu Apr  9 11:30:21 2009
New Revision: 763609

URL: http://svn.apache.org/viewvc?rev=763609&view=rev
Log:
[WSS-99] - Fixed the problems with my previous merge
 - The strategy now is to insert BC directly after the SUN provider or the 
IBMJCE provider in the case of AIX.
 - This solves the current problems with inserting BC in position 2 on Sun and 
AIX.
 - If there's a problem then it falls back to the old strategy.
 - Tested on Linux, Solaris and AIX.

Modified:
    webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java
URL: 
http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java?rev=763609&r1=763608&r2=763609&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSSConfig.java Thu Apr  
9 11:30:21 2009
@@ -520,10 +520,31 @@
         try {
             if (java.security.Security.getProvider(id) == null) {
                 Class c = Loader.loadClass(className, false);
-                int ret = 
+                java.security.Provider[] provs = 
+                    java.security.Security.getProviders();
+                //
+                // Install the provider after the SUN provider (see WSS-99)
+                // Otherwise fall back to the old behaviour of inserting
+                // the provider in position 2. For AIX, install it after
+                // the IBMJCE provider.
+                //
+                int ret = 0;
+                for (int i = 0; i < provs.length; i++) {
+                    if ("SUN".equals(provs[i].getName())
+                        || "IBMJCE".equals(provs[i].getName())) {
+                        ret =
+                            java.security.Security.insertProviderAt(
+                                (java.security.Provider) c.newInstance(), i + 2
+                            );
+                        break;
+                    }
+                }
+                if (ret == 0) {
+                    ret =
                         java.security.Security.insertProviderAt(
                             (java.security.Provider) c.newInstance(), 2
                         );
+                }
                 if (log.isDebugEnabled()) {
                     log.debug("The provider " + id + " was added at position: 
" + ret);
                 }                



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to