302198 Rename HttpClient authorization classes to Authentication
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1249 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
0cd68330e8
commit
72b546abe6
|
@ -9,6 +9,7 @@ jetty-7.0.2-SNAPSHOT
|
||||||
+ 298234 Unit test for jetty-client handling different HTTP error codes
|
+ 298234 Unit test for jetty-client handling different HTTP error codes
|
||||||
+ 298667 DeploymentManager uses ContextProvider and WebAppProvider
|
+ 298667 DeploymentManager uses ContextProvider and WebAppProvider
|
||||||
+ 299455 Enum support in JSONPojoConvertor
|
+ 299455 Enum support in JSONPojoConvertor
|
||||||
|
+ 302198 Rename HttpClient authorization classes to Authentication
|
||||||
+ JETTY-776 Make new session-tests module to concentrate all reusable session clustering test code
|
+ JETTY-776 Make new session-tests module to concentrate all reusable session clustering test code
|
||||||
+ JETTY-910 Allow request listeners to access session
|
+ JETTY-910 Allow request listeners to access session
|
||||||
+ JETTY-1153 System property for UrlEncoded charset
|
+ JETTY-1153 System property for UrlEncoded charset
|
||||||
|
|
|
@ -34,7 +34,7 @@ import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.TrustManagerFactory;
|
import javax.net.ssl.TrustManagerFactory;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
import org.eclipse.jetty.client.security.Authorization;
|
import org.eclipse.jetty.client.security.Authentication;
|
||||||
import org.eclipse.jetty.client.security.RealmResolver;
|
import org.eclipse.jetty.client.security.RealmResolver;
|
||||||
import org.eclipse.jetty.http.HttpBuffers;
|
import org.eclipse.jetty.http.HttpBuffers;
|
||||||
import org.eclipse.jetty.http.HttpSchemes;
|
import org.eclipse.jetty.http.HttpSchemes;
|
||||||
|
@ -97,7 +97,7 @@ public class HttpClient extends HttpBuffers implements Attributes
|
||||||
private Timeout _timeoutQ = new Timeout();
|
private Timeout _timeoutQ = new Timeout();
|
||||||
private Timeout _idleTimeoutQ = new Timeout();
|
private Timeout _idleTimeoutQ = new Timeout();
|
||||||
private Address _proxy;
|
private Address _proxy;
|
||||||
private Authorization _proxyAuthentication;
|
private Authentication _proxyAuthentication;
|
||||||
private Set<String> _noProxy;
|
private Set<String> _noProxy;
|
||||||
private int _maxRetries = 3;
|
private int _maxRetries = 3;
|
||||||
private int _maxRedirects = 20;
|
private int _maxRedirects = 20;
|
||||||
|
@ -714,13 +714,13 @@ public class HttpClient extends HttpBuffers implements Attributes
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public Authorization getProxyAuthentication()
|
public Authentication getProxyAuthentication()
|
||||||
{
|
{
|
||||||
return _proxyAuthentication;
|
return _proxyAuthentication;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
public void setProxyAuthentication(Authorization authentication)
|
public void setProxyAuthentication(Authentication authentication)
|
||||||
{
|
{
|
||||||
_proxyAuthentication = authentication;
|
_proxyAuthentication = authentication;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import java.io.InputStream;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import org.eclipse.jetty.client.security.Authorization;
|
import org.eclipse.jetty.client.security.Authentication;
|
||||||
import org.eclipse.jetty.http.HttpFields;
|
import org.eclipse.jetty.http.HttpFields;
|
||||||
import org.eclipse.jetty.http.HttpGenerator;
|
import org.eclipse.jetty.http.HttpGenerator;
|
||||||
import org.eclipse.jetty.http.HttpHeaderValues;
|
import org.eclipse.jetty.http.HttpHeaderValues;
|
||||||
|
@ -402,7 +402,7 @@ public class HttpConnection implements Connection
|
||||||
// TODO suppress port 80 or 443
|
// TODO suppress port 80 or 443
|
||||||
uri = (_destination.isSecure()?HttpSchemes.HTTPS:HttpSchemes.HTTP) + "://" + _destination.getAddress().getHost() + ":"
|
uri = (_destination.isSecure()?HttpSchemes.HTTPS:HttpSchemes.HTTP) + "://" + _destination.getAddress().getHost() + ":"
|
||||||
+ _destination.getAddress().getPort() + uri;
|
+ _destination.getAddress().getPort() + uri;
|
||||||
Authorization auth = _destination.getProxyAuthentication();
|
Authentication auth = _destination.getProxyAuthentication();
|
||||||
if (auth != null)
|
if (auth != null)
|
||||||
auth.setCredentials(_exchange);
|
auth.setCredentials(_exchange);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
|
|
||||||
import org.eclipse.jetty.client.security.Authorization;
|
import org.eclipse.jetty.client.security.Authentication;
|
||||||
import org.eclipse.jetty.client.security.SecurityListener;
|
import org.eclipse.jetty.client.security.SecurityListener;
|
||||||
import org.eclipse.jetty.http.HttpCookie;
|
import org.eclipse.jetty.http.HttpCookie;
|
||||||
import org.eclipse.jetty.http.HttpHeaders;
|
import org.eclipse.jetty.http.HttpHeaders;
|
||||||
|
@ -46,7 +46,7 @@ public class HttpDestination
|
||||||
private ArrayBlockingQueue<Object> _newQueue = new ArrayBlockingQueue<Object>(10, true);
|
private ArrayBlockingQueue<Object> _newQueue = new ArrayBlockingQueue<Object>(10, true);
|
||||||
private int _newConnection = 0;
|
private int _newConnection = 0;
|
||||||
private Address _proxy;
|
private Address _proxy;
|
||||||
private Authorization _proxyAuthentication;
|
private Authentication _proxyAuthentication;
|
||||||
private PathMap _authorizations;
|
private PathMap _authorizations;
|
||||||
private List<HttpCookie> _cookies;
|
private List<HttpCookie> _cookies;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ public class HttpDestination
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addAuthorization(String pathSpec, Authorization authorization)
|
public void addAuthorization(String pathSpec, Authentication authorization)
|
||||||
{
|
{
|
||||||
synchronized (this)
|
synchronized (this)
|
||||||
{
|
{
|
||||||
|
@ -472,7 +472,7 @@ public class HttpDestination
|
||||||
// Add any known authorizations
|
// Add any known authorizations
|
||||||
if (_authorizations != null)
|
if (_authorizations != null)
|
||||||
{
|
{
|
||||||
Authorization auth = (Authorization)_authorizations.match(ex.getURI());
|
Authentication auth = (Authentication)_authorizations.match(ex.getURI());
|
||||||
if (auth != null)
|
if (auth != null)
|
||||||
(auth).setCredentials(ex);
|
(auth).setCredentials(ex);
|
||||||
}
|
}
|
||||||
|
@ -534,12 +534,12 @@ public class HttpDestination
|
||||||
return _proxy;
|
return _proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Authorization getProxyAuthentication()
|
public Authentication getProxyAuthentication()
|
||||||
{
|
{
|
||||||
return _proxyAuthentication;
|
return _proxyAuthentication;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProxyAuthentication(Authorization authentication)
|
public void setProxyAuthentication(Authentication authentication)
|
||||||
{
|
{
|
||||||
_proxyAuthentication = authentication;
|
_proxyAuthentication = authentication;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.jetty.client.HttpExchange;
|
||||||
/**
|
/**
|
||||||
* Simple authentication interface that sets required fields on the exchange.
|
* Simple authentication interface that sets required fields on the exchange.
|
||||||
*/
|
*/
|
||||||
public interface Authorization
|
public interface Authentication
|
||||||
{
|
{
|
||||||
public void setCredentials( HttpExchange exchange) throws IOException;
|
public void setCredentials( HttpExchange exchange) throws IOException;
|
||||||
}
|
}
|
|
@ -28,11 +28,11 @@ import org.eclipse.jetty.util.StringUtil;
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class BasicAuthorization implements Authorization
|
public class BasicAuthentication implements Authentication
|
||||||
{
|
{
|
||||||
private Buffer _authorization;
|
private Buffer _authorization;
|
||||||
|
|
||||||
public BasicAuthorization(Realm realm) throws IOException
|
public BasicAuthentication(Realm realm) throws IOException
|
||||||
{
|
{
|
||||||
String authenticationString = "Basic " + B64Code.encode( realm.getPrincipal() + ":" + realm.getCredentials(), StringUtil.__ISO_8859_1);
|
String authenticationString = "Basic " + B64Code.encode( realm.getPrincipal() + ":" + realm.getCredentials(), StringUtil.__ISO_8859_1);
|
||||||
_authorization= new ByteArrayBuffer(authenticationString);
|
_authorization= new ByteArrayBuffer(authenticationString);
|
|
@ -23,13 +23,13 @@ import org.eclipse.jetty.http.HttpHeaders;
|
||||||
import org.eclipse.jetty.util.StringUtil;
|
import org.eclipse.jetty.util.StringUtil;
|
||||||
import org.eclipse.jetty.util.TypeUtil;
|
import org.eclipse.jetty.util.TypeUtil;
|
||||||
|
|
||||||
public class DigestAuthorization implements Authorization
|
public class DigestAuthentication implements Authentication
|
||||||
{
|
{
|
||||||
private static final String NC = "00000001";
|
private static final String NC = "00000001";
|
||||||
Realm securityRealm;
|
Realm securityRealm;
|
||||||
Map details;
|
Map details;
|
||||||
|
|
||||||
public DigestAuthorization(Realm realm, Map details)
|
public DigestAuthentication(Realm realm, Map details)
|
||||||
{
|
{
|
||||||
this.securityRealm=realm;
|
this.securityRealm=realm;
|
||||||
this.details=details;
|
this.details=details;
|
|
@ -28,7 +28,7 @@ import org.eclipse.jetty.util.StringUtil;
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyAuthorization implements Authorization
|
public class ProxyAuthorization implements Authentication
|
||||||
{
|
{
|
||||||
private Buffer _authorization;
|
private Buffer _authorization;
|
||||||
|
|
||||||
|
|
|
@ -172,12 +172,12 @@ public class SecurityListener extends HttpEventListenerWrapper
|
||||||
}
|
}
|
||||||
else if ("digest".equalsIgnoreCase(type))
|
else if ("digest".equalsIgnoreCase(type))
|
||||||
{
|
{
|
||||||
_destination.addAuthorization("/",new DigestAuthorization(realm,details));
|
_destination.addAuthorization("/",new DigestAuthentication(realm,details));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ("basic".equalsIgnoreCase(type))
|
else if ("basic".equalsIgnoreCase(type))
|
||||||
{
|
{
|
||||||
_destination.addAuthorization(pathSpec,new BasicAuthorization(realm));
|
_destination.addAuthorization(pathSpec,new BasicAuthentication(realm));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue