/** * Set security domain name related configuration * @param securityDomainName */ public void setSecurityDomainName(String securityDomainName) { this.securityDomainName = securityDomainName; this.PICKETBOX_SECURITY_DOMAIN_ADDRESS=Address.subsystem("security").and("security-domain", securityDomainName); this.UNDERTOW_APPLICATION_SECURITY_DOMAIN_NAME=securityDomainName; this.UNDERTOW_APPLICATION_SECURITY_DOMAIN_ADDRESS = Address.subsystem("undertow").and("application-security-domain", UNDERTOW_APPLICATION_SECURITY_DOMAIN_NAME); }
/** * Reverts all configuration done for Elytron * @throws Exception */ private void cleanUpElytron() throws Exception { try { ops.removeIfExists(UNDERTOW_APPLICATION_SECURITY_DOMAIN_ADDRESS); ops.removeIfExists(ELYTRON_PROP_HTTP_AUTHENTICATION_FACTORY_ADDRESS); ops.removeIfExists(ELYTRON_SECURITY_DOMAIN_ADDRESS); ops.removeIfExists(ELYTRON_PROPERTIES_REALM_ADDRESS); administration.reloadIfRequired(); } finally { managementClient.close(); } }
ops.add(ELYTRON_PROPERTIES_REALM_ADDRESS, Values.empty() .andObject("users-properties", Values.empty() .and("path", USERS_FILE.getAbsolutePath()) .andOptional("plain-text", true)) .andObjectOptional("groups-properties", Values.empty() .and("path", ROLES_FILE.getAbsolutePath()))); administration.reloadIfRequired(); + ELYTRON_PROP_HTTP_AUTHENTICATION_FACTORY_NAME + ")"); administration.reloadIfRequired(); assertTrue("The elytron/properties-realm should be created", ops.exists(ELYTRON_PROPERTIES_REALM_ADDRESS)); assertTrue("The elytron/security-domain should be created", ops.exists(ELYTRON_SECURITY_DOMAIN_ADDRESS)); assertTrue("The elytron/http-authentication-factory should be created", ops.exists(ELYTRON_PROP_HTTP_AUTHENTICATION_FACTORY_ADDRESS)); assertTrue("The undertow/application-security-domain should be created", ops.exists(UNDERTOW_APPLICATION_SECURITY_DOMAIN_ADDRESS));
public void removeConfigurations(String cacheContainer) throws Exception { ops.removeIfExists(Address.subsystem("datagrid-infinispan") .and("cache-container", cacheContainer) .and("configurations", "CONFIGURATIONS")); }
/** * Removes given {@code server} from given {@code host} * * @return {@code true} if the server was actually removed, {@code false} otherwise */ public boolean removeServer(String host, String server) throws IOException, OperationException { return ops.removeIfExists(Address.host(host).and(Constants.SERVER_CONFIG, server)); } }
@Override public void setup(ManagementClient fakemanagementClient, String s) throws Exception { // Set path for users.properties and roles.properties setConfigurationPath(); // Create and initialize management client managementClient = TestUtil.clientInit(); administration = new Administration(managementClient); ops = new Operations(managementClient); if (subsystem.equals("elytron")) { configureElytron(); } else { configurePicketBox(); } }
@Override public void shutdown(int timeoutInSeconds) throws IOException { if (timeoutInSeconds == 0) { // older versions don't understand the "timeout" parameter ops.invoke(Constants.SHUTDOWN, Address.root()); } else { ops.invoke(Constants.SHUTDOWN, Address.root(), Values.of(Constants.TIMEOUT, timeoutInSeconds)); } }
/** * Creates PicketBox security domain * @throws Exception */ private void configurePicketBox() throws Exception { // Create security domain AddSecurityDomain addSecurityDomain = new AddSecurityDomain.Builder(securityDomainName).build(); managementClient.apply(addSecurityDomain); // Create login module AddLoginModule addLoginModule = new AddLoginModule.Builder("org.jboss.security.auth.spi.UsersRolesLoginModule", PICKETBOX_LOGIN_MODULE_NAME) .securityDomainName(securityDomainName) .flag("required") .module("org.picketbox") .addModuleOption("usersProperties", USERS_FILE.getAbsolutePath()) .addModuleOption("rolesProperties", ROLES_FILE.getAbsolutePath()) .build(); managementClient.apply(addLoginModule); administration.reloadIfRequired(); assertTrue("The login module should be created", ops.exists(PICKETBOX_LOGIN_MODULE_ADDRESS)); }
public void addMemcachedEndpoint(String name, String cacheContainer, String cache, String socketBinding) throws Exception { ops.add(Address.subsystem("datagrid-infinispan-endpoint") .and("memcached-connector", name), Values.empty() .and("cache-container", cacheContainer) .and("cache", cache) .and("socket-binding", socketBinding)); }
public void removeRemotingConnector(String socketBinding) throws Exception { ops.removeIfExists(Address.subsystem("jmx") .and("remoting-connector", "jmx")); ops.removeIfExists(Address.subsystem("remoting") .and("connector", "remoting-connector")); }
/** * Reverts all configuration done for PicketBox * @throws Exception */ private void cleanUpPicketBox() throws Exception { try { ops.removeIfExists(PICKETBOX_SECURITY_DOMAIN_ADDRESS); administration.reloadIfRequired(); } finally { managementClient.close(); } } }
public void addHotRodEndpoint(String name, String cacheContainer, String cache, String socketBinding) throws Exception { ops.add(Address.subsystem("datagrid-infinispan-endpoint") .and("hotrod-connector", name), Values.empty() .and("cache-container", cacheContainer) .and("cache", cache) .and("socket-binding", socketBinding)); }
public void addRemotingConnector(String socketBinding) throws Exception { ops.add(Address.subsystem("remoting") .and("connector", "remoting-connector"), Values.empty() .and("socket-binding", socketBinding) .and("security-realm", "ApplicationRealm")); ops.add(Address.subsystem("jmx") .and("remoting-connector", "jmx"), //this has to be "jmx" name Values.empty() .and("use-management-endpoint", "false")); }
public void addRestEndpoint(String name, String cacheContainer, String cache, String socketBinding) throws Exception { ops.add(Address.subsystem("datagrid-infinispan-endpoint") .and("rest-connector", name), Values.empty() .and("cache-container", cacheContainer) .and("cache", cache) .and("socket-binding", socketBinding)); }
public void addCache(String name, String cacheContainer, String baseConfiguration, String cacheType) throws Exception { ops.add(Address.subsystem("datagrid-infinispan") .and("cache-container", cacheContainer) .and(cacheType, name), Values.empty() .andOptional("configuration", baseConfiguration) .and("start", "EAGER") .and("mode", "SYNC")); }