使用当前 HTTP 请求身份作为 SharpSVN 的默认凭据
我正在尝试通过 Web 应用程序调用 SharpSVN 中的 RemoteCreateDirectories,并希望凭据是登录用户的凭据。这可以隐式完成还是需要用户名和密码,如下例所示?
using (var svnClient = new SvnClient())
{
svnClient.Authentication.DefaultCredentials = new NetworkCredential(@"aaa\bbb", "ccc");
svnClient.LoadConfiguration(repoName);
svnClient.RemoteCreateDirectories(uris, args);
}
我不想明确地向用户请求凭据(它是一个集成的身份验证应用程序),因此我看到的唯一其他方法是使用不理想的服务帐户。
I’m trying to call RemoteCreateDirectories in SharpSVN through a web app and want the credentials to be that of the logged on user. Can this be done implicitly or is the username and password required as per the example below?
using (var svnClient = new SvnClient())
{
svnClient.Authentication.DefaultCredentials = new NetworkCredential(@"aaa\bbb", "ccc");
svnClient.LoadConfiguration(repoName);
svnClient.RemoteCreateDirectories(uris, args);
}
I don’t want to explciitly request credentials from the user (it’s an integrated auth app) so the only other way I see around this is to use a service account which is not ideal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
CredentialCache.DefaultCredentials
包含当前凭据的令牌。它不提供实际的用户名和/或密码。您需要准确的用户名和密码才能通过 SharpSvn 将它们传递到 Subversion 库。
CredentialCache.DefaultCredentials
contains a token of the current credentials. It doesn't provide the actual username and/or password.You would need the exact username and password to pass them to the Subversion libraries via SharpSvn.
您是否尝试过使用
CredentialCache.DefaultCredentials
- 这应该包含当前登录用户的凭据。http://support.microsoft.com/kb/813834
Have you tried using
CredentialCache.DefaultCredentials
- this should contain the credentials of the currently logged in user.http://support.microsoft.com/kb/813834
终于找到了一个参考,它基本上说明了这一点使用当前用户的身份是不可能的,唯一的选择是手动构建目录树或使用管理/服务帐户。我选择了后者;并不理想,但我仍然可以运行。
Finally found a reference which essentially says this is not possible using the identity of the current user and the only options are manual construction of the directory tree or using an admin / service account. I opted for the latter; not ideal but I’m up and running nonetheless.