[
https://issues.jboss.org/browse/SECURITY-784?page=com.atlassian.jira.plug...
]
Jonhny Jonhny edited comment on SECURITY-784 at 8/1/15 10:36 AM:
-----------------------------------------------------------------
In my project, I've found the solution is that moved
SecurityActions.setContextClassLoader(null) after ctx =
constructInitialLdapContext(bindDN, bindCredential); where loads custom socket. This it to
ensure that class loader which is not lost and It's working fine for me :)
org.jboss.security.auth.spi.LdapExtLoginModule#createLdapInitContext
InitialLdapContext ctx = null;
ClassLoader currentTCCL = SecurityActions.getContextClassLoader();
try {
ctx = constructInitialLdapContext(bindDN, bindCredential);
if (currentTCCL != null)
SecurityActions.setContextClassLoader(null);
...
} finally {
if (ctx != null)
ctx.close();
if (currentTCCL != null)
SecurityActions.setContextClassLoader(currentTCCL);
}
was (Author: nguyennhatkhanh206):
In my project, I've moved SecurityActions.setContextClassLoader(null) after ctx =
constructInitialLdapContext(bindDN, bindCredential); where loads custom socket. It's
working fine.
org.jboss.security.auth.spi.LdapExtLoginModule#createLdapInitContext
InitialLdapContext ctx = null;
ClassLoader currentTCCL = SecurityActions.getContextClassLoader();
try {
ctx = constructInitialLdapContext(bindDN, bindCredential);
if (currentTCCL != null)
SecurityActions.setContextClassLoader(null);
...
} finally {
if (ctx != null)
ctx.close();
if (currentTCCL != null)
SecurityActions.setContextClassLoader(currentTCCL);
}
LdapExtLoginModule cannot find custom ldap socket factory
---------------------------------------------------------
Key: SECURITY-784
URL:
https://issues.jboss.org/browse/SECURITY-784
Project: PicketBox
Issue Type: Feature Request
Components: PicketBox
Affects Versions: PicketBox_4_0_19.Final
Reporter: Derek Horton
Assignee: Pedro Igor
Attachments: SECURITY-784.patch
LdapExtLoginModule cannot find custom ldap socket factory.
Passing the "java.naming.ldap.factory.socket" property in as an
module-option:
<module-option name="java.naming.ldap.factory.socket"
value="org.jboss.example.CustomSocketFactory"/>
results in a ClassNotFoundException:
Caused by: javax.naming.CommunicationException: 192.168.1.8:389 [Root exception is
java.lang.ClassNotFoundException: org/jboss/example/CustomSocketFactory]
at com.sun.jndi.ldap.Connection.<init>(Connection.java:226) [rt.jar:1.7.0_45]
at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:136) [rt.jar:1.7.0_45]
at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1608) [rt.jar:1.7.0_45]
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2698) [rt.jar:1.7.0_45]
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:316) [rt.jar:1.7.0_45]
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:193)
[rt.jar:1.7.0_45]
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:211)
[rt.jar:1.7.0_45]
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:154)
[rt.jar:1.7.0_45]
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:84)
[rt.jar:1.7.0_45]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
[rt.jar:1.7.0_45]
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
[rt.jar:1.7.0_45]
at javax.naming.InitialContext.init(InitialContext.java:242) [rt.jar:1.7.0_45]
at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:153)
[rt.jar:1.7.0_45]
at
org.jboss.security.auth.spi.LdapExtLoginModule.constructInitialLdapContext(LdapExtLoginModule.java:767)
[picketbox-4.0.17.SP2-redhat-2.jar:4.0.17.SP2-redhat-2]
I tried making the custom socket factory into a jboss module and adding the module as a
dependency to picketbox and
sun.jdk. Unfortunately, that did not work. I also added the socket
factory jar to the jre/lib/ext directory. That didn't work either.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)