Skip to content

Commit 0476d26

Browse files
authored
Merge pull request #1626 from baranowb/UNDERTOW-2033_2.2.x
[UNDERTOW-2033] Derive SecurePredicate from connection encryption, ra…
2 parents cfe8c46 + 2da3df8 commit 0476d26

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/src/main/java/io/undertow/predicate/SecurePredicate.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@
1919
package io.undertow.predicate;
2020

2121
import io.undertow.server.HttpServerExchange;
22+
import io.undertow.server.SSLSessionInfo;
2223

2324
import java.util.Collections;
2425
import java.util.Map;
2526
import java.util.Set;
2627

28+
import javax.net.ssl.SSLSession;
29+
2730
/**
2831
* @author Stuart Douglas
2932
*/
@@ -33,7 +36,10 @@ public class SecurePredicate implements Predicate {
3336

3437
@Override
3538
public boolean resolve(HttpServerExchange value) {
36-
return value.getRequestScheme().equals("https");
39+
final SSLSession session = value.getConnection().getSslSession();
40+
final SSLSessionInfo info = value.getConnection().getSslSessionInfo();
41+
return (session != null && session.isValid())
42+
|| (info != null && info.getSSLSession() != null && info.getSSLSession().isValid());
3743
}
3844

3945
public String toString() {

0 commit comments

Comments
 (0)