Search in sources :

Example 1 with DecryptedEndPoint

use of org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint in project jetty.project by eclipse.

the class SocketCustomizationListener method onOpened.

@Override
public void onOpened(Connection connection) {
    EndPoint endp = connection.getEndPoint();
    boolean ssl = false;
    if (_ssl && endp instanceof DecryptedEndPoint) {
        endp = ((DecryptedEndPoint) endp).getSslConnection().getEndPoint();
        ssl = true;
    }
    if (endp instanceof SocketChannelEndPoint) {
        Socket socket = ((SocketChannelEndPoint) endp).getSocket();
        customize(socket, connection.getClass(), ssl);
    }
}
Also used : DecryptedEndPoint(org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint) SocketChannelEndPoint(org.eclipse.jetty.io.SocketChannelEndPoint) DecryptedEndPoint(org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint) EndPoint(org.eclipse.jetty.io.EndPoint) SocketChannelEndPoint(org.eclipse.jetty.io.SocketChannelEndPoint) Socket(java.net.Socket)

Example 2 with DecryptedEndPoint

use of org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint in project jetty.project by eclipse.

the class SecureRequestCustomizer method customize.

@Override
public void customize(Connector connector, HttpConfiguration channelConfig, Request request) {
    EndPoint endp = request.getHttpChannel().getEndPoint();
    if (endp instanceof DecryptedEndPoint) {
        SslConnection.DecryptedEndPoint ssl_endp = (DecryptedEndPoint) endp;
        SslConnection sslConnection = ssl_endp.getSslConnection();
        SSLEngine sslEngine = sslConnection.getSSLEngine();
        customize(sslEngine, request);
        if (request.getHttpURI().getScheme() == null)
            request.setScheme(HttpScheme.HTTPS.asString());
    } else if (endp instanceof ProxyConnectionFactory.ProxyEndPoint) {
        ProxyConnectionFactory.ProxyEndPoint proxy = (ProxyConnectionFactory.ProxyEndPoint) endp;
        if (request.getHttpURI().getScheme() == null && proxy.getAttribute(ProxyConnectionFactory.TLS_VERSION) != null)
            request.setScheme(HttpScheme.HTTPS.asString());
    }
    if (HttpScheme.HTTPS.is(request.getScheme()))
        customizeSecure(request);
}
Also used : SslConnection(org.eclipse.jetty.io.ssl.SslConnection) DecryptedEndPoint(org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint) SSLEngine(javax.net.ssl.SSLEngine) DecryptedEndPoint(org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint) DecryptedEndPoint(org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint) EndPoint(org.eclipse.jetty.io.EndPoint)

Aggregations

EndPoint (org.eclipse.jetty.io.EndPoint)2 DecryptedEndPoint (org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint)2 Socket (java.net.Socket)1 SSLEngine (javax.net.ssl.SSLEngine)1 SocketChannelEndPoint (org.eclipse.jetty.io.SocketChannelEndPoint)1 SslConnection (org.eclipse.jetty.io.ssl.SslConnection)1