Java从Kerberos票证收集用户信息

Java从Kerberos票证收集用户信息,java,single-sign-on,desktop-application,kerberos,Java,Single Sign On,Desktop Application,Kerberos,我的Java桌面应用程序使用JAAS模块Krb5LoginModule从Active Directory获取Kerberos票证;代码如下: System.setProperty("java.security.krb5.realm", realmName); System.setProperty("java.security.krb5.kdc", realmAddress); System.setProperty("java.security.auth.login.config", pathTo

我的Java桌面应用程序使用JAAS模块
Krb5LoginModule
从Active Directory获取Kerberos票证;代码如下:

System.setProperty("java.security.krb5.realm", realmName);
System.setProperty("java.security.krb5.kdc", realmAddress);
System.setProperty("java.security.auth.login.config", pathToFile);
LoginContext ctx = new LoginContext("SignedOnUserLoginContext");
ctx.login();
Subject signedOnUserSubject = ctx.getSubject();
这是模块:

SignedOnUserLoginContext {
   com.sun.security.auth.module.Krb5LoginModule
      required
      useTicketCache=true
      doNotPrompt=true;
};
这段代码工作正常,我可以单点登录,但我不知道如何使用此票证收集一些用户信息,比如给定的名称


任何人有什么提示吗?

从主题中,您可以检索已登录主体:

Principal principal = signedOnUserSubject.getPrincipals().iterator().next();
现在您可以获得主体名称:
principal.getName()

有了这些信息,您应该能够查询active directory以获得有关登录用户的更多信息,例如,给定的姓名、电话号码等