从缓存中获取 Kerberos 票证



我正在使用 JGit 拉取存储库时尝试使用 Kerberos 身份验证,但出现以下错误:

票证缓存
中的空凭据 [Krb5登录模块] 身份验证失败

这是我的登录名。

com.sun.security.jgss.krb5.initiate {
              com.sun.security.auth.module.Krb5LoginModule required
                            debug="true"
                  doNotPrompt="true"
              useTicketCache="true"
              principal="abcd"
              refreshKrb5Config="true"
              isInitiator="true";
 };

我使用自定义的JcshConfigSessionFactory和覆盖的配置方法,如下所示

protected void configure(Host hc, Session session) {
    session.setConfig("StrictHostKeyChecking", "no");
    session.setConfig("GSSAPIAuthentication", "yes");
    session.setConfig("KbdInteractiveAuthentication", "no");
    session.setConfig("PasswordAuthentication", "no");
    session.setConfig("ChallengeResponseAuthentication", "no");
    session.setConfig("PreferredAuthentications", "gssapi-with-mic");
    session.setConfig("Protocol", "2");
}

"klist"说凭据缓存是API(我在MacOS Sierra上(。我怎样才能克服这个失败?

该错误意味着具有票证凭据的文件为空。此外,由于您禁用了密码提示(使用 doNotPrompt="true" (,因此Krb5LoginModule没有其他方法进行身份验证,因此它会报告失败。

请注意,您没有login.conf 处指定缓存文件(使用 ticketCache="path_to_file" (。因此,为避免混淆,请定义它仔细检查您是否具有此类文件以及它是否具有凭据(带有klist -c path_to_file(

如果您没有有效的缓存,您可以使用 kinit -c path_to_file 创建一个新缓存。

最新更新