File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed
spring-web/src/main/java/org/springframework/http/server/reactive Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ final class DefaultSslInfo implements SslInfo {
4040 private final X509Certificate [] peerCertificates ;
4141
4242
43- DefaultSslInfo (String sessionId , X509Certificate [] peerCertificates ) {
43+ DefaultSslInfo (@ Nullable String sessionId , X509Certificate [] peerCertificates ) {
4444 Assert .notNull (peerCertificates , "No SSL certificates" );
4545 this .sessionId = sessionId ;
4646 this .peerCertificates = peerCertificates ;
Original file line number Diff line number Diff line change 5757 */
5858class ServletServerHttpRequest extends AbstractServerHttpRequest {
5959
60- private static final String X509_CERTIFICATE_ATTRIBUTE = "javax.servlet.request.X509Certificate" ;
61-
62- private static final String SSL_SESSION_ID_ATTRIBUTE = "javax.servlet.request.ssl_session_id" ;
63-
6460 static final DataBuffer EOF_BUFFER = new DefaultDataBufferFactory ().allocateBuffer (0 );
6561
6662
@@ -178,12 +174,19 @@ public InetSocketAddress getRemoteAddress() {
178174
179175 @ Nullable
180176 protected SslInfo initSslInfo () {
181- if (!this .request .isSecure ()) {
182- return null ;
183- }
184- return new DefaultSslInfo (
185- (String ) request .getAttribute (SSL_SESSION_ID_ATTRIBUTE ),
186- (X509Certificate []) request .getAttribute (X509_CERTIFICATE_ATTRIBUTE ));
177+ X509Certificate [] certificates = getX509Certificates ();
178+ return certificates != null ? new DefaultSslInfo (getSslSessionId (), certificates ) : null ;
179+ }
180+
181+ @ Nullable
182+ private String getSslSessionId () {
183+ return (String ) this .request .getAttribute ("javax.servlet.request.ssl_session_id" );
184+ }
185+
186+ @ Nullable
187+ private X509Certificate [] getX509Certificates () {
188+ String name = "javax.servlet.request.X509Certificate" ;
189+ return (X509Certificate []) this .request .getAttribute (name );
187190 }
188191
189192 @ Override
You can’t perform that action at this time.
0 commit comments