]> git.proxmox.com Git - libgit2.git/blame - src/libgit2/transports/auth.h
Merge https://salsa.debian.org/debian/libgit2 into proxmox/bullseye
[libgit2.git] / src / libgit2 / transports / auth.h
CommitLineData
23135afa
ET
1/*
2 * Copyright (C) the libgit2 contributors. All rights reserved.
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7
eae0bfdc
PP
8#ifndef INCLUDE_transports_auth_h__
9#define INCLUDE_transports_auth_h__
10
11#include "common.h"
23135afa 12
23135afa
ET
13#include "netops.h"
14
15typedef enum {
22a2d3d5
UG
16 GIT_HTTP_AUTH_BASIC = 1,
17 GIT_HTTP_AUTH_NEGOTIATE = 2,
e579e0f7 18 GIT_HTTP_AUTH_NTLM = 4
22a2d3d5 19} git_http_auth_t;
23135afa
ET
20
21typedef struct git_http_auth_context git_http_auth_context;
22
23struct git_http_auth_context {
24 /** Type of scheme */
22a2d3d5 25 git_http_auth_t type;
23135afa
ET
26
27 /** Supported credentials */
22a2d3d5
UG
28 git_credential_t credtypes;
29
30 /** Connection affinity or request affinity */
31 unsigned connection_affinity : 1;
23135afa
ET
32
33 /** Sets the challenge on the authentication context */
34 int (*set_challenge)(git_http_auth_context *ctx, const char *challenge);
35
36 /** Gets the next authentication token from the context */
e579e0f7 37 int (*next_token)(git_str *out, git_http_auth_context *ctx, git_credential *cred);
22a2d3d5
UG
38
39 /** Examines if all tokens have been presented. */
40 int (*is_complete)(git_http_auth_context *ctx);
23135afa
ET
41
42 /** Frees the authentication context */
43 void (*free)(git_http_auth_context *ctx);
44};
45
46typedef struct {
47 /** Type of scheme */
22a2d3d5 48 git_http_auth_t type;
23135afa
ET
49
50 /** Name of the scheme (as used in the Authorization header) */
51 const char *name;
52
53 /** Credential types this scheme supports */
22a2d3d5 54 git_credential_t credtypes;
23135afa
ET
55
56 /** Function to initialize an authentication context */
57 int (*init_context)(
58 git_http_auth_context **out,
22a2d3d5 59 const git_net_url *url);
23135afa
ET
60} git_http_auth_scheme;
61
62int git_http_auth_dummy(
63 git_http_auth_context **out,
22a2d3d5 64 const git_net_url *url);
23135afa
ET
65
66int git_http_auth_basic(
67 git_http_auth_context **out,
22a2d3d5 68 const git_net_url *url);
23135afa
ET
69
70#endif