1 24 25 package org.objectweb.cjdbc.common.net; 26 27 import java.io.IOException ; 28 import java.net.InetAddress ; 29 import java.net.ServerSocket ; 30 import java.net.UnknownHostException ; 31 32 import javax.net.ssl.SSLServerSocket; 33 import javax.net.ssl.SSLServerSocketFactory; 34 35 45 public class AuthenticatedServerSocketFactory extends SSLServerSocketFactory 46 47 { 48 49 private SSLServerSocketFactory factory; 50 51 56 public AuthenticatedServerSocketFactory(SSLServerSocketFactory factory) 57 { 58 this.factory = factory; 59 } 60 61 64 public ServerSocket createServerSocket(int port) throws IOException , 65 UnknownHostException 66 { 67 SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(port); 68 socket.setNeedClientAuth(true); 69 return socket; 70 } 71 72 75 public ServerSocket createServerSocket(int port, int backlog) 76 throws IOException , UnknownHostException 77 { 78 SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(port, 79 backlog); 80 socket.setNeedClientAuth(true); 81 return socket; 82 } 83 84 88 public ServerSocket createServerSocket(int port, int backlog, 89 InetAddress ifAddress) throws IOException , UnknownHostException 90 { 91 SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(port, 92 backlog, ifAddress); 93 socket.setNeedClientAuth(true); 94 return socket; 95 } 96 97 100 public String [] getDefaultCipherSuites() 101 { 102 return factory.getDefaultCipherSuites(); 103 } 104 105 108 public String [] getSupportedCipherSuites() 109 { 110 return factory.getDefaultCipherSuites(); 111 } 112 113 } | Popular Tags |