【问题标题】:Using Kerberos with Webstart. Can´t get tgt from ticket cache将 Kerberos 与 Webstart 一起使用。无法从票证缓存中获取 tgt
【发布时间】:2013-02-15 15:36:19
【问题描述】:

我在使用带有 Webstart 的 Kerberos 时遇到了问题。 我想获取当前已登录 Windows 用户的 Principal 并且 API 尝试获取 tgt 从票证缓存中获取。

AllowTgtSessionKey 在注册表中设置为 1。

使用普通的 Java 应用程序一切正常,我拿到票并可以使用主体。

但是当我将我的应用程序部署为 Webstart 时,我无法从缓存中获取票证并获取 当我调用 LoginContext#login 时出现 LoginException。

这是我的代码:

配置:

private static Configuration getProgramaticLoginConfig() 
{
    HashMap<String, String> options = new HashMap<String, String>(); 
    options.put("useTicketCache", "true"); 
    options.put("doNotPrompt", "true"); 
    options.put("debug","true");                                       
    AppConfigurationEntry krb5LoginModule = new AppConfigurationEntry("com.sun.security.auth.module.Krb5LoginModule", LoginModuleControlFlag.REQUIRED, options); 
    final AppConfigurationEntry[] aces = new AppConfigurationEntry[]{krb5LoginModule}; 
    Configuration progConfig = new Configuration() 
    { 
      @Override 
      public AppConfigurationEntry[] getAppConfigurationEntry(String arg0) 
      {                                 
           return aces; 
      } 

    }; 
    return progConfig; 
}

这是我的代码:

LoginContext lc = null;
    try {
        // create a LoginContext
        lc = new LoginContext("asdjfkasdjkfasdö",new DialogCallbackHandler());
    } catch(Exception e) {
        log.error("Initialisierung fehlgeschlagen",e);
    }
    try {       
        // login (effectively populating the Subject)
        lc.login();
    } catch(LoginException e) {
        log.error("Login failed",e);
    }
try {
    //get the Subject that represents the signed-on user
    Subject signedOnUserSubject = lc.getSubject();
...

我做错了什么? 所有 jar 都已签名!

感谢您的帮助。

问候, 霍尔格

【问题讨论】:

    标签: java kerberos java-web-start principal


    【解决方案1】:

    当您使用 web start 启动应用程序时,它处于具有降低权限的小程序上下文中。

    您需要为您的 jar 签名才能允许 jaas 登录。

    这里的例子http://www.narendranaidu.com/2007/11/3-easy-steps-to-self-sign-applet-jar.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-23
      • 1970-01-01
      • 2016-05-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      相关资源
      最近更新 更多