任何人都可以告诉我如何使用SharpSVN Library验证存储库的用户(SVN用户)。 该存储库只应由这些用户提交。 感谢使用SharpSVN进行SVN存储库验证
25
A
回答
45
使用的SVNClient
的身份验证属性:
client.Authentication.Clear(); // Clear a previous authentication
client.Authentication.DefaultCredentials = new System.Net.NetworkCredential("user", "password");
9
你也可以通过添加一个事件处理SslServerTrustHandlers
像这样覆盖SSL证书错误:
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;
}
+4
只是为了提到它:在订阅事件后不要调用'client.authentication.clear()',否则它不会触发。 – SanBen 2012-05-09 12:53:41
14
client.Authentication.ForceCredentials("user", "password");
对于那些你不想吹掉你的默认凭证(如果你在同一台机器上运行TortoiseSVN)。
2
就我而言,SVN服务器运行启用集成Windows身份验证的VisualSVN Server 3.5.3。使用SharpSvn 1.9004.3879.127,SVN客户端尝试甚至使用Windows身份验证时,我有一个用户名和密码进行配置的:
client = new SvnClient();
client.Authentication.Clear(); //Prevents saving/loading config to/from disk
client.Authentication.DefaultCredentials = new NetworkCredential("username", "password");
这导致以下错误,当应用程序代码是由没一个Windows用户运行'T可以访问存储库:
SvnRepositoryIOException:无法在URL连接到存储库' https://mysvnserver/svn/reponame“
我通过only allowing basic
and digest
authentication解决了这个问题:
client = new SvnClient();
client.Configuration.SetOption("servers", "global", "http-auth-types", "basic;digest");
client.Authentication.Clear(); // Prevents saving/loading config to/from disk
client.Authentication.DefaultCredentials = new NetworkCredential("username", "password");
相关问题
- 1. 如何使用SharpSvn来比较Svn存储库
- 2. 存储库验证
- 3. SharpSvn转储库tortoise
- 4. 使用jQuery Passport.JS进行身份验证不存储cookie
- 5. 使用TFS的外部工具进行身份验证Git存储库
- 6. sharpsvn搜索存储库提交
- 7. 使用验证服务进行验证
- 8. 使用企业库验证块进行复杂对象验证
- 9. 使用C#创建SVN存储库
- 10. 使用wget“签出”svn存储库
- 11. 使用bash分析svn存储库
- 12. 如何使用SharpSvn获取存储库的所有分支?
- 13. 使用webdav进行SVN身份验证访问
- 14. 使用LDAP进行验证
- 15. 使用AWK进行验证
- 16. 使用JavaScript进行验证
- 17. 使用AJAX进行验证
- 18. 使用doctype进行验证
- 19. 使用sharpsvn API从ASP.Net访问Visual SVN
- 20. 如何在c#中使用SharpSVN库设置SVN提交作者
- 21. 更改SVN存储库
- 22. Apache2 svn多个存储库
- 23. 创建SVN retrocompatible存储库
- 24. SVN远程存储库
- 25. svn +存储库位置
- 26. 搜索SVN存储库
- 27. SVN加载新存储库
- 28. SVN存储库搜索
- 29. SVN只读存储库
- 30. 已更改svn存储库
应该标记为最佳答案。为我工作,谢谢! – jocull 2011-05-14 16:50:53
是的,我也为我工作,谢谢伯特朗:) – picnic4u 2012-12-06 10:36:02
这不适合我,是否有一些先决条件呢? – 2012-12-14 23:49:25