cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1506824 - in /cxf/branches/2.7.x-fixes: ./ rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
Date Thu, 25 Jul 2013 06:36:55 GMT
Author: ema
Date: Thu Jul 25 06:36:54 2013
New Revision: 1506824

URL: http://svn.apache.org/r1506824
Log:
Merged revisions 1506822 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1506822 | ema | 2013-07-25 14:17:56 +0800 (Thu, 25 Jul 2013) | 1 line
  
  [CXF-5142]:Add another doPrivileged
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1506822

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java?rev=1506824&r1=1506823&r2=1506824&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
Thu Jul 25 06:36:54 2013
@@ -26,6 +26,8 @@ import java.net.Authenticator;
 import java.net.PasswordAuthentication;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import org.apache.cxf.common.util.ReflectionUtil;
 import org.apache.cxf.helpers.IOUtils;
@@ -78,10 +80,20 @@ public class CXFAuthenticator extends Au
                 ReflectionUtil.setAccessible(m).invoke(loader, ReferencingAuthenticator.class.getName(),
                                                        b, 0, b.length);
                 Class<?> cls = loader.loadClass(ReferencingAuthenticator.class.getName());
-                Authenticator auth = (Authenticator)cls.getConstructor(Authenticator.class,
Authenticator.class)
+                final Authenticator auth = (Authenticator)cls.getConstructor(Authenticator.class,
Authenticator.class)
                     .newInstance(instance, wrapped);
                 
-                Authenticator.setDefault(auth);
+                if (System.getSecurityManager() == null) {
+                    Authenticator.setDefault(auth);
+                } else {
+                    AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+                        public Boolean run() {
+                            Authenticator.setDefault(auth);
+                            return true;
+                        }
+                    });
+
+                }
             } catch (Throwable t) {
                 //ignore
                 t.printStackTrace();



Mime
View raw message