Class ThreadLocalSSLSocketFactory
- java.lang.Object
-
- javax.net.SocketFactory
-
- org.wildfly.security.auth.realm.ldap.ThreadLocalSSLSocketFactory
-
public class ThreadLocalSSLSocketFactory extends SocketFactory
AnSocketFactorythat allow passing SSLSocket into DirContext. DirContext allows SocketFactory passing only in form of class name string, which prevent to pass different SSL configuration into different DirContexts without standalone classes. This socket factory bypass this using thread local variable with SocketFactory, which should be used in directly following socket-creating DirContext operation.- Author:
- Jan Kalina
-
-
Field Summary
Fields Modifier and Type Field Description private SocketFactorysocketFactoryprivate static ThreadLocal<SocketFactory>threadLocal
-
Constructor Summary
Constructors Modifier Constructor Description privateThreadLocalSSLSocketFactory(SocketFactory socketFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SocketcreateSocket()SocketcreateSocket(String host, int port)SocketcreateSocket(String host, int port, InetAddress localHost, int localPort)SocketcreateSocket(InetAddress host, int port)SocketcreateSocket(InetAddress address, int port, InetAddress localAddress, int localPort)static SocketFactorygetDefault()static voidset(SocketFactory socketFactory)static voidunset()
-
-
-
Field Detail
-
threadLocal
private static final ThreadLocal<SocketFactory> threadLocal
-
socketFactory
private SocketFactory socketFactory
-
-
Constructor Detail
-
ThreadLocalSSLSocketFactory
private ThreadLocalSSLSocketFactory(SocketFactory socketFactory)
-
-
Method Detail
-
getDefault
public static SocketFactory getDefault()
-
set
public static void set(SocketFactory socketFactory)
-
unset
public static void unset()
-
createSocket
public Socket createSocket() throws IOException
- Overrides:
createSocketin classSocketFactory- Throws:
IOException
-
createSocket
public Socket createSocket(String host, int port) throws IOException
- Specified by:
createSocketin classSocketFactory- Throws:
IOException
-
createSocket
public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException
- Specified by:
createSocketin classSocketFactory- Throws:
IOException
-
createSocket
public Socket createSocket(InetAddress host, int port) throws IOException
- Specified by:
createSocketin classSocketFactory- Throws:
IOException
-
createSocket
public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException
- Specified by:
createSocketin classSocketFactory- Throws:
IOException
-
-