Class 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 the principal 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 Detail

      • scope

        public static Object scope​(Object baseKey,
                                   Realm realm)
        Wraps baseKey with the authenticated identity when realm uses a scheme that authenticates the connection, and returns baseKey unchanged otherwise. Every site that derives a pool key must apply this the same way.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object