Class CustomSocketFactory
- java.lang.Object
-
- javax.net.SocketFactory
-
- com.sun.enterprise.security.auth.realm.ldap.CustomSocketFactory
-
- All Implemented Interfaces:
Comparator<SocketFactory>
public class CustomSocketFactory extends SocketFactory implements Comparator<SocketFactory>
Custom socket factory for ldaps (SSL). The comparator only works in JDK 1.6 onwards. Due to a bug in JDK 1.6 compare method invocation fails with a classcast exception. The caller is trying to pass java.lang.String when it should have passed javax.net.SocketFactory- See Also:
LDAPRealm
-
-
Constructor Summary
Constructors Constructor Description CustomSocketFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(SocketFactory s1, SocketFactory s2)SocketcreateSocket()Overriding createSocket() to fix issue FISH-6567 when having connectTimeout for Ldap Connections.SocketcreateSocket(String arg0, int arg1)SocketcreateSocket(String arg0, int arg1, InetAddress arg2, int arg3)SocketcreateSocket(InetAddress arg0, int arg1)SocketcreateSocket(InetAddress arg0, int arg1, InetAddress arg2, int arg3)static SocketFactorygetDefault()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Field Detail
-
SSL
public static final String SSL
- See Also:
- Constant Field Values
-
LOGGER
protected static final Logger LOGGER
-
sm
protected static final StringManager sm
-
-
Method Detail
-
createSocket
public Socket createSocket() throws IOException
Overriding createSocket() to fix issue FISH-6567 when having connectTimeout for Ldap Connections. The cause of the issue is that new implementation from blocking mechanism during creation of socket connections is setting a positive value for the parameter connectTimeout instead of using -1 (as previous versions did) to control the creation. For more information about the changes please check- Overrides:
createSocketin classSocketFactory- Returns:
- Socket instance with default ssl context
- Throws:
IOException- See Also:
- < href="https://github.com/openjdk/jdk/pull/6568">jdk connection timeout pr>
-
createSocket
public Socket createSocket(String arg0, int arg1) throws IOException, UnknownHostException
- Specified by:
createSocketin classSocketFactory- Throws:
IOExceptionUnknownHostException- See Also:
SocketFactory.createSocket(java.lang.String, int)
-
createSocket
public Socket createSocket(InetAddress arg0, int arg1) throws IOException
- Specified by:
createSocketin classSocketFactory- Throws:
IOException- See Also:
SocketFactory.createSocket(java.net.InetAddress, int)
-
createSocket
public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) throws IOException, UnknownHostException
- Specified by:
createSocketin classSocketFactory- Throws:
IOExceptionUnknownHostException- See Also:
SocketFactory.createSocket(java.lang.String, int, java.net.InetAddress, int)
-
createSocket
public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, int arg3) throws IOException
- Specified by:
createSocketin classSocketFactory- Throws:
IOException- See Also:
SocketFactory.createSocket(java.net.InetAddress, int, java.net.InetAddress, int)
-
compare
public int compare(SocketFactory s1, SocketFactory s2)
- Specified by:
comparein interfaceComparator<SocketFactory>
-
getDefault
public static SocketFactory getDefault()
-
-