Using the current HTTP request identity as the default credentials for SharpSVN

萝らか妹 提交于 2019-12-10 18:15:11

问题


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.


回答1:


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.




回答2:


Have you tried using CredentialCache.DefaultCredentials - this should contain the credentials of the currently logged in user.

http://support.microsoft.com/kb/813834




回答3:


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.



来源:https://stackoverflow.com/questions/1377258/using-the-current-http-request-identity-as-the-default-credentials-for-sharpsvn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!