diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs
index 15d6462e0..aca1ae144 100644
--- a/LibGit2Sharp/Core/NativeMethods.cs
+++ b/LibGit2Sharp/Core/NativeMethods.cs
@@ -96,6 +96,7 @@ private static IntPtr ResolveDll(string libraryName, Assembly assembly, DllImpor
{
Trace.TraceInformation("Using git with schannel");
libraryName = libraryName + "_schannel";
+ GlobalSettings.SetHttpBackend(HttpsBackend.Schannel);
}
// Use GlobalSettings.NativeLibraryPath when set.
diff --git a/LibGit2Sharp/GlobalSettings.cs b/LibGit2Sharp/GlobalSettings.cs
index 06b2e6773..52e2b128f 100644
--- a/LibGit2Sharp/GlobalSettings.cs
+++ b/LibGit2Sharp/GlobalSettings.cs
@@ -21,6 +21,7 @@ public static class GlobalSettings
private static string nativeLibraryPath;
private static bool nativeLibraryPathLocked;
private static readonly string nativeLibraryDefaultPath = null;
+ private static HttpsBackend httpsBackend = HttpsBackend.WinHttp;
static GlobalSettings()
{
@@ -420,5 +421,43 @@ public static string GetUserAgent()
{
return Proxy.git_libgit2_opts_get_user_agent();
}
+
+ ///
+ /// Check libgit supported features
+ ///
+ public static bool HasFeature(LibGitFeature feature)
+ {
+ return feature switch
+ {
+ LibGitFeature.DefaultCredentials => httpsBackend == HttpsBackend.WinHttp,
+ _ => false
+ };
+ }
+
+ internal static void SetHttpBackend(HttpsBackend backend)
+ {
+ httpsBackend = backend;
+ }
+ }
+
+ ///
+ /// List of supported libgit features
+ ///
+ public enum LibGitFeature
+ {
+ ///
+ /// Not used
+ ///
+ None,
+ ///
+ /// When supported, returning 'null' from the credentials manager acts as fallback attempt like using Windows authentication for WinHttp transport
+ ///
+ DefaultCredentials
+ }
+
+ internal enum HttpsBackend
+ {
+ WinHttp,
+ Schannel
}
}