Blame src/transports/auth.h

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