Blame src/transports/auth.h

Packit ae9e2a
/*
Packit ae9e2a
 * Copyright (C) the libgit2 contributors. All rights reserved.
Packit ae9e2a
 *
Packit ae9e2a
 * This file is part of libgit2, distributed under the GNU GPL v2 with
Packit ae9e2a
 * a Linking Exception. For full terms see the included COPYING file.
Packit ae9e2a
 */
Packit ae9e2a
Packit ae9e2a
#ifndef INCLUDE_http_auth_h__
Packit ae9e2a
#define INCLUDE_http_auth_h__
Packit ae9e2a
Packit ae9e2a
#include "git2.h"
Packit ae9e2a
#include "netops.h"
Packit ae9e2a
Packit ae9e2a
typedef enum {
Packit ae9e2a
	GIT_AUTHTYPE_BASIC = 1,
Packit ae9e2a
	GIT_AUTHTYPE_NEGOTIATE = 2,
Packit ae9e2a
} git_http_authtype_t;
Packit ae9e2a
Packit ae9e2a
typedef struct git_http_auth_context git_http_auth_context;
Packit ae9e2a
Packit ae9e2a
struct git_http_auth_context {
Packit ae9e2a
	/** Type of scheme */
Packit ae9e2a
	git_http_authtype_t type;
Packit ae9e2a
Packit ae9e2a
	/** Supported credentials */
Packit ae9e2a
	git_credtype_t credtypes;
Packit ae9e2a
Packit ae9e2a
	/** Sets the challenge on the authentication context */
Packit ae9e2a
	int (*set_challenge)(git_http_auth_context *ctx, const char *challenge);
Packit ae9e2a
Packit ae9e2a
	/** Gets the next authentication token from the context */
Packit ae9e2a
	int (*next_token)(git_buf *out, git_http_auth_context *ctx, git_cred *cred);
Packit ae9e2a
Packit ae9e2a
	/** Frees the authentication context */
Packit ae9e2a
	void (*free)(git_http_auth_context *ctx);
Packit ae9e2a
};
Packit ae9e2a
Packit ae9e2a
typedef struct {
Packit ae9e2a
	/** Type of scheme */
Packit ae9e2a
	git_http_authtype_t type;
Packit ae9e2a
Packit ae9e2a
	/** Name of the scheme (as used in the Authorization header) */
Packit ae9e2a
	const char *name;
Packit ae9e2a
Packit ae9e2a
	/** Credential types this scheme supports */
Packit ae9e2a
	git_credtype_t credtypes;
Packit ae9e2a
Packit ae9e2a
	/** Function to initialize an authentication context */
Packit ae9e2a
	int (*init_context)(
Packit ae9e2a
		git_http_auth_context **out,
Packit ae9e2a
		const gitno_connection_data *connection_data);
Packit ae9e2a
} git_http_auth_scheme;
Packit ae9e2a
Packit ae9e2a
int git_http_auth_dummy(
Packit ae9e2a
	git_http_auth_context **out,
Packit ae9e2a
	const gitno_connection_data *connection_data);
Packit ae9e2a
Packit ae9e2a
int git_http_auth_basic(
Packit ae9e2a
	git_http_auth_context **out,
Packit ae9e2a
	const gitno_connection_data *connection_data);
Packit ae9e2a
Packit ae9e2a
#endif
Packit ae9e2a