mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-23 14:40:00 +00:00
Introduce factory methods in SslInfo and remove MockSslInfo
After further consideration, we have decided to remove the recently introduced MockSslInfo in favor of introducing the following static factory methods directly in the SslInfo interface. - SslInfo.from(String sessionId) - SslInfo from(String sessionId, X509Certificate... peerCertificates) See gh-35042 See gh-35078
This commit is contained in:
@@ -24,12 +24,14 @@ import org.jspecify.annotations.Nullable;
|
||||
* A holder for SSL session information.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Sam Brannen
|
||||
* @since 5.0.2
|
||||
* @see javax.net.ssl.SSLSession
|
||||
*/
|
||||
public interface SslInfo {
|
||||
|
||||
/**
|
||||
* Return the SSL session id, if any.
|
||||
* Return the SSL session ID, if any.
|
||||
*/
|
||||
@Nullable String getSessionId();
|
||||
|
||||
@@ -38,4 +40,21 @@ public interface SslInfo {
|
||||
*/
|
||||
X509Certificate @Nullable [] getPeerCertificates();
|
||||
|
||||
|
||||
/**
|
||||
* Create {@link SslInfo} configured with the supplied session ID.
|
||||
* @since 7.0
|
||||
*/
|
||||
static SslInfo from(String sessionId) {
|
||||
return new DefaultSslInfo(sessionId, new X509Certificate[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create {@link SslInfo} configured with the supplied session ID and certificates.
|
||||
* @since 7.0
|
||||
*/
|
||||
static SslInfo from(String sessionId, X509Certificate... peerCertificates) {
|
||||
return new DefaultSslInfo(sessionId, peerCertificates);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user