Skip to content

Commit

Permalink
Merge pull request #1627 from baranowb/UNDERTOW-2033_2.3.x
Browse files Browse the repository at this point in the history
[UNDERTOW-2033] Derive SecurePredicate from connection encryption, ra…
  • Loading branch information
fl4via authored Jul 16, 2024
2 parents 297da38 + 6fbe9c4 commit b7a5833
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
package io.undertow.predicate;

import io.undertow.server.HttpServerExchange;
import io.undertow.server.SSLSessionInfo;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

import javax.net.ssl.SSLSession;

/**
* @author Stuart Douglas
*/
Expand All @@ -33,7 +36,10 @@ public class SecurePredicate implements Predicate {

@Override
public boolean resolve(HttpServerExchange value) {
return value.getRequestScheme().equals("https");
final SSLSession session = value.getConnection().getSslSession();
final SSLSessionInfo info = value.getConnection().getSslSessionInfo();
return (session != null && session.isValid())
|| (info != null && info.getSSLSession() != null && info.getSSLSession().isValid());
}

public String toString() {
Expand Down

0 comments on commit b7a5833

Please sign in to comment.