diff options
| author | Vicent Martà <vicent@github.com> | 2013-01-10 11:24:09 -0800 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2013-01-10 11:24:09 -0800 |
| commit | 404880b1bac746f15ca73bb57a5c034df6c6b630 (patch) | |
| tree | 43adb6f633c41132fd97a6ce5bf2184855644da4 /include/git2 | |
| parent | 48de3061d16f2d9a55a1e3fc6253cab35a64018b (diff) | |
| parent | 520dcc1c000c7c29058d6ae56982461e782210fe (diff) | |
| download | libgit2-404880b1bac746f15ca73bb57a5c034df6c6b630.tar.gz | |
Merge pull request #1206 from ben/stock-auth
Expose stock user/pass credential utility
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/cred_helpers.h | 50 | ||||
| -rw-r--r-- | include/git2/transport.h | 1 |
2 files changed, 51 insertions, 0 deletions
diff --git a/include/git2/cred_helpers.h b/include/git2/cred_helpers.h new file mode 100644 index 000000000..7c213c8dd --- /dev/null +++ b/include/git2/cred_helpers.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_git_cred_helpers_h__ +#define INCLUDE_git_cred_helpers_h__ + +#include "git2/transport.h" + +/** + * @file git2/cred_helpers.h + * @brief Utility functions for credential management + * @defgroup git_cred_helpers credential management helpers + * @ingroup Git + * @{ + */ +GIT_BEGIN_DECL + +/** + * Payload for git_cred_stock_userpass_plaintext. + */ +typedef struct git_cred_userpass_payload { + char *username; + char *password; +} git_cred_userpass_payload; + + +/** + * Stock callback usable as a git_cred_acquire_cb. This calls + * git_cred_userpass_plaintext_new unless the protocol has not specified + * GIT_CREDTYPE_USERPASS_PLAINTEXT as an allowed type. + * + * @param cred The newly created credential object. + * @param url The resource for which we are demanding a credential. + * @param allowed_types A bitmask stating which cred types are OK to return. + * @param payload The payload provided when specifying this callback. (This is + * interpreted as a `git_cred_userpass_payload*`.) + */ +GIT_EXTERN(int) git_cred_userpass( + git_cred **cred, + const char *url, + unsigned int allowed_types, + void *payload); + + +/** @} */ +GIT_END_DECL +#endif diff --git a/include/git2/transport.h b/include/git2/transport.h index fba5fb920..1aa87cabe 100644 --- a/include/git2/transport.h +++ b/include/git2/transport.h @@ -61,6 +61,7 @@ GIT_EXTERN(int) git_cred_userpass_plaintext_new( * @param cred The newly created credential object. * @param url The resource for which we are demanding a credential. * @param allowed_types A bitmask stating which cred types are OK to return. + * @param payload The payload provided when specifying this callback. */ typedef int (*git_cred_acquire_cb)( git_cred **cred, |
