简体   繁体   English

Windows服务中的Kerberos身份验证

[英]Kerberos authentication in windows service

I am new on kerberos authentication and don't know anything about it. 我是Kerberos身份验证的新手,对此一无所知。 I have the server name, username and password ready for it. 我已经准备好服务器名称,用户名和密码。

I need to authenticate users from stand alone windows application. 我需要从独立的Windows应用程序对用户进行身份验证。 Can somebody please help? 有人可以帮忙吗?

I did not find much help on googling. 我在谷歌搜索中没有发现太多帮助。

Appreciate any thought. 感谢任何想法。

In Kerberos you authenticate not with pair username/password, but by attaching Kerberos token, which you can grab from CredentialsCache. 在Kerberos中,您不使用用户名/密码对进行身份验证,而是通过附加Kerberos令牌进行身份验证,可以从CredentialsCache中获取该令牌。

WebRequest WReq = WebRequest.Create (MyURI);
WReq.Credentials = CredentialCache.DefaultCredentials;

see: https://msdn.microsoft.com/en-us/library/yk7437c8%28v=vs.110%29.aspx 参见: https : //msdn.microsoft.com/zh-cn/library/yk7437c8%28v=vs.110%29.aspx

The second line will give you NTLM or Kerberos credentials. 第二行将为您提供NTLM或Kerberos凭据。 You'll get Kerberos credentials when: 在以下情况下,您将获得Kerberos凭据:

  • your application is started by a domain user account 您的应用程序是由域用户帐户启动的
  • SPN or UPN for the server in present in Kerberos KeyDistributionCentre Kerberos KeyDistributionCentre中存在的服务器的SPN或UPN
  • Server is configured to receive Kerberos tokens, at least: you must provide it a password. 服务器配置为至少接收Kerberos令牌:您必须提供一个密码。

When you execute 'CredentialCache.DefaultCredentials', your application uses underlying mechanisms to generate SPNEGO token for you. 当您执行“ CredentialCache.DefaultCredentials”时,您的应用程序将使用基础机制为您生成SPNEGO令牌。 Inside it, will be Keberos or NTLM ticket. 里面有Keberos或NTLM门票。 Here's how it works: 运作方式如下:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM