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

📄 e507. listing the login modules of an entry in the current login configuration.txt

📁 这里面包含了一百多个JAVA源文件
💻 TXT
字号:
This example retrieves the login modules of a login-application entry in the current login configuration. 
    Configuration config = Configuration.getConfiguration();
    
    // Get the login modules
    AppConfigurationEntry[] loginModuleEntries = config.getAppConfigurationEntry("AppName");
    if (loginModuleEntries == null) {
        // There are no entries for the specified login-app name
    }
    
    // List the login modules
    for (int i=0; i<loginModuleEntries.length; i++) {
        // Get login module name
        String name = loginModuleEntries[i].getLoginModuleName();
    
        // Get login module flag
        AppConfigurationEntry.LoginModuleControlFlag flag
            = loginModuleEntries[i].getControlFlag();
    
        if (flag == AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL) {
            // The login module is not required to succeed.
            // Whether it succeeds or not, the next login module is invoked.
        } else if (flag == AppConfigurationEntry.LoginModuleControlFlag.REQUIRED) {
            // The login module is required to succeed.
            // Whether it succeeds or not, the next login module is invoked.
        } else if (flag == AppConfigurationEntry.LoginModuleControlFlag.REQUISITE) {
            // The login module is required to succeed. If it succeeds, the next
            // login module is invoked; otherwise, authentication fails and
            // no more login modules are invoked.
        } else if (flag == AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT) {
            // If this login module succeeds, authentication succeeds and no
            // more login modules are invoked
        }
    }

Here's a sample of a login configuration file: 
    AppName {
        com.sun.security.auth.module.NTLoginModule required;
        MyLoginModule1 requisite;
        MyLoginModule2 sufficient;
        MyLoginModule3 optional;
    };

The login configuration file is specified at the command line: 
    > java -Djava.security.auth.login.config=myconfig.config MyApp


⌨️ 快捷键说明

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