SSLParametersConfiguration.java (logback-1.2.3) | : | SSLParametersConfiguration.java (logback-v_1.2.7) | ||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
import org.codehaus.janino.Java; | import org.codehaus.janino.Java; | |||
import ch.qos.logback.core.spi.ContextAwareBase; | import ch.qos.logback.core.spi.ContextAwareBase; | |||
import ch.qos.logback.core.util.OptionHelper; | import ch.qos.logback.core.util.OptionHelper; | |||
import ch.qos.logback.core.util.StringCollectionUtil; | import ch.qos.logback.core.util.StringCollectionUtil; | |||
/** | /** | |||
* A configuration of SSL parameters for an {@link SSLEngine}. | * A configuration of SSL parameters for an {@link SSLEngine}. | |||
* | * | |||
* @author Carl Harris | * @author Carl Harris | |||
* @author Bruno Harbulot | ||||
*/ | */ | |||
public class SSLParametersConfiguration extends ContextAwareBase { | public class SSLParametersConfiguration extends ContextAwareBase { | |||
private String includedProtocols; | private String includedProtocols; | |||
private String excludedProtocols; | private String excludedProtocols; | |||
private String includedCipherSuites; | private String includedCipherSuites; | |||
private String excludedCipherSuites; | private String excludedCipherSuites; | |||
private Boolean needClientAuth; | private Boolean needClientAuth; | |||
private Boolean wantClientAuth; | private Boolean wantClientAuth; | |||
private String[] enabledProtocols; | private String[] enabledProtocols; | |||
private String[] enabledCipherSuites; | private String[] enabledCipherSuites; | |||
private Boolean hostnameVerification; | ||||
/** | /** | |||
* Configures SSL parameters on an {@link SSLConfigurable}. | * Configures SSL parameters on an {@link SSLConfigurable}. | |||
* @param socket the subject configurable | * @param socket the subject configurable | |||
*/ | */ | |||
public void configure(SSLConfigurable socket) { | public void configure(SSLConfigurable socket) { | |||
socket.setEnabledProtocols(enabledProtocols(socket.getSupportedProtocols (), socket.getDefaultProtocols())); | socket.setEnabledProtocols(enabledProtocols(socket.getSupportedProtocols (), socket.getDefaultProtocols())); | |||
socket.setEnabledCipherSuites(enabledCipherSuites(socket.getSupportedCip herSuites(), socket.getDefaultCipherSuites())); | socket.setEnabledCipherSuites(enabledCipherSuites(socket.getSupportedCip herSuites(), socket.getDefaultCipherSuites())); | |||
if (isNeedClientAuth() != null) { | if (isNeedClientAuth() != null) { | |||
socket.setNeedClientAuth(isNeedClientAuth()); | socket.setNeedClientAuth(isNeedClientAuth()); | |||
} | } | |||
if (isWantClientAuth() != null) { | if (isWantClientAuth() != null) { | |||
socket.setWantClientAuth(isWantClientAuth()); | socket.setWantClientAuth(isWantClientAuth()); | |||
} | } | |||
if(hostnameVerification != null) { | ||||
addInfo("hostnameVerification="+hostnameVerification); | ||||
socket.setHostnameVerification(hostnameVerification); | ||||
} | ||||
} | ||||
public boolean getHostnameVerification() { | ||||
if(hostnameVerification == null) | ||||
return false; | ||||
return hostnameVerification; | ||||
} | ||||
public void setHostnameVerification(boolean hostnameVerification) { | ||||
this.hostnameVerification = hostnameVerification; | ||||
} | } | |||
/** | /** | |||
* Gets the set of enabled protocols based on the configuration. | * Gets the set of enabled protocols based on the configuration. | |||
* @param supportedProtocols protocols supported by the SSL engine | * @param supportedProtocols protocols supported by the SSL engine | |||
* @param defaultProtocols default protocols enabled by the SSL engine | * @param defaultProtocols default protocols enabled by the SSL engine | |||
* @return enabled protocols | * @return enabled protocols | |||
*/ | */ | |||
private String[] enabledProtocols(String[] supportedProtocols, String[] defa ultProtocols) { | private String[] enabledProtocols(String[] supportedProtocols, String[] defa ultProtocols) { | |||
if (enabledProtocols == null) { | if (enabledProtocols == null) { | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 16 lines changed or added |