diff options
author | Edward Thomson <ethomson@microsoft.com> | 2014-03-26 02:46:13 +0400 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2014-04-09 18:50:50 +0400 |
commit | aa94e9d9326e9318feb89e8c9f4300b0bf60f6ca (patch) | |
tree | 48e4c000c11511dd27b0c64dddf225584cb32daf /LibGit2Sharp/Credentials.cs | |
parent | 35e6cbe7870cd25d3108b265aaaf816b8f5eee30 (diff) |
Introduce default credentials
Abstract Credentials, providing UsernamePasswordCredentials
and DefaultCredentials.
Diffstat (limited to 'LibGit2Sharp/Credentials.cs')
-rw-r--r-- | LibGit2Sharp/Credentials.cs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/LibGit2Sharp/Credentials.cs b/LibGit2Sharp/Credentials.cs index e3ce915c..b5540705 100644 --- a/LibGit2Sharp/Credentials.cs +++ b/LibGit2Sharp/Credentials.cs @@ -1,18 +1,22 @@ -namespace LibGit2Sharp +using System; +using LibGit2Sharp.Core; + +namespace LibGit2Sharp { /// <summary> /// Class that holds credentials for remote repository access. /// </summary> - public sealed class Credentials + public abstract class Credentials { /// <summary> - /// Username for username/password authentication (as in HTTP basic auth). - /// </summary> - public string Username { get; set; } - - /// <summary> - /// Password for username/password authentication (as in HTTP basic auth). + /// Callback to acquire a credential object. /// </summary> - public string Password { get; set; } + /// <param name="cred">The newly created credential object.</param> + /// <param name="url">The resource for which we are demanding a credential.</param> + /// <param name="usernameFromUrl">The username that was embedded in a "user@host"</param> + /// <param name="types">A bitmask stating which cred types are OK to return.</param> + /// <param name="payload">The payload provided when specifying this callback.</param> + /// <returns>0 for success, < 0 to indicate an error, > 0 to indicate no credential was acquired.</returns> + protected internal abstract int GitCredentialHandler(out IntPtr cred, IntPtr url, IntPtr usernameFromUrl, GitCredentialType types, IntPtr payload); } } |