Java Code Examples for javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag#OPTIONAL

The following examples show how to use javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag#OPTIONAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JaasConfiguration.java    From registry with Apache License 2.0 6 votes vote down vote up
private LoginModuleControlFlag loginModuleControlFlag(String flag) {
    LoginModuleControlFlag controlFlag;
    switch (flag.toUpperCase(Locale.ROOT)) {
        case "REQUIRED":
            controlFlag = LoginModuleControlFlag.REQUIRED;
            break;
        case "REQUISITE":
            controlFlag = LoginModuleControlFlag.REQUISITE;
            break;
        case "SUFFICIENT":
            controlFlag = LoginModuleControlFlag.SUFFICIENT;
            break;
        case "OPTIONAL":
            controlFlag = LoginModuleControlFlag.OPTIONAL;
            break;
        default:
            throw new IllegalArgumentException("Invalid login module control flag '" + flag + "' in JAAS config");
    }
    return controlFlag;
}
 
Example 2
Source File: AuthenticationJASPIConfigParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private LoginModuleControlFlag getControlFlag(String flag)
{
   if ("required".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.REQUIRED;
   if ("sufficient".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.SUFFICIENT;
   if ("optional".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.OPTIONAL;
   if ("requisite".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.REQUISITE;
   throw PicketBoxMessages.MESSAGES.invalidControlFlag(flag);
}
 
Example 3
Source File: AuthenticationConfigParser.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private LoginModuleControlFlag getControlFlag(String flag)
{
   if("required".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.REQUIRED;
   if("sufficient".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.SUFFICIENT;
   if("optional".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.OPTIONAL;
   if("requisite".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.REQUISITE;

   throw PicketBoxMessages.MESSAGES.invalidControlFlag(flag);
}
 
Example 4
Source File: PicketBoxProcessor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private AppConfigurationEntry.LoginModuleControlFlag getFlag(String flag)
{
   if("REQUIRED".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.REQUIRED;
   if("REQUISITE".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.REQUISITE;
   if("SUFFICIENT".equalsIgnoreCase(flag))
      return LoginModuleControlFlag.SUFFICIENT;
   return LoginModuleControlFlag.OPTIONAL;
}
 
Example 5
Source File: LoginConfiguration.java    From unitime with Apache License 2.0 5 votes vote down vote up
public void init() {
	Debug.info("Configuring authentication service ...");
	String m = ApplicationProperty.AuthenticationModules.value();
	String[] modules = (m == null || m.isEmpty() ? new String[] {} : m.split(";"));
	sEntries = new AppConfigurationEntry[modules.length];
	for (int idx = 0; idx < modules.length; idx++) {
		HashMap<String, Object> options = new HashMap<String, Object>();
		String[] module = modules[idx].split(" ");
		LoginModuleControlFlag flag = LoginModuleControlFlag.SUFFICIENT;
		String name = module[module.length == 1 ? 0 : 1];
		if (module.length > 1) {
			String f = module[0];
			if (f.equalsIgnoreCase("sufficient")) flag = LoginModuleControlFlag.SUFFICIENT;
			else if (f.equalsIgnoreCase("optional")) flag = LoginModuleControlFlag.OPTIONAL;
			else if (f.equalsIgnoreCase("required")) flag = LoginModuleControlFlag.REQUIRED;
			else if (f.equalsIgnoreCase("requisite")) flag = LoginModuleControlFlag.REQUISITE;
		}
		if (module.length > 2)
			for (int i = 2; i < module.length; i++) {
				String[] option = module[i].split("=");
				if (option.length == 1)
					options.put(option[0], "true");
				else
					options.put(option[0], option[1]);
			}
		Debug.info("  Using " + flag + " " + name + " " + options);
		sEntries[idx] = new AppConfigurationEntry(name, flag, options);
	}
}