⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 passwordconfig.java

📁 《Master EJB 第二版》
💻 JAVA
字号:
package examples;

import java.util.Hashtable;
import javax.security.auth.login.*;

/**
 * Sample configuration class for JAAS user authentication.
 * This class is useful because it can be rewritten to use
 * different login modules without affecting client code.
 *
 * For example, we could have a login module that did
 * username/password authentication, and another that did
 * public/private key certificate authentication.
 */
public class PasswordConfig extends Configuration {

 /**
  * A configuration class must have a no-argument constructor
  */
 public PasswordConfig() {}

 /**
  * This method chooses the proper login module.
  */
 public AppConfigurationEntry[]
   getAppConfigurationEntry(String applicationName)
 {
  /*
   * Return the one login module we've written, which uses
   * username/password authentication.
   *
   * - The "REQUIRED" flag says that we require that this
   *   login module succeed for authentication.
   * - The new hashtable is a hashtable of options that
   *   our login module will receive.  For example, we might
   *   define an option that turns debugging on.  Our login
   *   module would inspect this hashtable and start logging
   *   output.
   */
  AppConfigurationEntry[] loginModules
   = new AppConfigurationEntry[1];
  loginModules[0] = new AppConfigurationEntry(
   "examples.PasswordLoginModule",
   AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
   new Hashtable());
  return loginModules;
 }

 /**
  * Refresh and reload the Configuration object by reading
  * all of the login configurations again.
  */
 public void refresh() {}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -