Skip to content

Commit

Permalink
Fix SSL cipher configuration with Jetty 9.3
Browse files Browse the repository at this point in the history
Previously, if a list of ciphers were configured, the default excludes
were still applied. Prior to Jetty 9.3, there were no default exclude but
Jetty 9.3 introduced some and they override the includes.

This commit makes sure that the exclude ciphers are cleared if at least
one cipher is explicitly configured.

Closes spring-projectsgh-6041
  • Loading branch information
snicoll committed Jun 10, 2016
1 parent 62fa602 commit 6cf8784
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import org.springframework.core.io.ResourceLoader;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.ResourceUtils;
import org.springframework.util.StringUtils;
Expand Down Expand Up @@ -250,8 +251,9 @@ protected void configureSsl(SslContextFactory factory, Ssl ssl) {
configureSslClientAuth(factory, ssl);
configureSslPasswords(factory, ssl);
factory.setCertAlias(ssl.getKeyAlias());
if (ssl.getCiphers() != null) {
if (!ObjectUtils.isEmpty(ssl.getCiphers() != null)) {
factory.setIncludeCipherSuites(ssl.getCiphers());
factory.setExcludeCipherSuites();
}
if (ssl.getEnabledProtocols() != null) {
factory.setIncludeProtocols(ssl.getEnabledProtocols());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ public void sslCiphersConfiguration() throws Exception {
.getConnectionFactory(SslConnectionFactory.class);
assertThat(connectionFactory.getSslContextFactory().getIncludeCipherSuites())
.containsExactly("ALPHA", "BRAVO", "CHARLIE");
assertThat(connectionFactory.getSslContextFactory()
.getExcludeCipherSuites()).isEmpty();
}

@Override
Expand Down

0 comments on commit 6cf8784

Please sign in to comment.