Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ELY-654] Ensure that negative values are converted to zero when setting sessionCacheSize and sessionTimeout in SSLSessionContext. #505

Merged
merged 1 commit into from Oct 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/main/java/org/wildfly/security/ssl/SSLContextBuilder.java
Expand Up @@ -52,6 +52,9 @@
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
*/
public final class SSLContextBuilder {
private static final int DEFAULT_SESSION_CACHE_SIZE = 0;
private static final int DEFAULT_SESSION_TIMEOUT = 0;

private SecurityDomain securityDomain;
private CipherSuiteSelector cipherSuiteSelector = CipherSuiteSelector.openSslDefault();
private ProtocolSelector protocolSelector = ProtocolSelector.DEFAULT_SELECTOR;
Expand Down Expand Up @@ -271,8 +274,8 @@ public SecurityFactory<SSLContext> build() {
final Supplier<Provider[]> providerSupplier = this.providerSupplier;
final boolean clientMode = this.clientMode;
final boolean authenticationOptional = this.authenticationOptional;
final int sessionCacheSize = this.sessionCacheSize;
final int sessionTimeout = this.sessionTimeout;
final int sessionCacheSize = (this.sessionCacheSize < 0) ? DEFAULT_SESSION_CACHE_SIZE : this.sessionCacheSize;
final int sessionTimeout = (this.sessionTimeout < 0) ? DEFAULT_SESSION_TIMEOUT : this.sessionTimeout;
final boolean wantClientAuth = this.wantClientAuth;
final boolean needClientAuth = this.needClientAuth;
return new OneTimeSecurityFactory<SSLContext>(() -> {
Expand Down