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 {
40
40
private final X509Certificate [] peerCertificates ;
41
41
42
42
43
- DefaultSslInfo (String sessionId , X509Certificate [] peerCertificates ) {
43
+ DefaultSslInfo (@ Nullable String sessionId , X509Certificate [] peerCertificates ) {
44
44
Assert .notNull (peerCertificates , "No SSL certificates" );
45
45
this .sessionId = sessionId ;
46
46
this .peerCertificates = peerCertificates ;
Original file line number Diff line number Diff line change 57
57
*/
58
58
class ServletServerHttpRequest extends AbstractServerHttpRequest {
59
59
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
-
64
60
static final DataBuffer EOF_BUFFER = new DefaultDataBufferFactory ().allocateBuffer (0 );
65
61
66
62
@@ -178,12 +174,19 @@ public InetSocketAddress getRemoteAddress() {
178
174
179
175
@ Nullable
180
176
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 );
187
190
}
188
191
189
192
@ Override
You can’t perform that action at this time.
0 commit comments