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

The following examples show how to use javax.security.auth.login.AppConfigurationEntry#LoginModuleControlFlag . 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: ConfigUtil.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
static void parseModule(Element module, ArrayList entries)
   throws Exception
{
   AppConfigurationEntry.LoginModuleControlFlag controlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
   String className = DOMUtils.getAttributeValue(module, "code");
   String flag = DOMUtils.getAttributeValue(module, "flag");
   if (flag != null)
   {
      // Lower case is what is used by the jdk1.4.1 implementation
      flag = flag.toLowerCase(Locale.ENGLISH);
      if (AppConfigurationEntry.LoginModuleControlFlag.REQUIRED.toString().indexOf(flag) > 0)
         controlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;
      else if (AppConfigurationEntry.LoginModuleControlFlag.REQUISITE.toString().indexOf(flag) > 0)
         controlFlag = AppConfigurationEntry.LoginModuleControlFlag.REQUISITE;
      else if (AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT.toString().indexOf(flag) > 0)
         controlFlag = AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT;
      else if (AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL.toString().indexOf(flag) > 0)
         controlFlag = AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL;
   }
   NodeList opts = module.getElementsByTagName("module-option");
   HashMap options = new HashMap();
   for (int n = 0; n < opts.getLength(); n++)
   {
      Element opt = (Element) opts.item(n);
      String name = opt.getAttribute("name");
      String value = DOMUtils.getTextContent(opt);
      if( value == null )
         value = "";
      options.put(name, value);
   }
   AppConfigurationEntry entry = new AppConfigurationEntry(className, controlFlag, options);
   entries.add(entry);
}
 
Example 2
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 3
Source File: GSSAPIConfiguration.java    From Spark with Apache License 2.0 5 votes vote down vote up
public boolean putAppConfigurationEntry( String name, String module, AppConfigurationEntry.LoginModuleControlFlag controlFlag, Map<String, String> options )
{
    Vector<AppConfigurationEntry> v;
    if ( configs.containsKey( name ) )
    {
        v = configs.get( name );
    }
    else
    {
        v = new Vector<>();
        configs.put( name, v );
    }

    return v.add( new AppConfigurationEntry( module, controlFlag, options ) );
}
 
Example 4
Source File: SecurityDomainJBossASClient.java    From hawkular-agent with Apache License 2.0 4 votes vote down vote up
/**
 * @param loginModuleFQCN fully qualified class name to be set as the login-module "code".
 * @param flag constant, one of required|requisite|sufficient|optional
 * @param moduleOptionProperties map of propName/propValue mappings to be as module options
 */
public LoginModuleRequest(String loginModuleFQCN, AppConfigurationEntry.LoginModuleControlFlag flag,
        Map<String, String> moduleOptionProperties) {

    this.entry = new AppConfigurationEntry(loginModuleFQCN, flag, moduleOptionProperties);
}
 
Example 5
Source File: SecurityDomainJBossASClient.java    From hawkular-agent with Apache License 2.0 4 votes vote down vote up
public AppConfigurationEntry.LoginModuleControlFlag getFlag() {
    return entry.getControlFlag();
}