我开发了一个带有kerberos (v1.0.1) 身份验证的 Web 应用程序。
我的目标是通过 Windows 身份验证 Active Directory (Windows Server 2008 R2) 提供登录。
问题是浏览器发送到后端 NTLM 票而不是 Kerberos 票。我使用wireshak检查通信工作流程:
- 我在后端打了个休息电话
- 应用程序服务器对我的响应 401
- 浏览器调用活动目录上的 kerberos 服务并收到 TGS_REP
- 现在我希望浏览器使用 Kerberos 令牌调用我的休息服务,但我收到的是 NTLM 令牌
我用 JAVA 开发的后端服务抛出以下异常:
GSSException: Defective token detected
编辑1:
第一个问题是我们使用 IP 来生成 SPN 和 KEYTAB。因此,我们以这种方式创建了 keytab:
ktpass /out c:\keytab\myuser.keytab /mapuser myuser@company.com /princ HTTP/myuser.company.com@WELLD.CH /pass mypassword /ptype KRB5_NT_PRINCIPAL /crypto All
然后我们在 DNS 上添加了我们的 BE 服务器
<ip_server> myuser.company.com
目前我们可以使用kerberos登录,并且BE(spring boot)成功验证了kerberos的token,但是我们无法使用下载用户信息KerberosLdapContextSource,所以我们采用了一种变通方法并使用了DefaultSpringSecurityContextSourceBean。
有人有任何想法或参考可以依赖吗?
谢谢