Merge branch '3.2.x'

Closes gh-39168
This commit is contained in:
Andy Wilkinson 2024-01-17 13:03:39 +00:00
commit d5d78e5b85
8 changed files with 100 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -27,6 +27,7 @@ import org.springframework.boot.ssl.jks.JksSslStoreDetails;
import org.springframework.boot.ssl.pem.PemSslStore;
import org.springframework.boot.ssl.pem.PemSslStoreBundle;
import org.springframework.boot.ssl.pem.PemSslStoreDetails;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.Assert;
/**
@ -142,4 +143,14 @@ public final class PropertiesSslBundle implements SslBundle {
properties.getPassword());
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("key", this.key);
creator.append("options", this.options);
creator.append("protocol", this.protocol);
creator.append("stores", this.stores);
return creator.toString();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,6 +20,7 @@ import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.StringUtils;
/**
@ -160,6 +161,16 @@ public interface SslBundle {
return managersToUse;
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("key", getKey());
creator.append("options", getOptions());
creator.append("protocol", getProtocol());
creator.append("stores", getStores());
return creator.toString();
}
};
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -19,6 +19,7 @@ package org.springframework.boot.ssl;
import java.security.KeyStore;
import java.security.KeyStoreException;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@ -94,6 +95,14 @@ public interface SslBundleKey {
return alias;
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("alias", alias);
creator.append("password", (password != null) ? "******" : null);
return creator.toString();
}
};
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -24,6 +24,8 @@ import java.util.Set;
import javax.net.ssl.SSLEngine;
import org.springframework.core.style.ToStringCreator;
/**
* Configuration options that should be applied when establishing an SSL connection.
*
@ -81,6 +83,14 @@ public interface SslOptions {
return enabledProtocols;
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("ciphers", ciphers);
creator.append("enabledProtocols", enabledProtocols);
return creator.toString();
}
};
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -18,6 +18,8 @@ package org.springframework.boot.ssl;
import java.security.KeyStore;
import org.springframework.core.style.ToStringCreator;
/**
* A bundle of key and trust stores that can be used to establish an SSL connection.
*
@ -75,6 +77,15 @@ public interface SslStoreBundle {
return keyStorePassword;
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("keyStore.type", (keyStore != null) ? keyStore.getType() : "none");
creator.append("keyStorePassword", (keyStorePassword != null) ? "******" : null);
creator.append("trustStore.type", (trustStore != null) ? trustStore.getType() : "none");
return creator.toString();
}
};
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,7 @@ import java.security.NoSuchProviderException;
import java.security.cert.CertificateException;
import org.springframework.boot.ssl.SslStoreBundle;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.Assert;
import org.springframework.util.ResourceUtils;
import org.springframework.util.StringUtils;
@ -123,4 +124,14 @@ public class JksSslStoreBundle implements SslStoreBundle {
}
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("keyStore.type", (this.keyStore != null) ? this.keyStore.getType() : "none");
String keyStorePassword = getKeyStorePassword();
creator.append("keyStorePassword", (keyStorePassword != null) ? "******" : null);
creator.append("trustStore.type", (this.trustStore != null) ? this.trustStore.getType() : "none");
return creator.toString();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,6 +26,7 @@ import java.security.cert.X509Certificate;
import java.util.List;
import org.springframework.boot.ssl.SslStoreBundle;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@ -145,4 +146,13 @@ public class PemSslStoreBundle implements SslStoreBundle {
}
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("keyStore.type", (this.keyStore != null) ? this.keyStore.getType() : "none");
creator.append("keyStorePassword", null);
creator.append("trustStore.type", (this.trustStore != null) ? this.trustStore.getType() : "none");
return creator.toString();
}
}

View File

@ -29,6 +29,7 @@ import org.springframework.boot.ssl.jks.JksSslStoreBundle;
import org.springframework.boot.ssl.jks.JksSslStoreDetails;
import org.springframework.boot.ssl.pem.PemSslStoreBundle;
import org.springframework.boot.ssl.pem.PemSslStoreDetails;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@ -186,6 +187,16 @@ public final class WebServerSslBundle implements SslBundle {
|| (ssl.getTrustStoreType() != null && ssl.getTrustStoreType().equals("PKCS11")));
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("key", this.key);
creator.append("protocol", this.protocol);
creator.append("stores", this.stores);
creator.append("options", this.options);
return creator.toString();
}
private static final class WebServerSslStoreBundle implements SslStoreBundle {
private final KeyStore keyStore;
@ -216,6 +227,15 @@ public final class WebServerSslBundle implements SslBundle {
return this.keyStorePassword;
}
@Override
public String toString() {
ToStringCreator creator = new ToStringCreator(this);
creator.append("keyStore.type", (this.keyStore != null) ? this.keyStore.getType() : "none");
creator.append("keyStorePassword", (this.keyStorePassword != null) ? "******" : null);
creator.append("trustStore.type", (this.trustStore != null) ? this.trustStore.getType() : "none");
return creator.toString();
}
}
}