Java Code Examples for javax.security.auth.login.AppConfigurationEntry#getLoginModuleName()

The following examples show how to use javax.security.auth.login.AppConfigurationEntry#getLoginModuleName() . 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: ConfigFile.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 2
Source File: ConfigFile.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 3
Source File: ConfigFile.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 4
Source File: ConfigFile.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 5
Source File: ConfigFile.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 6
Source File: ConfigFile.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 7
Source File: ConfigFile.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 8
Source File: ConfigFile.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 9
Source File: ConfigFile.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 10
Source File: ConfigFile.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 11
Source File: ConfigFile.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 12
Source File: BaseAuthenticationInfo.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <p>
 * Creates and returns a copy of the specified list of {@code AppConfigurationEntry} objects, adding the security
 * domain option when necessary. Execution of this method requires a {@code getLoginConfiguration} permission.
 * 
 * </p>
 * 
 * @param entries a {@code List} containing the {@code AppConfigurationEntry} objects to be copied.
 * @return an {@code AppConfigurationEntry} array containing the copied entries.
 */
protected AppConfigurationEntry[] copyAppConfigurationEntry(List<Object> entries)
{
   SecurityManager sm = System.getSecurityManager();
   if (sm != null)
      sm.checkPermission(GET_CONFIG_ENTRY_PERM);
   AppConfigurationEntry[] copy = new AppConfigurationEntry[entries.size()];
   for (int i = 0; i < copy.length; i++)
   {
      AppConfigurationEntry entry = (AppConfigurationEntry) entries.get(i);
      HashMap<String, Object> options = new HashMap<String, Object>(entry.getOptions());
      if (!disableSecurityDomainInOptions())
      {
         options.put(SecurityConstants.SECURITY_DOMAIN_OPTION, this.getName());
      }
      copy[i] = new AppConfigurationEntry(entry.getLoginModuleName(), entry.getControlFlag(), options);
   }
   return copy;
}
 
Example 13
Source File: AppPolicy.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public AppConfigurationEntry[] getAppConfigurationEntry()
{
    AppConfigurationEntry[] appConfig = null;
    if( loginInfo != null )
        appConfig = loginInfo.getAppConfigurationEntry();
    if( appConfig == null && this != defaultAppPolicy )
        appConfig = defaultAppPolicy.getAppConfigurationEntry();
    AppConfigurationEntry[] copy = null;
    if( appConfig != null )
    {
        copy = new AppConfigurationEntry[appConfig.length];
        for(int c = 0; c < copy.length; c ++)
        {
            AppConfigurationEntry e0 = appConfig[c];
            AppConfigurationEntry e1 = new AppConfigurationEntry(
                e0.getLoginModuleName(),
                e0.getControlFlag(),
                e0.getOptions()
                );
            copy[c] = e1;
        }
    }
    return copy;
}
 
Example 14
Source File: ConfigFile.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 15
Source File: ConfigFile.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 16
Source File: ConfigFile.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Retrieve an entry from the Configuration using an application name
 * as an index.
 *
 * @param applicationName the name used to index the Configuration.
 * @return an array of AppConfigurationEntries which correspond to
 *         the stacked configuration of LoginModules for this
 *         application, or null if this application has no configured
 *         LoginModules.
 */
@Override
public AppConfigurationEntry[] engineGetAppConfigurationEntry
    (String applicationName) {

    List<AppConfigurationEntry> list = null;
    synchronized (configuration) {
        list = configuration.get(applicationName);
    }

    if (list == null || list.size() == 0) {
        return null;
    }

    AppConfigurationEntry[] entries =
                            new AppConfigurationEntry[list.size()];
    Iterator<AppConfigurationEntry> iterator = list.iterator();
    for (int i = 0; iterator.hasNext(); i++) {
        AppConfigurationEntry e = iterator.next();
        entries[i] = new AppConfigurationEntry(e.getLoginModuleName(),
                                               e.getControlFlag(),
                                               e.getOptions());
    }
    return entries;
}
 
Example 17
Source File: AuthenticationInfo.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Write element content. The start element is already written.
 * 
 * @param writer
 * @throws XMLStreamException
 */
public void writeContent(XMLStreamWriter writer) throws XMLStreamException
{
   for (int i = 0; i < moduleEntries.size(); i++)
   {
      AppConfigurationEntry entry = (AppConfigurationEntry) moduleEntries.get(i);
      writer.writeStartElement(Element.LOGIN_MODULE.getLocalName());
      String code = entry.getLoginModuleName();
      if (AuthenticationConfigParser.loginModulesMap.containsValue(code)) {
         String value = null;
         Set<Entry<String, String>> entries = AuthenticationConfigParser.loginModulesMap.entrySet();
         for (Entry<String, String> mapEntry : entries) {
             if (mapEntry.getValue().equals(code)) {
                 value = mapEntry.getKey();
                 break;
             }
         }
         writer.writeAttribute(Attribute.CODE.getLocalName(), value);
     }
     else
         writer.writeAttribute(Attribute.CODE.getLocalName(), code);
      writer.writeAttribute(Attribute.FLAG.getLocalName(), valueOf(entry.getControlFlag()));
      Map<String, ?> options = entry.getOptions();
      if (options != null && options.size() > 0)
      {
         for (Entry<String, ?> option : options.entrySet())
         {
            writer.writeStartElement(Element.MODULE_OPTION.getLocalName());
            writer.writeAttribute(Attribute.NAME.getLocalName(), option.getKey());
            writer.writeAttribute(Attribute.VALUE.getLocalName(), option.getValue().toString());
            writer.writeEndElement();
         }
      }
      writer.writeEndElement();
   }
   writer.writeEndElement();
}