9

以下代码用于使用 Java+Kerberos 对 Windows AD 服务器进行身份验证,它工作正常 -

public class KerberosAuthenticator {
  public static void main(String[] args) {
    String jaasConfigFilePath = "/myDir/jaas.conf";

    System.setProperty("java.security.auth.login.config", jaasConfigFilePath);

    String krb5ConfigFilePath = "/etc/krb5/krb5.conf";
    System.setProperty("java.security.krb5.conf", krb5ConfigFilePath);

    boolean success = auth.KerberosAuthenticator.authenticate("testprincipal", "testpass");

    System.out.println(success);
}
}

以上只是一个测试程序。实际代码将在 tomcat webapp 中运行。我面临的问题是,如果 krb5.conf 文件发生更改,则如果使用早期版本的 krb5.conf 已经成功验证过一次,则不会在 tomcat 中反映出来。新的更改仅反映在 tomcat 的重新启动上。

我想知道是否有办法指定 JVM 重新加载 krb5.conf 以便它在不重新启动 JVM 的情况下获得最新更改。

4

1 回答 1

8

refreshKrb5Config=true应该为 jaas.conf 中的 KRB5LoginModule 设置。

于 2009-09-17T07:53:51.833 回答