Class PrincipalScopedPartitionKey
- java.lang.Object
-
- org.asynchttpclient.netty.channel.PrincipalScopedPartitionKey
-
public final class PrincipalScopedPartitionKey extends Object
Channel-pool partition key for schemes that authenticate the connection rather than the request.NTLM and Negotiate complete a handshake once and the server then treats every later request arriving on that socket as coming from the identity that authenticated it. The regular partition key describes only where the connection goes, so a socket one principal authenticated could be handed to a request belonging to another, and the server would serve it as the first principal. Nothing on the wire shows the identity changed, because the second request carries no authentication headers of its own.
Folding that identity into the key keeps those connections separated. Basic and Digest need no such thing: they authenticate each request and their credentials travel with it.
If a site that offers a connection to the pool and a site that polls for one ever disagree about whether to scope, the poll simply misses and a new connection is opened. That costs reuse, never correctness, which is the right way round for this to fail.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleananyHopAuthenticatesTheConnection(NettyResponseFuture<?> future)static booleanauthenticatesTheConnection(@Nullable Realm realm)Whether the scheme authenticates the connection rather than the request.static booleanauthenticatesTheConnection(@Nullable Realm realm, @Nullable Realm proxyRealm, boolean proxyHopIsPerConnection)Either hop, since a CONNECT tunnel is one socket.booleanequals(Object o)inthashCode()static booleanproxyHopIsPerConnection(@Nullable ProxyServer proxy, Uri uri)Whether the proxy authenticates the connection itself, whatever the scheme: a SOCKS login does, and so does the CONNECT that opens a tunnel, since the proxy sees no request after it.static @Nullable RealmproxyLogin(@Nullable Realm proxyRealm, @Nullable ProxyServer proxy)The login a proxy hop runs as.static Objectscope(Object baseKey, @Nullable Realm realm, @Nullable Realm proxyRealm, boolean proxyHopIsPerConnection)Asscope(Object, Realm), but also keyed by the identity that authenticated the connection to a proxy: a tunnel is one socket, so it belongs to both.static Objectscope(Object baseKey, Realm realm)WrapsbaseKeywith the authenticated identity whenrealmuses a scheme that authenticates the connection, and returnsbaseKeyunchanged otherwise.static Objectscope(NettyResponseFuture<?> future)The pool key for the connection an exchange ran on.StringtoString()
-
-
-
Method Detail
-
scope
public static Object scope(Object baseKey, Realm realm)
WrapsbaseKeywith the authenticated identity whenrealmuses a scheme that authenticates the connection, and returnsbaseKeyunchanged otherwise. Every site that derives a pool key must apply this the same way.
-
scope
public static Object scope(NettyResponseFuture<?> future)
The pool key for the connection an exchange ran on.
-
proxyLogin
@Nullable public static @Nullable Realm proxyLogin(@Nullable @Nullable Realm proxyRealm, @Nullable @Nullable ProxyServer proxy)
The login a proxy hop runs as. A SOCKS handshake always sends the proxy's own realm, even after a cross-origin redirect has cleared the future's.
-
scope
public static Object scope(Object baseKey, @Nullable @Nullable Realm realm, @Nullable @Nullable Realm proxyRealm, boolean proxyHopIsPerConnection)
Asscope(Object, Realm), but also keyed by the identity that authenticated the connection to a proxy: a tunnel is one socket, so it belongs to both.
-
authenticatesTheConnection
public static boolean authenticatesTheConnection(@Nullable @Nullable Realm realm)Whether the scheme authenticates the connection rather than the request. It needs no principal: an ambient Kerberos login carries none and still binds the socket.
-
anyHopAuthenticatesTheConnection
public static boolean anyHopAuthenticatesTheConnection(NettyResponseFuture<?> future)
-
authenticatesTheConnection
public static boolean authenticatesTheConnection(@Nullable @Nullable Realm realm, @Nullable @Nullable Realm proxyRealm, boolean proxyHopIsPerConnection)Either hop, since a CONNECT tunnel is one socket.
-
proxyHopIsPerConnection
public static boolean proxyHopIsPerConnection(@Nullable @Nullable ProxyServer proxy, Uri uri)Whether the proxy authenticates the connection itself, whatever the scheme: a SOCKS login does, and so does the CONNECT that opens a tunnel, since the proxy sees no request after it. Plain HTTP through an HTTP proxy sends its credentials with every request instead.
-
-