 
 (def ^Base64 base64 (Base64.))
 
-(defn spnego-authentication
-  "Returns an Authentication$Result for endpoint which will use SPNEGO to generate an Authorization header"
-  [^URI endpoint]
+(defn create-spnego-authentication-result-factory
+  "Returns an Authentication$Result for an endpoint which will use SPNEGO to generate the header value for the
+  provided authorization header field."
+  [^URI endpoint auth-header-field]
   (reify Authentication$Result
     (getURI [_] endpoint)
 

              _ (.requestMutualAuth gss-context true)
              token (.initSecContext gss-context (make-array Byte/TYPE 0) 0 0)
              header (str "Negotiate " (String. (.encode base64 token)))]
          (.header request HttpHeader/AUTHORIZATION header))
        (catch Exception e
          (log/warn e "failure during spnego authentication"))))))

(defn status-2XX?
  "Returns true if the status is in the range [200, 299]."

  (:import (java.net URI)
           (java.util ArrayList)
           (org.apache.commons.codec.binary Base64)
           (org.eclipse.jetty.client HttpClient HttpProxy ProxyConfiguration WWWAuthenticationProtocolHandler)
           (org.eclipse.jetty.client.api Authentication$Result Request)
           (org.eclipse.jetty.http HttpField HttpHeader)
           (org.eclipse.jetty.http2.client HTTP2Client)
