View Javadoc

1   package org.astrogrid.security.jaas;
2   
3   import java.util.Hashtable;
4   import javax.security.auth.login.AppConfigurationEntry;
5   import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
6   import javax.security.auth.login.Configuration;
7   
8   
9   /***
10   * Configuration class for use with the LoginContext/LoginModule
11   * part of Java Authentication and Authorization System (JAAS).
12   *
13   * An object of this class returns a hard-coded configuration
14   * telling JAAS to use AstroGrid's NonceToken
15   * authentication system.
16   *
17   * @author Guy Rixon
18   */
19  public class SimpleLoginConfiguration extends Configuration {
20  
21    /***
22     * States which log-in modules are needed for a named application.
23     *
24     * @param name The application name
25     * @return The list of modules required
26     */
27    public AppConfigurationEntry[]
28        getAppConfigurationEntry (String appName) {
29      AppConfigurationEntry a
30          = new AppConfigurationEntry("org.astrogrid.security.jaas.NonceTokenCheck",
31                                      LoginModuleControlFlag.SUFFICIENT,
32                                      new Hashtable());
33      return new AppConfigurationEntry[] {a};
34    }
35  
36  
37    /***
38     * Refreshes the configuration. No action is needed as the
39     * configuration is hard-coded.
40     */
41    public void refresh() {}
42  }