Added concept of SslConnection
This commit is contained in:
parent
6a17c69bfb
commit
61664d3c0f
|
@ -19,7 +19,6 @@ import org.eclipse.jetty.ajp.Ajp13SocketConnector;
|
|||
import org.eclipse.jetty.deploy.DeploymentManager;
|
||||
import org.eclipse.jetty.deploy.providers.ContextProvider;
|
||||
import org.eclipse.jetty.deploy.providers.WebAppProvider;
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
|
@ -35,6 +34,7 @@ import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
|||
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
|
||||
import org.eclipse.jetty.server.ssl.SslSocketConnector;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
|
||||
public class LikeJettyXml
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
|
||||
package org.eclipse.jetty.embedded;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
||||
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -17,13 +17,13 @@ import java.util.Collections;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
import org.eclipse.jetty.security.LoginService;
|
||||
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
|
||||
public class SecuredHelloHandler
|
||||
{
|
||||
|
|
|
@ -174,7 +174,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection implemen
|
|||
return false;
|
||||
}
|
||||
|
||||
public void closed()
|
||||
public void onClose()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -29,13 +29,13 @@ import org.eclipse.jetty.client.security.RealmResolver;
|
|||
import org.eclipse.jetty.client.security.SecurityListener;
|
||||
import org.eclipse.jetty.http.HttpBuffers;
|
||||
import org.eclipse.jetty.http.HttpSchemes;
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.io.Buffers.Type;
|
||||
import org.eclipse.jetty.util.Attributes;
|
||||
import org.eclipse.jetty.util.AttributesMap;
|
||||
import org.eclipse.jetty.util.component.AggregateLifeCycle;
|
||||
import org.eclipse.jetty.util.component.Dumpable;
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
import org.eclipse.jetty.util.thread.ThreadPool;
|
||||
import org.eclipse.jetty.util.thread.Timeout;
|
||||
|
|
|
@ -26,7 +26,6 @@ import javax.net.ssl.SSLSession;
|
|||
|
||||
import org.eclipse.jetty.http.HttpGenerator;
|
||||
import org.eclipse.jetty.http.HttpParser;
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.io.Buffer;
|
||||
import org.eclipse.jetty.io.Buffers;
|
||||
import org.eclipse.jetty.io.Buffers.Type;
|
||||
|
@ -41,6 +40,7 @@ import org.eclipse.jetty.io.nio.SslSelectChannelEndPoint;
|
|||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.thread.Timeout;
|
||||
|
||||
class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector
|
||||
|
|
|
@ -33,7 +33,7 @@ public class AsyncSslHttpExchangeTest extends SslHttpExchangeTest
|
|||
@Override
|
||||
public void testPerf() throws Exception
|
||||
{
|
||||
sender(1,true);
|
||||
sender(10,true);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.eclipse.jetty.http.HttpHeaders;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.http.MimeTypes;
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.io.ByteArrayBuffer;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
|
@ -27,6 +26,7 @@ import org.eclipse.jetty.server.handler.ConnectHandler;
|
|||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
||||
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jetty.client.security.Realm;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
|
@ -33,6 +32,7 @@ import org.eclipse.jetty.servlet.DefaultServlet;
|
|||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
|
||||
public class SecuredContentExchangeTest
|
||||
extends ContentExchangeTest
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Set;
|
|||
|
||||
import org.eclipse.jetty.client.security.Realm;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
|
@ -34,6 +33,7 @@ import org.eclipse.jetty.servlet.DefaultServlet;
|
|||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SecuredErrorStatusTest
|
||||
|
|
|
@ -31,7 +31,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.eclipse.jetty.client.security.Realm;
|
||||
import org.eclipse.jetty.client.security.SimpleRealmResolver;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.io.Buffer;
|
||||
import org.eclipse.jetty.io.EofException;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
|
@ -46,6 +45,7 @@ import org.eclipse.jetty.server.Server;
|
|||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -20,9 +20,6 @@ import java.util.Set;
|
|||
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.http.security.Credential;
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
import org.eclipse.jetty.security.IdentityService;
|
||||
|
@ -38,6 +35,9 @@ import org.eclipse.jetty.servlet.DefaultServlet;
|
|||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.eclipse.jetty.util.security.Credential;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
public class SslCertSecuredExchangeTest extends ContentExchangeTest
|
||||
{
|
||||
|
|
|
@ -15,7 +15,6 @@ package org.eclipse.jetty.client;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||
|
@ -24,6 +23,7 @@ import org.eclipse.jetty.servlet.DefaultServlet;
|
|||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
public class SslContentExchangeTest
|
||||
extends ContentExchangeTest
|
||||
|
|
|
@ -19,8 +19,6 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jetty.client.security.Realm;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
|
@ -34,6 +32,8 @@ import org.eclipse.jetty.servlet.DefaultServlet;
|
|||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
public class SslSecuredContentExchangeTest
|
||||
extends ContentExchangeTest
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Set;
|
|||
|
||||
import org.eclipse.jetty.client.security.Realm;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
|
@ -34,6 +33,7 @@ import org.eclipse.jetty.servlet.DefaultServlet;
|
|||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.junit.Test;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -34,8 +34,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.eclipse.jetty.client.security.HashRealmResolver;
|
||||
import org.eclipse.jetty.client.security.Realm;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.io.EofException;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
|
@ -51,6 +49,8 @@ import org.eclipse.jetty.server.ssl.SslSocketConnector;
|
|||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.security.KeyStore;
|
|||
import java.security.cert.CRL;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.HandlerCollection;
|
||||
|
@ -16,6 +15,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
|
|||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.security.CertificateUtils;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
public abstract class SslValidationTestBase extends ContentExchangeTest
|
||||
{
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
package org.eclipse.jetty.client.helperClasses;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
|
||||
|
@ -22,6 +21,7 @@ import org.eclipse.jetty.server.ssl.SslSocketConnector;
|
|||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -35,7 +35,7 @@ public abstract class AbstractConnection implements Connection
|
|||
return _endp;
|
||||
}
|
||||
|
||||
public void idleExpired()
|
||||
public void onIdleExpired()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -50,10 +50,10 @@ public interface Connection
|
|||
/**
|
||||
* Called when the connection is closed
|
||||
*/
|
||||
void closed();
|
||||
void onClose();
|
||||
|
||||
/**
|
||||
* Called when the connection idle timeout expires
|
||||
*/
|
||||
void idleExpired();
|
||||
void onIdleExpired();
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
|||
/* ------------------------------------------------------------ */
|
||||
protected void idleExpired()
|
||||
{
|
||||
_connection.idleExpired();
|
||||
_connection.onIdleExpired();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -0,0 +1,435 @@
|
|||
// ========================================================================
|
||||
// Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
package org.eclipse.jetty.io.nio;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.SocketChannel;
|
||||
|
||||
import javax.net.ssl.SSLEngine;
|
||||
import javax.net.ssl.SSLEngineResult;
|
||||
import javax.net.ssl.SSLEngineResult.HandshakeStatus;
|
||||
import javax.net.ssl.SSLException;
|
||||
import javax.net.ssl.SSLSession;
|
||||
|
||||
import org.eclipse.jetty.io.AbstractConnection;
|
||||
import org.eclipse.jetty.io.Buffer;
|
||||
import org.eclipse.jetty.io.Buffers;
|
||||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.EofException;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
*/
|
||||
public class SslConnection extends AbstractConnection implements AsyncConnection
|
||||
{
|
||||
private static final Logger LOG=Log.getLogger("org.eclipse.jetty.io.nio.ssl");
|
||||
static
|
||||
{
|
||||
LOG.setDebugEnabled(true);
|
||||
}
|
||||
private static final NIOBuffer __ZERO_BUFFER=new IndirectNIOBuffer(0);
|
||||
|
||||
private final ThreadLocal<NIOBuffer> __inBuffer = new ThreadLocal<NIOBuffer>();
|
||||
private final ThreadLocal<NIOBuffer> __outBuffer = new ThreadLocal<NIOBuffer>();
|
||||
private final SSLEngine _engine;
|
||||
private final SSLSession _session;
|
||||
private AsyncConnection _delegate;
|
||||
private int _allocations;
|
||||
private NIOBuffer _inbound;
|
||||
private NIOBuffer _unwrapBuf;
|
||||
private NIOBuffer _outbound;
|
||||
|
||||
public SslConnection(SSLEngine engine,AsyncConnection connection,EndPoint endp)
|
||||
{
|
||||
this(engine,connection,endp,System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public SslConnection(SSLEngine engine,AsyncConnection connection,EndPoint endp, long timeStamp)
|
||||
{
|
||||
super(endp,timeStamp);
|
||||
_delegate=connection;
|
||||
_engine=engine;
|
||||
_session=_engine.getSession();
|
||||
}
|
||||
|
||||
private void allocateBuffers()
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
if (_allocations++==0)
|
||||
{
|
||||
if (_inbound==null)
|
||||
{
|
||||
_inbound = __inBuffer.get();
|
||||
if (_inbound==null)
|
||||
_inbound=new IndirectNIOBuffer(_session.getPacketBufferSize());
|
||||
}
|
||||
|
||||
if (_outbound==null)
|
||||
{
|
||||
_outbound = __outBuffer.get();
|
||||
if (_outbound==null)
|
||||
_outbound=new IndirectNIOBuffer(_session.getPacketBufferSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void releaseBuffers()
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
if (--_allocations==0)
|
||||
{
|
||||
if (_inbound!=null && _inbound.length()==0)
|
||||
{
|
||||
__inBuffer.set(_inbound);
|
||||
_inbound=null;
|
||||
}
|
||||
|
||||
if (_outbound!=null && _outbound.length()==0)
|
||||
{
|
||||
__outBuffer.set(_outbound);
|
||||
_outbound=null;
|
||||
}
|
||||
|
||||
if (_unwrapBuf!=null && _unwrapBuf.length()==0)
|
||||
_unwrapBuf=null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Connection handle() throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
allocateBuffers();
|
||||
|
||||
boolean progress=true;
|
||||
|
||||
while (progress)
|
||||
{
|
||||
progress=false;
|
||||
int filled=0,flushed=0;
|
||||
|
||||
// Read any available data
|
||||
if (_inbound.space()>0 && (filled=_endp.fill(_inbound))>0)
|
||||
progress = true;
|
||||
|
||||
// flush any output data
|
||||
if (_outbound.hasContent() && (flushed=_endp.flush(_outbound))>0)
|
||||
progress = true;
|
||||
|
||||
LOG.debug("{} filled={} flushed={}",_session,filled,flushed);
|
||||
|
||||
// If we are handshook let the delegate connection
|
||||
if (_engine.getHandshakeStatus()==HandshakeStatus.NOT_HANDSHAKING)
|
||||
{
|
||||
// handle the delegate connection
|
||||
AsyncConnection next = (AsyncConnection)_delegate.handle();
|
||||
if (next!=_delegate && next==null)
|
||||
{
|
||||
_delegate=next;
|
||||
progress=true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
process(null,null);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
releaseBuffers();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isIdle()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSuspended()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onClose()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void onInputShutdown() throws IOException
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
private synchronized int process(NIOBuffer toFill, NIOBuffer toFlush) throws IOException
|
||||
{
|
||||
if (toFill==null)
|
||||
{
|
||||
if (_unwrapBuf==null)
|
||||
_unwrapBuf=new IndirectNIOBuffer(_session.getApplicationBufferSize());
|
||||
toFill=_unwrapBuf;
|
||||
}
|
||||
else if (_unwrapBuf!=null && _unwrapBuf.hasContent())
|
||||
{
|
||||
_unwrapBuf.skip(toFill.put(_unwrapBuf));
|
||||
return 1;
|
||||
}
|
||||
if (toFlush==null)
|
||||
toFlush=__ZERO_BUFFER;
|
||||
|
||||
HandshakeStatus initialStatus = _engine.getHandshakeStatus();
|
||||
boolean progress=true;
|
||||
int received=0;
|
||||
int sent=0;
|
||||
|
||||
try
|
||||
{
|
||||
allocateBuffers();
|
||||
|
||||
while (progress)
|
||||
{
|
||||
progress=false;
|
||||
|
||||
// handle the current hand share status
|
||||
LOG.debug("{} status {}",_session,_engine.getHandshakeStatus());
|
||||
switch(_engine.getHandshakeStatus())
|
||||
{
|
||||
case FINISHED:
|
||||
throw new IllegalStateException();
|
||||
|
||||
case NOT_HANDSHAKING:
|
||||
{
|
||||
// Try wrapping some application data
|
||||
if (toFlush.hasContent() && _outbound.space()>0 && wrap(toFlush))
|
||||
progress=true;
|
||||
|
||||
|
||||
// Try unwrapping some application data
|
||||
if (toFill.space()>0 && _inbound.hasContent() && unwrap(toFill))
|
||||
progress=true;
|
||||
}
|
||||
break;
|
||||
|
||||
case NEED_TASK:
|
||||
{
|
||||
// A task needs to be run, so run it!
|
||||
Runnable task;
|
||||
while ((task=_engine.getDelegatedTask())!=null)
|
||||
{
|
||||
progress=true;
|
||||
task.run();
|
||||
}
|
||||
|
||||
// Detect SUN JVM Bug!!!
|
||||
if(initialStatus==HandshakeStatus.NOT_HANDSHAKING &&
|
||||
_engine.getHandshakeStatus()==HandshakeStatus.NEED_UNWRAP && sent==0)
|
||||
{
|
||||
// This should be NEED_WRAP
|
||||
// The fix simply detects the signature of the bug and then close the connection (fail-fast) so that ff3 will delegate to using SSL instead of TLS.
|
||||
// This is a jvm bug on java1.6 where the SSLEngine expects more data from the initial handshake when the client(ff3-tls) already had given it.
|
||||
// See http://jira.codehaus.org/browse/JETTY-567 for more details
|
||||
LOG.warn("{} JETTY-567",_session);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NEED_WRAP:
|
||||
{
|
||||
// The SSL needs to send some handshake data to the other side
|
||||
if (wrap(toFlush))
|
||||
progress=true;
|
||||
}
|
||||
break;
|
||||
|
||||
case NEED_UNWRAP:
|
||||
{
|
||||
// The SSL needs to receive some handshake data from the other side
|
||||
if (unwrap(toFill))
|
||||
progress=true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
LOG.debug("{} progress {}",_session,progress);
|
||||
}
|
||||
|
||||
LOG.debug("{} received {} sent {}",_session,received,sent);
|
||||
}
|
||||
finally
|
||||
{
|
||||
releaseBuffers();
|
||||
}
|
||||
return (received<0||sent<0)?-1:(received+sent);
|
||||
}
|
||||
|
||||
private synchronized boolean wrap(final NIOBuffer buffer) throws IOException
|
||||
{
|
||||
ByteBuffer bbuf=buffer.getByteBuffer();
|
||||
final SSLEngineResult result;
|
||||
|
||||
synchronized(bbuf)
|
||||
{
|
||||
_outbound.compact();
|
||||
ByteBuffer out_buffer=_outbound.getByteBuffer();
|
||||
synchronized(out_buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
bbuf.position(buffer.getIndex());
|
||||
bbuf.limit(buffer.putIndex());
|
||||
out_buffer.position(_outbound.putIndex());
|
||||
out_buffer.limit(out_buffer.capacity());
|
||||
result=_engine.wrap(bbuf,out_buffer);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} wrap {} {} consumed={} produced={}",
|
||||
_session,
|
||||
result.getStatus(),
|
||||
result.getHandshakeStatus(),
|
||||
result.bytesConsumed(),
|
||||
result.bytesProduced());
|
||||
|
||||
buffer.skip(result.bytesConsumed());
|
||||
buffer.compact();
|
||||
_outbound.setPutIndex(_outbound.putIndex()+result.bytesProduced());
|
||||
}
|
||||
catch(SSLException e)
|
||||
{
|
||||
LOG.warn(_endp+":",e);
|
||||
_endp.close(); // TODO ?
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
out_buffer.position(0);
|
||||
out_buffer.limit(out_buffer.capacity());
|
||||
bbuf.position(0);
|
||||
bbuf.limit(bbuf.capacity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch(result.getStatus())
|
||||
{
|
||||
case BUFFER_UNDERFLOW:
|
||||
throw new IllegalStateException();
|
||||
|
||||
case BUFFER_OVERFLOW:
|
||||
break;
|
||||
|
||||
case OK:
|
||||
break;
|
||||
|
||||
case CLOSED:
|
||||
System.err.println("wrap CLOSE");
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG.warn("{} wrap default {}",_session,result);
|
||||
throw new IOException(result.toString());
|
||||
}
|
||||
|
||||
return result.bytesConsumed()>0 || result.bytesProduced()>0;
|
||||
}
|
||||
|
||||
private synchronized boolean unwrap(final NIOBuffer buffer) throws IOException
|
||||
{
|
||||
if (!_inbound.hasContent())
|
||||
return false;
|
||||
|
||||
buffer.compact();
|
||||
ByteBuffer bbuf=buffer.getByteBuffer();
|
||||
final SSLEngineResult result;
|
||||
|
||||
synchronized(bbuf)
|
||||
{
|
||||
ByteBuffer in_buffer=_inbound.getByteBuffer();
|
||||
synchronized(in_buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
bbuf.position(buffer.putIndex());
|
||||
bbuf.limit(buffer.capacity());
|
||||
in_buffer.position(_inbound.getIndex());
|
||||
in_buffer.limit(_inbound.putIndex());
|
||||
|
||||
result=_engine.unwrap(in_buffer,bbuf);
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("{} unwrap {} {} consumed={} produced={}",
|
||||
_session,
|
||||
result.getStatus(),
|
||||
result.getHandshakeStatus(),
|
||||
result.bytesConsumed(),
|
||||
result.bytesProduced());
|
||||
|
||||
_inbound.skip(result.bytesConsumed());
|
||||
_inbound.compact();
|
||||
buffer.setPutIndex(buffer.putIndex()+result.bytesProduced());
|
||||
}
|
||||
catch(SSLException e)
|
||||
{
|
||||
LOG.warn(_endp+":",e);
|
||||
_endp.close(); // TODO ?
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
in_buffer.position(0);
|
||||
in_buffer.limit(in_buffer.capacity());
|
||||
bbuf.position(0);
|
||||
bbuf.limit(bbuf.capacity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch(result.getStatus())
|
||||
{
|
||||
case BUFFER_UNDERFLOW:
|
||||
break;
|
||||
|
||||
case BUFFER_OVERFLOW:
|
||||
LOG.debug("{} wrap {}",_session,result);
|
||||
break;
|
||||
|
||||
case OK:
|
||||
break;
|
||||
|
||||
case CLOSED:
|
||||
System.err.println("unwrap CLOSE");
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG.warn("{} wrap default {}",_session,result);
|
||||
throw new IOException(result.toString());
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled() && result.bytesProduced()>0)
|
||||
LOG.debug("{} unwrapped '{}'",_session,buffer);
|
||||
|
||||
return result.bytesConsumed()>0 || result.bytesProduced()>0;
|
||||
}
|
||||
|
||||
}
|
|
@ -192,6 +192,9 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
|
|||
@Override
|
||||
public void shutdownInput() throws IOException
|
||||
{
|
||||
System.err.println("SSL sIn");
|
||||
super.shutdownInput();
|
||||
/*
|
||||
LOG.debug("{} shutdownInput",_session);
|
||||
|
||||
// All SSL closes should be graceful, as it is more secure.
|
||||
|
@ -212,12 +215,14 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
|
|||
LOG.ignore(e);
|
||||
close();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void shutdownOutput() throws IOException
|
||||
{
|
||||
System.err.println("SSL sOut");
|
||||
LOG.debug("{} shutdownOutput",_session);
|
||||
|
||||
// All SSL closes should be graceful, as it is more secure.
|
||||
|
@ -526,6 +531,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
|
|||
while (_inNIOBuffer.space()>0 && super.isOpen())
|
||||
{
|
||||
int filled=super.fill(_inNIOBuffer);
|
||||
System.err.println("f="+filled);
|
||||
if (_debug) LOG.debug("{} filled {}",_session,filled);
|
||||
if (filled < 0)
|
||||
remoteClosed = true;
|
||||
|
@ -612,6 +618,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
|
|||
return (total_filled > 0);
|
||||
|
||||
case CLOSED:
|
||||
System.err.println("unwrap CLOSE");
|
||||
if (super.isOpen())
|
||||
super.close();
|
||||
// return true is some bytes somewhere were moved about.
|
||||
|
@ -709,6 +716,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
|
|||
case OK:
|
||||
return _result.bytesConsumed();
|
||||
case CLOSED:
|
||||
System.err.println("wrap CLOSE");
|
||||
if (super.isOpen())
|
||||
super.close();
|
||||
return _result.bytesConsumed()>0?_result.bytesConsumed():-1;
|
||||
|
|
|
@ -9,19 +9,19 @@ import org.junit.Test;
|
|||
|
||||
public abstract class EndPointTest<T extends EndPoint>
|
||||
{
|
||||
public static class Connection<T>
|
||||
public static class EndPointPair<T>
|
||||
{
|
||||
public T client;
|
||||
public T server;
|
||||
}
|
||||
|
||||
protected abstract Connection<T> newConnection() throws Exception;
|
||||
protected abstract EndPointPair<T> newConnection() throws Exception;
|
||||
|
||||
|
||||
@Test
|
||||
public void testClientServerExchange() throws Exception
|
||||
{
|
||||
Connection<T> c = newConnection();
|
||||
EndPointPair<T> c = newConnection();
|
||||
Buffer buffer = new IndirectNIOBuffer(4096);
|
||||
|
||||
c.client.flush(new ByteArrayBuffer("request"));
|
||||
|
@ -96,7 +96,7 @@ public abstract class EndPointTest<T extends EndPoint>
|
|||
@Test
|
||||
public void testClientClose() throws Exception
|
||||
{
|
||||
Connection<T> c = newConnection();
|
||||
EndPointPair<T> c = newConnection();
|
||||
Buffer buffer = new IndirectNIOBuffer(4096);
|
||||
|
||||
c.client.flush(new ByteArrayBuffer("request"));
|
||||
|
|
|
@ -26,9 +26,9 @@ public class SocketEndPointTest extends EndPointTest<SocketEndPoint>
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Connection<SocketEndPoint> newConnection() throws Exception
|
||||
protected EndPointPair<SocketEndPoint> newConnection() throws Exception
|
||||
{
|
||||
Connection<SocketEndPoint> c = new Connection<SocketEndPoint>();
|
||||
EndPointPair<SocketEndPoint> c = new EndPointPair<SocketEndPoint>();
|
||||
c.client=new SocketEndPoint(new Socket(connector.getInetAddress(),connector.getLocalPort()));
|
||||
c.server=new SocketEndPoint(connector.accept());
|
||||
return c;
|
||||
|
|
|
@ -26,9 +26,9 @@ public class ChannelEndPointTest extends EndPointTest<ChannelEndPoint>
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Connection<ChannelEndPoint> newConnection() throws Exception
|
||||
protected EndPointPair<ChannelEndPoint> newConnection() throws Exception
|
||||
{
|
||||
Connection<ChannelEndPoint> c = new Connection<ChannelEndPoint>();
|
||||
EndPointPair<ChannelEndPoint> c = new EndPointPair<ChannelEndPoint>();
|
||||
|
||||
c.client=new ChannelEndPoint(SocketChannel.open(connector.socket().getLocalSocketAddress()));
|
||||
c.server=new ChannelEndPoint(connector.accept());
|
||||
|
|
|
@ -0,0 +1,197 @@
|
|||
package org.eclipse.jetty.io.nio;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
|
||||
import org.eclipse.jetty.io.AbstractConnection;
|
||||
import org.eclipse.jetty.io.ConnectedEndPoint;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SelectChannelEndPointTest
|
||||
{
|
||||
protected ServerSocketChannel _connector;
|
||||
protected ServerSocketChannel __serverSocket;
|
||||
protected QueuedThreadPool _threadPool = new QueuedThreadPool();
|
||||
protected SelectorManager _manager = new SelectorManager()
|
||||
{
|
||||
@Override
|
||||
public boolean dispatch(Runnable task)
|
||||
{
|
||||
return _threadPool.dispatch(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void endPointClosed(SelectChannelEndPoint endpoint)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void endPointOpened(SelectChannelEndPoint endpoint)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void endPointUpgraded(ConnectedEndPoint endpoint, org.eclipse.jetty.io.Connection oldConnection)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AsyncConnection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint)
|
||||
{
|
||||
return SelectChannelEndPointTest.this.newConnection(channel,endpoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey sKey) throws IOException
|
||||
{
|
||||
return new SelectChannelEndPoint(channel,selectSet,sKey,2000);
|
||||
}
|
||||
};
|
||||
|
||||
@Before
|
||||
public void startManager() throws Exception
|
||||
{
|
||||
_connector = ServerSocketChannel.open();
|
||||
_connector.socket().bind(null);
|
||||
_threadPool.start();
|
||||
_manager.start();
|
||||
}
|
||||
|
||||
@After
|
||||
public void stopManager() throws Exception
|
||||
{
|
||||
_manager.stop();
|
||||
_threadPool.stop();
|
||||
_connector.close();
|
||||
}
|
||||
|
||||
protected Socket newClient() throws IOException
|
||||
{
|
||||
return new Socket(_connector.socket().getInetAddress(),_connector.socket().getLocalPort());
|
||||
}
|
||||
|
||||
protected AsyncConnection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint)
|
||||
{
|
||||
return new TestConnection(endpoint);
|
||||
}
|
||||
|
||||
public static class TestConnection extends AbstractConnection implements AsyncConnection
|
||||
{
|
||||
NIOBuffer _in = new IndirectNIOBuffer(32*1024);
|
||||
NIOBuffer _out = new IndirectNIOBuffer(32*1024);
|
||||
boolean _echo=true;
|
||||
|
||||
public TestConnection(EndPoint endp)
|
||||
{
|
||||
super(endp);
|
||||
}
|
||||
|
||||
public org.eclipse.jetty.io.Connection handle() throws IOException
|
||||
{
|
||||
boolean progress=true;
|
||||
while(progress)
|
||||
{
|
||||
progress=false;
|
||||
_in.compact();
|
||||
if (_in.space()>0 && _endp.fill(_in)>0)
|
||||
progress=true;
|
||||
|
||||
if (_echo && _in.hasContent() && _in.skip(_out.put(_in))>0)
|
||||
progress=true;
|
||||
|
||||
if (_out.hasContent() && _endp.flush(_out)>0)
|
||||
progress=true;
|
||||
|
||||
_out.compact();
|
||||
|
||||
if (!_out.hasContent() && _endp.isInputShutdown())
|
||||
_endp.shutdownOutput();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isIdle()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSuspended()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onClose()
|
||||
{
|
||||
}
|
||||
|
||||
public void onInputShutdown() throws IOException
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEcho() throws Exception
|
||||
{
|
||||
Socket client = newClient();
|
||||
|
||||
client.setSoTimeout(500);
|
||||
|
||||
SocketChannel server = _connector.accept();
|
||||
server.configureBlocking(false);
|
||||
|
||||
_manager.register(server);
|
||||
|
||||
// Write client to server
|
||||
client.getOutputStream().write("HelloWorld".getBytes("UTF-8"));
|
||||
|
||||
// Verify echo server to client
|
||||
for (char c : "HelloWorld".toCharArray())
|
||||
{
|
||||
int b = client.getInputStream().read();
|
||||
assertTrue(b>0);
|
||||
assertEquals(c,(char)b);
|
||||
}
|
||||
|
||||
// wait for read timeout
|
||||
long start=System.currentTimeMillis();
|
||||
try
|
||||
{
|
||||
client.getInputStream().read();
|
||||
Assert.fail();
|
||||
}
|
||||
catch(SocketTimeoutException e)
|
||||
{
|
||||
assertTrue(System.currentTimeMillis()-start>=400);
|
||||
}
|
||||
|
||||
// write then shutdown
|
||||
client.getOutputStream().write("Goodbye".getBytes("UTF-8"));
|
||||
client.shutdownOutput();
|
||||
|
||||
|
||||
// Verify echo server to client
|
||||
for (char c : "Goodbye".toCharArray())
|
||||
{
|
||||
int b = client.getInputStream().read();
|
||||
assertTrue(b>0);
|
||||
assertEquals(c,(char)b);
|
||||
}
|
||||
|
||||
// Read close
|
||||
assertEquals(-1,client.getInputStream().read());
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package org.eclipse.jetty.io.nio;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.nio.channels.SocketChannel;
|
||||
|
||||
import javax.net.ssl.SSLEngine;
|
||||
import javax.net.ssl.SSLException;
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
|
||||
public class SslSelectChannelEndPointTest extends SelectChannelEndPointTest
|
||||
{
|
||||
static SslContextFactory __sslCtxFactory=new SslContextFactory();
|
||||
|
||||
@BeforeClass
|
||||
public static void initSslEngine() throws Exception
|
||||
{
|
||||
File keystore = MavenTestingUtils.getTestResourceFile("keystore");
|
||||
__sslCtxFactory.setKeyStorePath(keystore.getAbsolutePath());
|
||||
__sslCtxFactory.setKeyStorePassword("storepwd");
|
||||
__sslCtxFactory.setKeyManagerPassword("keypwd");
|
||||
__sslCtxFactory.setTrustAll(true);
|
||||
__sslCtxFactory.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Socket newClient() throws IOException
|
||||
{
|
||||
SSLSocket socket = __sslCtxFactory.newSslSocket();
|
||||
socket.connect(_connector.socket().getLocalSocketAddress());
|
||||
return socket;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AsyncConnection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint)
|
||||
{
|
||||
try
|
||||
{
|
||||
AsyncConnection delegate = super.newConnection(channel,endpoint);
|
||||
SSLEngine engine = __sslCtxFactory.newSslEngine();
|
||||
engine.setUseClientMode(false);
|
||||
engine.beginHandshake();
|
||||
return new SslConnection(engine,delegate,endpoint);
|
||||
}
|
||||
catch(SSLException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
Binary file not shown.
|
@ -13,7 +13,7 @@
|
|||
|
||||
package org.eclipse.jetty.security;
|
||||
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
|
||||
public class ConstraintMapping
|
||||
{
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import org.eclipse.jetty.http.PathMap;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.AbstractHttpConnection;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
|
@ -33,6 +32,7 @@ import org.eclipse.jetty.server.Response;
|
|||
import org.eclipse.jetty.server.UserIdentity;
|
||||
import org.eclipse.jetty.util.StringMap;
|
||||
import org.eclipse.jetty.util.TypeUtil;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,6 @@ package org.eclipse.jetty.security;
|
|||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.security.Authenticator.AuthConfiguration;
|
||||
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
|
||||
import org.eclipse.jetty.security.authentication.ClientCertAuthenticator;
|
||||
|
@ -23,6 +22,7 @@ import org.eclipse.jetty.security.authentication.DigestAuthenticator;
|
|||
import org.eclipse.jetty.security.authentication.FormAuthenticator;
|
||||
import org.eclipse.jetty.security.authentication.SpnegoAuthenticator;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
|
|
@ -15,13 +15,13 @@ package org.eclipse.jetty.security;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.jetty.http.security.Credential;
|
||||
import org.eclipse.jetty.security.PropertyUserStore.UserListener;
|
||||
import org.eclipse.jetty.server.UserIdentity;
|
||||
import org.eclipse.jetty.util.Scanner;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.util.security.Credential;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
|
|
@ -23,12 +23,12 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.eclipse.jetty.http.security.Credential;
|
||||
import org.eclipse.jetty.server.UserIdentity;
|
||||
import org.eclipse.jetty.util.Loader;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.util.security.Credential;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
|
|
@ -23,11 +23,11 @@ import java.util.concurrent.ConcurrentMap;
|
|||
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
import org.eclipse.jetty.http.security.Credential;
|
||||
import org.eclipse.jetty.server.UserIdentity;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.security.Credential;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.Set;
|
|||
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
import org.eclipse.jetty.http.security.Credential;
|
||||
import org.eclipse.jetty.security.MappedLoginService.KnownUser;
|
||||
import org.eclipse.jetty.security.MappedLoginService.RolePrincipal;
|
||||
import org.eclipse.jetty.server.UserIdentity;
|
||||
|
@ -25,6 +24,7 @@ import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
|||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.util.security.Credential;
|
||||
|
||||
/**
|
||||
* PropertyUserStore
|
||||
|
|
|
@ -19,12 +19,12 @@ import java.util.Properties;
|
|||
|
||||
import javax.security.auth.Subject;
|
||||
|
||||
import org.eclipse.jetty.http.security.B64Code;
|
||||
import org.eclipse.jetty.server.UserIdentity;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.util.security.B64Code;
|
||||
import org.ietf.jgss.GSSContext;
|
||||
import org.ietf.jgss.GSSCredential;
|
||||
import org.ietf.jgss.GSSException;
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.eclipse.jetty.security;
|
|||
|
||||
import java.security.Principal;
|
||||
|
||||
import org.eclipse.jetty.http.security.B64Code;
|
||||
import org.eclipse.jetty.util.security.B64Code;
|
||||
|
||||
public class SpnegoUserPrincipal implements Principal
|
||||
{
|
||||
|
|
|
@ -21,7 +21,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.HttpHeaders;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.security.ServerAuthException;
|
||||
import org.eclipse.jetty.security.UserAuthentication;
|
||||
import org.eclipse.jetty.server.Authentication;
|
||||
|
@ -29,6 +28,7 @@ import org.eclipse.jetty.server.Authentication.User;
|
|||
import org.eclipse.jetty.server.UserIdentity;
|
||||
import org.eclipse.jetty.util.B64Code;
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
|
||||
/**
|
||||
* @version $Rev: 4793 $ $Date: 2009-03-19 00:00:01 +0100 (Thu, 19 Mar 2009) $
|
||||
|
|
|
@ -25,8 +25,6 @@ import javax.servlet.ServletResponse;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.http.security.Password;
|
||||
import org.eclipse.jetty.security.ServerAuthException;
|
||||
import org.eclipse.jetty.security.UserAuthentication;
|
||||
import org.eclipse.jetty.server.Authentication;
|
||||
|
@ -35,6 +33,8 @@ import org.eclipse.jetty.server.UserIdentity;
|
|||
import org.eclipse.jetty.util.B64Code;
|
||||
import org.eclipse.jetty.util.security.CertificateUtils;
|
||||
import org.eclipse.jetty.util.security.CertificateValidator;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.eclipse.jetty.util.security.Password;
|
||||
|
||||
/**
|
||||
* @version $Rev: 4793 $ $Date: 2009-03-19 00:00:01 +0100 (Thu, 19 Mar 2009) $
|
||||
|
|
|
@ -28,8 +28,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.HttpHeaders;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.http.security.Credential;
|
||||
import org.eclipse.jetty.security.SecurityHandler;
|
||||
import org.eclipse.jetty.security.ServerAuthException;
|
||||
import org.eclipse.jetty.security.UserAuthentication;
|
||||
|
@ -43,6 +41,8 @@ import org.eclipse.jetty.util.StringUtil;
|
|||
import org.eclipse.jetty.util.TypeUtil;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.eclipse.jetty.util.security.Credential;
|
||||
|
||||
/**
|
||||
* @version $Rev: 4793 $ $Date: 2009-03-19 00:00:01 +0100 (Thu, 19 Mar 2009) $
|
||||
|
|
|
@ -30,7 +30,6 @@ import javax.servlet.http.HttpSession;
|
|||
import org.eclipse.jetty.http.HttpHeaders;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.http.MimeTypes;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.security.ServerAuthException;
|
||||
import org.eclipse.jetty.security.UserAuthentication;
|
||||
import org.eclipse.jetty.server.Authentication;
|
||||
|
@ -43,6 +42,7 @@ import org.eclipse.jetty.util.StringUtil;
|
|||
import org.eclipse.jetty.util.URIUtil;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
|
||||
/**
|
||||
* FORM Authenticator.
|
||||
|
|
|
@ -23,7 +23,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.HttpHeaders;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.security.ServerAuthException;
|
||||
import org.eclipse.jetty.security.UserAuthentication;
|
||||
import org.eclipse.jetty.server.Authentication;
|
||||
|
@ -31,6 +30,7 @@ import org.eclipse.jetty.server.Authentication.User;
|
|||
import org.eclipse.jetty.server.UserIdentity;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
|
||||
public class SpnegoAuthenticator extends LoginAuthenticator
|
||||
{
|
||||
|
|
|
@ -27,8 +27,6 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.http.security.Password;
|
||||
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
|
||||
import org.eclipse.jetty.security.authentication.FormAuthenticator;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
|
@ -41,6 +39,8 @@ import org.eclipse.jetty.server.handler.ContextHandler;
|
|||
import org.eclipse.jetty.server.handler.HandlerWrapper;
|
||||
import org.eclipse.jetty.server.session.SessionHandler;
|
||||
import org.eclipse.jetty.util.B64Code;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.eclipse.jetty.util.security.Password;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eclipse.jetty.http.security.Credential;
|
||||
import org.eclipse.jetty.util.security.Credential;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -1046,7 +1046,7 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
|
|||
/* ------------------------------------------------------------ */
|
||||
protected void connectionClosed(Connection connection)
|
||||
{
|
||||
connection.closed();
|
||||
connection.onClose();
|
||||
|
||||
if (_statsStartedAt.get() == -1)
|
||||
return;
|
||||
|
|
|
@ -656,7 +656,7 @@ public abstract class AbstractHttpConnection extends AbstractConnection
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void closed()
|
||||
public void onClose()
|
||||
{
|
||||
LOG.debug("closed {}",this);
|
||||
}
|
||||
|
|
|
@ -135,14 +135,14 @@ public interface Connector extends LifeCycle
|
|||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return The port to use when redirecting a request if a data constraint of integral is
|
||||
* required. See {@link org.eclipse.jetty.http.security.Constraint#getDataConstraint()}
|
||||
* required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
|
||||
*/
|
||||
int getIntegralPort();
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return The schema to use when redirecting a request if a data constraint of integral is
|
||||
* required. See {@link org.eclipse.jetty.http.security.Constraint#getDataConstraint()}
|
||||
* required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
|
||||
*/
|
||||
String getIntegralScheme();
|
||||
|
||||
|
@ -156,7 +156,7 @@ public interface Connector extends LifeCycle
|
|||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return The port to use when redirecting a request if a data constraint of confidential is
|
||||
* required. See {@link org.eclipse.jetty.http.security.Constraint#getDataConstraint()}
|
||||
* required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
|
||||
*/
|
||||
int getConfidentialPort();
|
||||
|
||||
|
@ -164,7 +164,7 @@ public interface Connector extends LifeCycle
|
|||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @return The schema to use when redirecting a request if a data constraint of confidential is
|
||||
* required. See {@link org.eclipse.jetty.http.security.Constraint#getDataConstraint()}
|
||||
* required. See {@link org.eclipse.jetty.util.security.Constraint#getDataConstraint()}
|
||||
*/
|
||||
String getConfidentialScheme();
|
||||
|
||||
|
|
|
@ -604,7 +604,7 @@ public class ConnectHandler extends HandlerWrapper
|
|||
return false;
|
||||
}
|
||||
|
||||
public void closed()
|
||||
public void onClose()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,7 @@ public class ConnectHandler extends HandlerWrapper
|
|||
_endPoint.shutdownOutput();
|
||||
}
|
||||
|
||||
public void idleExpired()
|
||||
public void onIdleExpired()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -787,7 +787,7 @@ public class ConnectHandler extends HandlerWrapper
|
|||
return false;
|
||||
}
|
||||
|
||||
public void closed()
|
||||
public void onClose()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -832,7 +832,7 @@ public class ConnectHandler extends HandlerWrapper
|
|||
_endPoint.shutdownOutput();
|
||||
}
|
||||
|
||||
public void idleExpired()
|
||||
public void onIdleExpired()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -9,8 +9,8 @@ import javax.net.ssl.SSLContext;
|
|||
import javax.net.ssl.SSLEngine;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
|
|
@ -24,7 +24,6 @@ import javax.net.ssl.SSLSocket;
|
|||
|
||||
import org.eclipse.jetty.http.HttpParser;
|
||||
import org.eclipse.jetty.http.HttpSchemes;
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.io.Buffers;
|
||||
import org.eclipse.jetty.io.Buffers.Type;
|
||||
import org.eclipse.jetty.io.BuffersFactory;
|
||||
|
@ -37,6 +36,7 @@ import org.eclipse.jetty.io.nio.SslSelectChannelEndPoint;
|
|||
import org.eclipse.jetty.server.AsyncHttpConnection;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.nio.SelectChannelConnector;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,6 @@ import javax.net.ssl.SSLSession;
|
|||
import javax.net.ssl.SSLSocket;
|
||||
|
||||
import org.eclipse.jetty.http.HttpSchemes;
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.io.RuntimeIOException;
|
||||
import org.eclipse.jetty.io.bio.SocketEndPoint;
|
||||
|
@ -34,6 +33,7 @@ import org.eclipse.jetty.server.Request;
|
|||
import org.eclipse.jetty.server.bio.SocketConnector;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
|
|
@ -24,10 +24,10 @@ import javax.servlet.ServletOutputStream;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -44,13 +44,13 @@ import javax.servlet.ServletOutputStream;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -22,10 +22,10 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -21,7 +21,6 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.io.nio.IndirectNIOBuffer;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
|
@ -31,6 +30,7 @@ import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
|||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SslRenegotiateTest
|
||||
|
|
|
@ -20,8 +20,8 @@ import javax.net.ssl.HttpsURLConnection;
|
|||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.HttpServerTestBase;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ import java.security.KeyStore;
|
|||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.ConnectorTimeoutTest;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ import javax.net.ssl.SSLContext;
|
|||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.HttpServerTestBase;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@ import javax.net.ssl.SSLContext;
|
|||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.ConnectorTimeoutTest;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
public class SslSocketTimeoutTest extends ConnectorTimeoutTest
|
||||
|
|
|
@ -18,7 +18,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.HttpParser;
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.io.Connection;
|
||||
import org.eclipse.jetty.io.nio.AsyncConnection;
|
||||
import org.eclipse.jetty.io.nio.SelectChannelEndPoint;
|
||||
|
@ -28,6 +27,7 @@ import org.eclipse.jetty.server.AsyncHttpConnection;
|
|||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
|
|
@ -31,11 +31,11 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.AbstractHandler;
|
||||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// ========================================================================
|
||||
|
||||
|
||||
package org.eclipse.jetty.http.security;
|
||||
package org.eclipse.jetty.util.security;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
|
@ -11,7 +11,7 @@
|
|||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
package org.eclipse.jetty.http.security;
|
||||
package org.eclipse.jetty.util.security;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
|
@ -11,7 +11,7 @@
|
|||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
package org.eclipse.jetty.http.security;
|
||||
package org.eclipse.jetty.util.security;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.security.MessageDigest;
|
|
@ -11,7 +11,7 @@
|
|||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
package org.eclipse.jetty.http.security;
|
||||
package org.eclipse.jetty.util.security;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
|
@ -21,7 +21,7 @@
|
|||
* by Iris Van den Broeke, Daniel Deville
|
||||
*/
|
||||
|
||||
package org.eclipse.jetty.http.security;
|
||||
package org.eclipse.jetty.util.security;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
|
@ -14,7 +14,7 @@
|
|||
//You may elect to redistribute this code under either of these licenses.
|
||||
//========================================================================
|
||||
|
||||
package org.eclipse.jetty.http.ssl;
|
||||
package org.eclipse.jetty.util.ssl;
|
||||
|
||||
import java.net.Socket;
|
||||
import java.security.Principal;
|
|
@ -14,7 +14,7 @@
|
|||
//You may elect to redistribute this code under either of these licenses.
|
||||
//========================================================================
|
||||
|
||||
package org.eclipse.jetty.http.ssl;
|
||||
package org.eclipse.jetty.util.ssl;
|
||||
|
||||
import java.net.Socket;
|
||||
import java.security.Principal;
|
File diff suppressed because it is too large
Load Diff
|
@ -26,7 +26,6 @@ import java.util.Map;
|
|||
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.security.ConstraintAware;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.authentication.FormAuthenticator;
|
||||
|
@ -42,6 +41,7 @@ import org.eclipse.jetty.util.Loader;
|
|||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.eclipse.jetty.xml.XmlParser;
|
||||
|
||||
/**
|
||||
|
|
|
@ -233,7 +233,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle
|
|||
@Override
|
||||
protected void endPointClosed(SelectChannelEndPoint endpoint)
|
||||
{
|
||||
endpoint.getConnection().closed();
|
||||
endpoint.getConnection().onClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -426,7 +426,7 @@ public class WebSocketClientFactory extends AggregateLifeCycle
|
|||
return false;
|
||||
}
|
||||
|
||||
public void closed()
|
||||
public void onClose()
|
||||
{
|
||||
if (_error!=null)
|
||||
_future.handshakeFailed(new ProtocolException(_error));
|
||||
|
|
|
@ -239,7 +239,7 @@ public class WebSocketConnectionD00 extends AbstractConnection implements WebSoc
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void closed()
|
||||
public void onClose()
|
||||
{
|
||||
_websocket.onClose(WebSocketConnectionD06.CLOSE_NORMAL,"");
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void idleExpired()
|
||||
public void onIdleExpired()
|
||||
{
|
||||
closeOut(WebSocketConnectionD06.CLOSE_NORMAL,"Idle");
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ public class WebSocketConnectionD06 extends AbstractConnection implements WebSoc
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void closed()
|
||||
public void onClose()
|
||||
{
|
||||
_webSocket.onClose(WebSocketConnectionD06.CLOSE_NORMAL,"");
|
||||
}
|
||||
|
|
|
@ -272,7 +272,7 @@ public class WebSocketConnectionD08 extends AbstractConnection implements WebSoc
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void idleExpired()
|
||||
public void onIdleExpired()
|
||||
{
|
||||
long idle = System.currentTimeMillis()-((SelectChannelEndPoint)_endp).getIdleTimestamp();
|
||||
closeOut(WebSocketConnectionD08.CLOSE_NORMAL,"Idle for "+idle+"ms > "+_endp.getMaxIdleTime()+"ms");
|
||||
|
@ -285,7 +285,7 @@ public class WebSocketConnectionD08 extends AbstractConnection implements WebSoc
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void closed()
|
||||
public void onClose()
|
||||
{
|
||||
final boolean closed;
|
||||
synchronized (this)
|
||||
|
|
|
@ -297,7 +297,7 @@ public class WebSocketConnectionD13 extends AbstractConnection implements WebSoc
|
|||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public void idleExpired()
|
||||
public void onIdleExpired()
|
||||
{
|
||||
long idle = System.currentTimeMillis()-((SelectChannelEndPoint)_endp).getIdleTimestamp();
|
||||
closeOut(WebSocketConnectionD13.CLOSE_NORMAL,"Idle for "+idle+"ms > "+_endp.getMaxIdleTime()+"ms");
|
||||
|
@ -310,7 +310,7 @@ public class WebSocketConnectionD13 extends AbstractConnection implements WebSoc
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void closed()
|
||||
public void onClose()
|
||||
{
|
||||
final boolean closed;
|
||||
synchronized (this)
|
||||
|
|
|
@ -16,8 +16,6 @@ import org.eclipse.jetty.client.HttpClient;
|
|||
import org.eclipse.jetty.client.security.Realm;
|
||||
import org.eclipse.jetty.client.security.SimpleRealmResolver;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.http.security.Constraint;
|
||||
import org.eclipse.jetty.http.security.Password;
|
||||
import org.eclipse.jetty.io.ByteArrayBuffer;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
|
@ -33,6 +31,8 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
|
|||
import org.eclipse.jetty.util.IO;
|
||||
import org.eclipse.jetty.util.StringUtil;
|
||||
import org.eclipse.jetty.util.TypeUtil;
|
||||
import org.eclipse.jetty.util.security.Constraint;
|
||||
import org.eclipse.jetty.util.security.Password;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
|
|
Loading…
Reference in New Issue