Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Commit

Permalink
[THORN-2215] update default configuration of the Undertow, Elytron an…
Browse files Browse the repository at this point in the history
…d Infinispan fractions to match WildFly 14 subsystems
  • Loading branch information
Ladicek committed Dec 6, 2018
1 parent 32c504c commit 940ccd4
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 49 deletions.
Expand Up @@ -35,11 +35,13 @@
import static org.wildfly.swarm.spi.api.Defaultable.ifAnyExplicitlySet;
import static org.wildfly.swarm.spi.api.Defaultable.integer;
import static org.wildfly.swarm.undertow.UndertowProperties.DEFAULT_AJP_PORT;
import static org.wildfly.swarm.undertow.UndertowProperties.DEFAULT_BUFFER_CACHE;
import static org.wildfly.swarm.undertow.UndertowProperties.DEFAULT_HOST;
import static org.wildfly.swarm.undertow.UndertowProperties.DEFAULT_HTTPS_PORT;
import static org.wildfly.swarm.undertow.UndertowProperties.DEFAULT_HTTP_LISTENER;
import static org.wildfly.swarm.undertow.UndertowProperties.DEFAULT_HTTP_PORT;
import static org.wildfly.swarm.undertow.UndertowProperties.DEFAULT_SERVER;
import static org.wildfly.swarm.undertow.UndertowProperties.DEFAULT_SERVLET_CONTAINER;

/**
* @author Bob McWhirter
Expand All @@ -60,13 +62,17 @@ public static UndertowFraction createDefaultFraction() {
}

public UndertowFraction applyDefaults() {
server(new Server(DEFAULT_SERVER)
.httpListener(DEFAULT_HTTP_LISTENER, (listener) -> {
listener.socketBinding("http");
})
.host(new Host(DEFAULT_HOST)))
.bufferCache(new BufferCache("default"))
.servletContainer(new ServletContainer("default")
defaultServer(DEFAULT_SERVER)
.defaultVirtualHost(DEFAULT_HOST)
.defaultServletContainer(DEFAULT_SERVLET_CONTAINER)
.defaultSecurityDomain("other")
.server(new Server(DEFAULT_SERVER)
.httpListener(DEFAULT_HTTP_LISTENER, (listener) -> {
listener.socketBinding("http");
})
.host(new Host(DEFAULT_HOST)))
.bufferCache(new BufferCache(DEFAULT_BUFFER_CACHE))
.servletContainer(new ServletContainer(DEFAULT_SERVLET_CONTAINER)
.websocketsSetting(new WebsocketsSetting())
.jspSetting(new JSPSetting()))
.handlerConfiguration(new HandlerConfiguration());
Expand Down
Expand Up @@ -32,4 +32,6 @@ public interface UndertowProperties {
String DEFAULT_HTTP_LISTENER = "default";
String DEFAULT_HTTPS_LISTENER = "default-https";
String DEFAULT_HOST = "default-host";
String DEFAULT_SERVLET_CONTAINER = "default";
String DEFAULT_BUFFER_CACHE = "default";
}
Expand Up @@ -121,6 +121,7 @@ public ElytronFraction applyDefaults() {
});
*/

// TODO
customRealm(APPLICATION_REALM, (realm) -> {
realm.module("org.wildfly.swarm.elytron:runtime");
realm.className("org.wildfly.swarm.elytron.runtime.Realm");
Expand All @@ -137,45 +138,46 @@ public ElytronFraction applyDefaults() {
put("principals", new ArrayList() {{
add("anonymous");
}});
put("permissions", new ArrayList() {{
put("permission-sets", new ArrayList() {{
add(new HashMap() {{
put(CLASS_NAME, "org.wildfly.extension.batch.jberet.deployment.BatchPermission");
put(MODULE, "org.wildfly.extension.batch.jberet");
put(TARGET_NAME, "*");
}});
add(new HashMap() {{
put(CLASS_NAME, "org.wildfly.transaction.client.RemoteTransactionPermission");
put(MODULE, "org.wildfly.transaction.client");
}});
add(new HashMap() {{
put(CLASS_NAME, "org.jboss.ejb.client.RemoteEJBPermission");
put(MODULE, "org.jboss.ejb-client");
put("permission-set", "default-permissions");
}});
}});
}});
mapper.permissionMapping(new HashMap() {{
put("match-all", true);
put("permissions", new ArrayList() {{
add(new HashMap() {{
put(CLASS_NAME, "org.wildfly.security.auth.permission.LoginPermission");
}});
add(new HashMap() {{
put(CLASS_NAME, "org.wildfly.extension.batch.jberet.deployment.BatchPermission");
put(MODULE, "org.wildfly.extension.batch.jberet");
put(TARGET_NAME, "*");
}});
put("permission-sets", new ArrayList() {{
add(new HashMap() {{
put(CLASS_NAME, "org.wildfly.transaction.client.RemoteTransactionPermission");
put(MODULE, "org.wildfly.transaction.client");
put("permission-set", "login-permission");
}});
add(new HashMap() {{
put(CLASS_NAME, "org.jboss.ejb.client.RemoteEJBPermission");
put(MODULE, "org.jboss.ejb-client");
put("permission-set", "default-permissions");
}});
}});
}});
});

permissionSet("login-permission", permissionSet -> {
permissionSet.permission(new HashMap() {{
put(CLASS_NAME, "org.wildfly.security.auth.permission.LoginPermission");
}});
});
permissionSet("default-permissions", permissionSet -> {
permissionSet.permission(new HashMap() {{
put(CLASS_NAME, "org.wildfly.extension.batch.jberet.deployment.BatchPermission");
put(MODULE, "org.wildfly.extension.batch.jberet");
put(TARGET_NAME, "*");
}});
permissionSet.permission(new HashMap() {{
put(CLASS_NAME, "org.wildfly.transaction.client.RemoteTransactionPermission");
put(MODULE, "org.wildfly.transaction.client");
}});
permissionSet.permission(new HashMap() {{
put(CLASS_NAME, "org.jboss.ejb.client.RemoteEJBPermission");
put(MODULE, "org.jboss.ejb-client");
}});
});

constantRealmMapper(LOCAL, (mapper) -> {
mapper.realmName(LOCAL);
});
Expand All @@ -201,22 +203,6 @@ public ElytronFraction applyDefaults() {
}});
});

httpAuthenticationFactory("application-http-authentication", (auth) -> {
auth.httpServerMechanismFactory(GLOBAL);
auth.securityDomain(APPLICATION_DOMAIN);
auth.mechanismConfiguration(new HashMap() {{
put(MECHANISM_NAME, "BASIC");
put(MECHANISM_REALM_CONFIGURATIONS, new ArrayList() {{
add(new HashMap() {{
put(REALM_NAME, "Application Realm");
}});
}});
}});
auth.mechanismConfiguration(new HashMap() {{
put(MECHANISM_NAME, "FORM");
}});
});

providerHttpServerMechanismFactory(GLOBAL);

saslAuthenticationFactory("management-sasl-authentication", (auth) -> {
Expand Down
Expand Up @@ -92,7 +92,7 @@ private void localCustomization() {

if (!this.jpa.isUnsatisfied()) {
this.fraction.cacheContainer("hibernate",
cc -> cc.module("org.hibernate.infinispan")
cc -> cc.module("org.infinispan.hibernate-cache")
.localCache("entity",
c -> c.transactionComponent(t -> t.mode(TransactionComponent.Mode.NON_XA))
.objectMemory(om -> om.size(10000L))
Expand Down

0 comments on commit 940ccd4

Please sign in to comment.