Search in sources :

Example 1 with AuthRealmConfig

use of com.sun.appserv.management.config.AuthRealmConfig in project Payara by payara.

the class AuthRealmConfigTest method getTestableAuthRealms.

private synchronized Map<String, AuthRealmConfig> getTestableAuthRealms() {
    final Map<String, AuthRealmConfig> m = getConfigConfig().getSecurityServiceConfig().getAuthRealmConfigMap();
    final Map<String, AuthRealmConfig> std = new HashMap<String, AuthRealmConfig>();
    final List<String> warnings = new ArrayList<String>();
    for (final String name : m.keySet()) {
        final AuthRealmConfig c = m.get(name);
        if (AuthRealmConfig.DEFAULT_REALM_CLASSNAME.equals(c.getClassname())) {
            try {
                final String file = c.getPropertyConfigMap().get("file").getValue();
                if (file == null) {
                    warnings.add("Realm " + name + " does not have a 'file' property (test skipped)");
                } else if (file.indexOf(TEMPLATE_PREFIX) >= 0) {
                    warnings.add("Realm " + name + " uses a ${...} name, not yet supported (test skipped)");
                } else {
                    std.put(c.getName(), c);
                }
            } catch (Exception e) {
            }
        }
    }
    if (!WARNED_TESTABLE) {
        WARNED_TESTABLE = true;
        warning(NEWLINE + CollectionUtil.toString(warnings, NEWLINE) + NEWLINE + "Realms which WILL be tested: {" + CollectionUtil.toString(m.keySet()) + "}");
    }
    return std;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) AuthRealmConfig(com.sun.appserv.management.config.AuthRealmConfig)

Example 2 with AuthRealmConfig

use of com.sun.appserv.management.config.AuthRealmConfig in project Payara by payara.

the class AuthRealmConfigTest method testGetters.

public synchronized void testGetters() {
    final Map<String, AuthRealmConfig> arcMap = getTestableAuthRealms();
    for (final AuthRealmConfig ar : arcMap.values()) {
        ar.getName();
        final String classname = ar.getClassname();
        if (classname != null) {
            ar.setClassname(classname);
        }
    }
}
Also used : AuthRealmConfig(com.sun.appserv.management.config.AuthRealmConfig)

Example 3 with AuthRealmConfig

use of com.sun.appserv.management.config.AuthRealmConfig in project Payara by payara.

the class JMXConnectorConfigTest method createProgeny.

protected final AMXConfig createProgeny(final String name, final Map<String, String> options) {
    final Map<String, String> allOptions = MapUtil.newMap(options, OPTIONAL);
    final int port = (name.hashCode() % 16000) + 33111;
    final String authRealmName = createAuthRealmName(name);
    final AuthRealmConfig authRealmConfig = createAuthRealmConfig(authRealmName);
    try {
        return getAdminServiceConfig().createJMXConnectorConfig(name, ADDRESS, "" + port, authRealmName, allOptions);
    } catch (Exception e) {
        removeAuthRealmConfig(authRealmName);
        throw new RuntimeException(e);
    }
}
Also used : AuthRealmConfig(com.sun.appserv.management.config.AuthRealmConfig)

Example 4 with AuthRealmConfig

use of com.sun.appserv.management.config.AuthRealmConfig in project Payara by payara.

the class JMXConnectorConfigTest method ensureDefaultInstance.

public static JMXConnectorConfig ensureDefaultInstance(final AdminServiceConfig adminServiceConfig) {
    JMXConnectorConfig result = adminServiceConfig.getJMXConnectorConfigMap().get(getDefaultInstanceName());
    if (result == null) {
        final SecurityServiceConfig securityServiceConfig = getConfigConfig(adminServiceConfig).getSecurityServiceConfig();
        final AuthRealmConfig defaultAuthRealm = AuthRealmConfigTest.ensureDefaultInstance(securityServiceConfig);
        result = createInstance(getDefaultInstanceName(), ADDRESS, DEFAULT_PORT, defaultAuthRealm, OPTIONAL);
    }
    return result;
}
Also used : AuthRealmConfig(com.sun.appserv.management.config.AuthRealmConfig) SecurityServiceConfig(com.sun.appserv.management.config.SecurityServiceConfig) JMXConnectorConfig(com.sun.appserv.management.config.JMXConnectorConfig)

Aggregations

AuthRealmConfig (com.sun.appserv.management.config.AuthRealmConfig)4 JMXConnectorConfig (com.sun.appserv.management.config.JMXConnectorConfig)1 SecurityServiceConfig (com.sun.appserv.management.config.SecurityServiceConfig)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1