Author: anil.saldhana(a)jboss.com
Date: 2011-06-06 18:09:35 -0400 (Mon, 06 Jun 2011)
New Revision: 973
Modified:
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/jaas/JBWSTokenIssuingLoginModule.java
Log:
set custom sock fact
Modified:
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/jaas/JBWSTokenIssuingLoginModule.java
===================================================================
---
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/jaas/JBWSTokenIssuingLoginModule.java 2011-06-06
22:08:32 UTC (rev 972)
+++
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/jaas/JBWSTokenIssuingLoginModule.java 2011-06-06
22:09:35 UTC (rev 973)
@@ -26,6 +26,7 @@
import java.util.Map;
import java.util.Set;
+import javax.net.ssl.SSLSocketFactory;
import javax.security.auth.login.LoginException;
import javax.xml.transform.Source;
import javax.xml.ws.Binding;
@@ -176,10 +177,54 @@
log.trace("We got security domain for domain ssl factory = " +
securityDomainForFactory);
log.trace("Setting it on the system property
org.jboss.security.ssl.domain.name");
}
+ String sslFactoryName =
"org.jboss.security.ssl.JaasSecurityDomainSocketFactory";
SecurityActions.setSystemProperty("org.jboss.security.ssl.domain.name",
securityDomainForFactory);
//StubExt.PROPERTY_SOCKET_FACTORY
- dispatch.getRequestContext().put( "org.jboss.ws.socketFactory",
- "org.jboss.security.ssl.JaasSecurityDomainSocketFactory");
+ dispatch.getRequestContext().put( "org.jboss.ws.socketFactory",
sslFactoryName);
+
+ //If we are using PL Dispatch. Then we need to set the SSL Socket Factory
+ if( dispatch instanceof PicketLinkDispatch)
+ {
+ ClassLoader cl = SecurityActions.getClassLoader(getClass());
+ SSLSocketFactory socketFactory = null;
+ if(cl != null)
+ {
+ try
+ {
+ Class<?> clazz = cl.loadClass(sslFactoryName);
+ socketFactory = (SSLSocketFactory) clazz.newInstance();
+ }
+ catch(Exception e)
+ {
+ cl = SecurityActions.getContextClassLoader();
+ try
+ {
+ Class<?> clazz = cl.loadClass(sslFactoryName);
+ socketFactory = (SSLSocketFactory) clazz.newInstance();
+ }
+ catch (Exception e1)
+ {
+ throw new RuntimeException("Unable to create SSL Socket
Factory:",e1);
+ }
+ }
+ finally
+ {
+ if(socketFactory != null)
+ {
+
((PicketLinkDispatch)dispatch).setSSLSocketFactory(socketFactory);
+ }
+ else
+ throw new RuntimeException(" We did not find SSL Socket
Factory");
+ }
+ }
+ else
+ {
+ if(trace)
+ {
+ log.trace("Classloader is null. Unable to set the
SSLSocketFactory on PicketLinkDispatch");
+ }
+ }
+ }
}
}
}
Show replies by date