1 17 18 package org.apache.geronimo.jetty6.connector; 19 20 import javax.net.ssl.KeyManagerFactory; 21 import org.apache.geronimo.gbean.GBeanInfo; 22 import org.apache.geronimo.gbean.GBeanInfoBuilder; 23 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 24 import org.apache.geronimo.jetty6.JettyContainer; 25 import org.apache.geronimo.jetty6.JettySecureConnector; 26 import org.apache.geronimo.management.geronimo.KeystoreManager; 27 import org.apache.geronimo.management.geronimo.WebManager; 28 29 34 public class HTTPSConnector extends JettyConnector implements JettySecureConnector { 35 private final GeronimoSSLListener https; 36 private String algorithm; 37 38 public HTTPSConnector(JettyContainer container, KeystoreManager keystoreManager) { 39 super(container, new GeronimoSSLListener(keystoreManager)); 40 https = (GeronimoSSLListener) listener; 41 } 42 43 public int getDefaultPort() { 44 return 443; 45 } 46 47 public String getProtocol() { 48 return WebManager.PROTOCOL_HTTPS; 49 } 50 51 public String getAlgorithm() { 52 return algorithm; 53 } 54 55 61 public void setAlgorithm(String algorithm) { 62 this.algorithm = algorithm; 64 if ("default".equalsIgnoreCase(algorithm)) { 65 algorithm = KeyManagerFactory.getDefaultAlgorithm(); 66 } 67 https.setSslKeyManagerFactoryAlgorithm(algorithm); 68 } 69 70 public String getSecureProtocol() { 71 return https.getProtocol(); 72 } 73 74 public void setSecureProtocol(String protocol) { 75 https.setProtocol(protocol); 76 } 77 78 public void setClientAuthRequired(boolean needClientAuth) { 79 https.setNeedClientAuth(needClientAuth); 80 } 81 82 public boolean isClientAuthRequired() { 83 return https.getNeedClientAuth(); 84 } 85 86 public void setClientAuthRequested(boolean wantClientAuth) { 87 https.setWantClientAuth(wantClientAuth); 88 } 89 90 public boolean isClientAuthRequested() { 91 return https.getWantClientAuth(); 92 } 93 94 public void setKeyStore(String keyStore) { 95 https.setKeyStore(keyStore); 96 } 97 98 public String getKeyStore() { 99 return https.getKeyStore(); 100 } 101 102 public void setTrustStore(String trustStore) { 103 https.setTrustStore(trustStore); 104 } 105 106 public String getTrustStore() { 107 return https.getTrustStore(); 108 } 109 110 public void setKeyAlias(String keyAlias) { 111 https.setKeyAlias(keyAlias); 112 } 113 114 public String getKeyAlias() { 115 return https.getKeyAlias(); 116 } 117 118 public static final GBeanInfo GBEAN_INFO; 119 120 static { 121 GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("Jetty Connector HTTPS", HTTPSConnector.class, JettyConnector.GBEAN_INFO); 122 infoFactory.addAttribute("algorithm", String .class, true, true); 123 infoFactory.addAttribute("secureProtocol", String .class, true, true); 124 infoFactory.addAttribute("keyStore", String .class, true, true); 125 infoFactory.addAttribute("keyAlias", String .class, true, true); 126 infoFactory.addAttribute("trustStore", String .class, true, true); 127 infoFactory.addAttribute("clientAuthRequired", boolean.class, true, true); 128 infoFactory.addAttribute("clientAuthRequested", boolean.class, true, true); 129 infoFactory.addReference("KeystoreManager", KeystoreManager.class, NameFactory.GERONIMO_SERVICE); 130 infoFactory.addInterface(JettySecureConnector.class); 131 infoFactory.setConstructor(new String []{"JettyContainer", "KeystoreManager"}); 132 GBEAN_INFO = infoFactory.getBeanInfo(); 133 } 134 135 public static GBeanInfo getGBeanInfo() { 136 return GBEAN_INFO; 137 } 138 139 142 public String getKeystoreFileName() { 143 return null; 144 } 145 146 public void setKeystoreFileName(String name) { 147 } 148 149 public void setKeystorePassword(String password) { 150 } 151 152 public String getKeystoreType() { 153 return null; 154 } 155 156 public void setKeystoreType(String type) { 157 } 158 } 159 | Popular Tags |