return applicationPolicy;
}
private JSSESecurityDomain createJSSESecurityDomain(String securityDomain, ModelNode operation) {
JBossJSSESecurityDomain jsseSecurityDomain = null;
ModelNode node = operation.get(JSSE);
if (node.isDefined()) {
jsseSecurityDomain = new JBossJSSESecurityDomain(securityDomain);
String value = null;
if (node.hasDefined(KEYSTORE_PASSWORD)) {
value = node.get(KEYSTORE_PASSWORD).asString();
try {
jsseSecurityDomain.setKeyStorePassword(value);
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
if (node.hasDefined(KEYSTORE_TYPE)) {
value = node.get(KEYSTORE_TYPE).asString();
jsseSecurityDomain.setKeyStoreType(value);
}
if (node.hasDefined(KEYSTORE_URL)) {
value = node.get(KEYSTORE_URL).asString();
try {
jsseSecurityDomain.setKeyStoreURL(value);
} catch (IOException ioe) {
throw new IllegalArgumentException(ioe);
}
}
if (node.hasDefined(KEYSTORE_PROVIDER)) {
value = node.get(KEYSTORE_PROVIDER).asString();
jsseSecurityDomain.setKeyStoreProvider(value);
}
if (node.hasDefined(KEYSTORE_PROVIDER_ARGUMENT)) {
value = node.get(KEYSTORE_PROVIDER_ARGUMENT).asString();
jsseSecurityDomain.setKeyStoreProviderArgument(value);
}
if (node.hasDefined(KEY_MANAGER_FACTORY_PROVIDER)) {
value = node.get(KEY_MANAGER_FACTORY_PROVIDER).asString();
jsseSecurityDomain.setKeyManagerFactoryProvider(value);
}
if (node.hasDefined(KEY_MANAGER_FACTORY_ALGORITHM)) {
value = node.get(KEY_MANAGER_FACTORY_ALGORITHM).asString();
jsseSecurityDomain.setKeyManagerFactoryAlgorithm(value);
}
if (node.hasDefined(TRUSTSTORE_PASSWORD)) {
value = node.get(TRUSTSTORE_PASSWORD).asString();
try {
jsseSecurityDomain.setTrustStorePassword(value);
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
if (node.hasDefined(TRUSTSTORE_TYPE)) {
value = node.get(TRUSTSTORE_TYPE).asString();
jsseSecurityDomain.setTrustStoreType(value);
}
if (node.hasDefined(TRUSTSTORE_URL)) {
value = node.get(TRUSTSTORE_URL).asString();
try {
jsseSecurityDomain.setTrustStoreURL(value);
} catch (IOException ioe) {
throw new IllegalArgumentException(ioe);
}
}
if (node.hasDefined(TRUSTSTORE_PROVIDER)) {
value = node.get(TRUSTSTORE_PROVIDER).asString();
jsseSecurityDomain.setTrustStoreProvider(value);
}
if (node.hasDefined(TRUSTSTORE_PROVIDER_ARGUMENT)) {
value = node.get(TRUSTSTORE_PROVIDER_ARGUMENT).asString();
jsseSecurityDomain.setTrustStoreProviderArgument(value);
}
if (node.hasDefined(TRUST_MANAGER_FACTORY_PROVIDER)) {
value = node.get(TRUST_MANAGER_FACTORY_PROVIDER).asString();
jsseSecurityDomain.setTrustManagerFactoryProvider(value);
}
if (node.hasDefined(TRUST_MANAGER_FACTORY_ALGORITHM)) {
value = node.get(TRUST_MANAGER_FACTORY_ALGORITHM).asString();
jsseSecurityDomain.setTrustManagerFactoryAlgorithm(value);
}
if (node.hasDefined(CLIENT_ALIAS)) {
value = node.get(CLIENT_ALIAS).asString();
jsseSecurityDomain.setClientAlias(value);
}
if (node.hasDefined(SERVER_ALIAS)) {
value = node.get(SERVER_ALIAS).asString();
jsseSecurityDomain.setServerAlias(value);
}
if (node.hasDefined(CLIENT_AUTH)) {
boolean clientAuth = node.get(CLIENT_AUTH).asBoolean();
jsseSecurityDomain.setClientAuth(clientAuth);
}
if (node.hasDefined(SERVICE_AUTH_TOKEN)) {
value = node.get(SERVICE_AUTH_TOKEN).asString();
try {
jsseSecurityDomain.setServiceAuthToken(value);
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
}
if (node.hasDefined(CIPHER_SUITES)) {
value = node.get(CIPHER_SUITES).asString();
jsseSecurityDomain.setCipherSuites(value);
}
if (node.hasDefined(PROTOCOLS)) {
value = node.get(PROTOCOLS).asString();
jsseSecurityDomain.setProtocols(value);
}
if (node.hasDefined(ADDITIONAL_PROPERTIES)) {
value = node.get(ADDITIONAL_PROPERTIES).asString();
// remove line breaks and tab
value = value.replaceAll("\\r", "").replaceAll("\\n", "").replaceAll("\\t", "");
String[] entries = value.split(";");
Properties properties = new Properties();
for (int i = 0; i < entries.length; i++) {
String tmp = entries[i];
// trim leading white spaces
tmp = tmp.replaceAll("^\\s+", "");
String[] entry = tmp.split("=");
properties.put(entry[0], entry[1]);
}
jsseSecurityDomain.setAdditionalProperties(properties);
}
}
return jsseSecurityDomain;
}