我有一个基于 Java 的 Web 应用程序,它获取包含用户名和密码的 Web 表单的内容,并使用 Kerberos 对基于 Windows 的域进行身份验证。
KDC 地址显然被配置为在每次查找时映射到不同的 IP 地址,这可以通过使用命令行中的 ping 命令来确认。
对于大多数请求,呼叫会立即响应,但间歇性地响应缓慢(5-10 秒甚至更长)。我认为这可能是由于使用哪个域控制器造成的。
我尝试打开 Kerberos 日志记录,但未显示域控制器的 IP 地址。我如何打开更详细的日志记录来尝试识别狡猾的域控制器?
代码摘录来源kerb.conf
and kerb_context.conf
从文件系统。
The kerb.conf
is:
[libdefaults]
default_realm = EXAMPLE.COM
[realms]
CYMRU.NHS.UK = {
kdc = example.com:88
admin_server = example.com
kpasswd_server = example.com
}
kerb_context.conf 是:
primaryLoginContext {
com.sun.security.auth.module.Krb5LoginModule required
useTicketCache=false
refreshKrb5Config=true
debug=true;
};
示例来源是:
static NadexUser executePerformLogin(String username, String password) throws LoginException {
char[] passwd = password.toCharArray();
String kerbConf = ERXFileUtilities.pathForResourceNamed("nadex/kerb.conf", "RSCorp", null);
String kerbContextConf = ERXFileUtilities.pathURLForResourceNamed("nadex/kerb_context.conf", "RSCorp", null).toExternalForm();
System.setProperty("java.security.krb5.conf", kerbConf);
System.setProperty("java.security.auth.login.config", kerbContextConf);
try {
LoginContext lc = new LoginContext("primaryLoginContext", new UserNamePasswordCallbackHandler(username, password));
lc.login();
return new _NadexUser(lc.getSubject());
}
catch (javax.security.auth.login.LoginException le) {
throw new LoginException("Failed to login : " + le.getLocalizedMessage(), le);
}
}