Commit 539e6293 by Edward Thomson

http: teach auth mechanisms about connection affinity

Instead of using `is_complete` to decide whether we have connection or
request affinity for authentication mechanisms, set a boolean on the
mechanism definition itself.
parent 3e0b4b43
......@@ -48,6 +48,7 @@ on_error:
static git_http_auth_context basic_context = {
GIT_AUTHTYPE_BASIC,
GIT_CREDTYPE_USERPASS_PLAINTEXT,
0,
NULL,
basic_next_token,
NULL,
......
......@@ -28,6 +28,9 @@ struct git_http_auth_context {
/** Supported credentials */
git_credtype_t credtypes;
/** Connection affinity or request affinity */
unsigned connection_affinity : 1;
/** Sets the challenge on the authentication context */
int (*set_challenge)(git_http_auth_context *ctx, const char *challenge);
......
......@@ -271,6 +271,7 @@ int git_http_auth_negotiate(
ctx->parent.type = GIT_AUTHTYPE_NEGOTIATE;
ctx->parent.credtypes = GIT_CREDTYPE_DEFAULT;
ctx->parent.connection_affinity = 1;
ctx->parent.set_challenge = negotiate_set_challenge;
ctx->parent.next_token = negotiate_next_token;
ctx->parent.is_complete = negotiate_is_complete;
......
......@@ -208,6 +208,7 @@ int git_http_auth_ntlm(
ctx->parent.type = GIT_AUTHTYPE_NTLM;
ctx->parent.credtypes = GIT_CREDTYPE_USERPASS_PLAINTEXT;
ctx->parent.connection_affinity = 1;
ctx->parent.set_challenge = ntlm_set_challenge;
ctx->parent.next_token = ntlm_next_token;
ctx->parent.is_complete = ntlm_is_complete;
......
......@@ -1014,7 +1014,7 @@ static void reset_auth_connection(http_server *server)
if (server->authenticated &&
server->auth_context &&
server->auth_context->is_complete) {
server->auth_context->connection_affinity) {
free_auth_context(server);
server->url_cred_presented = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment