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 #ifndef INCLUDE_git_cred_helpers_h__ 8 #define INCLUDE_git_cred_helpers_h__ 9 10 #include "transport.h" 11 12 /** 13 * @file git2/cred_helpers.h 14 * @brief Utility functions for credential management 15 * @defgroup git_cred_helpers credential management helpers 16 * @ingroup Git 17 * @{ 18 */ 19 GIT_BEGIN_DECL 20 21 /** 22 * Payload for git_cred_stock_userpass_plaintext. 23 */ 24 typedef struct git_cred_userpass_payload { 25 const char *username; 26 const char *password; 27 } git_cred_userpass_payload; 28 29 30 /** 31 * Stock callback usable as a git_cred_acquire_cb. This calls 32 * git_cred_userpass_plaintext_new unless the protocol has not specified 33 * `GIT_CREDTYPE_USERPASS_PLAINTEXT` as an allowed type. 34 * 35 * @param cred The newly created credential object. 36 * @param url The resource for which we are demanding a credential. 37 * @param user_from_url The username that was embedded in a "user\@host" 38 * remote url, or NULL if not included. 39 * @param allowed_types A bitmask stating which cred types are OK to return. 40 * @param payload The payload provided when specifying this callback. (This is 41 * interpreted as a `git_cred_userpass_payload*`.) 42 */ 43 GIT_EXTERN(int) git_cred_userpass( 44 git_cred **cred, 45 const char *url, 46 const char *user_from_url, 47 unsigned int allowed_types, 48 void *payload); 49 50 51 /** @} */ 52 GIT_END_DECL 53 #endif 54