使用SharpSVN进行SVN存储库验证

Ami*_*ara 27 svn authentication sharpsvn

任何人都可以告诉我如何使用SharpSVN Library对存储库的用户(SVN用户)进行身份验证.该存储库只应由这些用户提交.谢谢

Jér*_*and 47

使用以下身份验证属性SVNClient:

client.Authentication.Clear(); // Clear a previous authentication
client.Authentication.DefaultCredentials = new System.Net.NetworkCredential("user", "password");
Run Code Online (Sandbox Code Playgroud)


Gra*_*ted 14

client.Authentication.ForceCredentials("user", "password");
Run Code Online (Sandbox Code Playgroud)

对于那些不想吹走你的默认凭证的人(如果你在同一台机器上运行TortoiseSVN).


joc*_*ull 10

您还可以通过添加如下所示的事件处理程序来覆盖SSL证书错误SslServerTrustHandlers:

SVN_Conn.Authentication.SslServerTrustHandlers += new EventHandler<SharpSvn.Security.SvnSslServerTrustEventArgs>(SVN_SSL_Override);

static void SVN_SSL_Override(object sender, SharpSvn.Security.SvnSslServerTrustEventArgs e)
{
    e.AcceptedFailures = e.Failures;
    e.Save = true;
}
Run Code Online (Sandbox Code Playgroud)

  • 只是提到它:在订阅事件后不要调用'client.authentication.clear()',否则它不会触发. (4认同)