Skip to content

Commit

Permalink
[WFLY-15732] / [WFLY-15356] Remove use of security-plugins from Under…
Browse files Browse the repository at this point in the history
…tow subsystem.
  • Loading branch information
darranl committed Nov 23, 2021
1 parent 21113da commit e5e9b11
Show file tree
Hide file tree
Showing 27 changed files with 22 additions and 2,666 deletions.
5 changes: 0 additions & 5 deletions undertow/pom.xml
Expand Up @@ -78,11 +78,6 @@
<groupId>org.wildfly.common</groupId>
<artifactId>wildfly-common</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>wildfly-security-plugins</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>wildfly-web-common</artifactId>
Expand Down
Expand Up @@ -46,7 +46,6 @@
import org.jboss.dmr.ModelType;
import org.jboss.dmr.ValueExpression;
import org.jboss.msc.service.ServiceController;
import org.jboss.security.SecurityConstants;
import org.wildfly.extension.undertow.filters.FilterDefinitions;
import org.wildfly.extension.undertow.handlers.HandlerDefinitions;

Expand Down Expand Up @@ -103,7 +102,7 @@ class UndertowRootDefinition extends PersistentResourceDefinition {
protected static final SimpleAttributeDefinition DEFAULT_SECURITY_DOMAIN =
new SimpleAttributeDefinitionBuilder(Constants.DEFAULT_SECURITY_DOMAIN, ModelType.STRING, true)
.setAllowExpression(true)
.setDefaultValue(new ModelNode(SecurityConstants.DEFAULT_APPLICATION_POLICY))
.setDefaultValue(new ModelNode("other"))
.addAccessConstraint(SensitiveTargetAccessConstraintDefinition.SECURITY_DOMAIN_REF)
.setRestartAllServices()
.build();
Expand Down
Expand Up @@ -29,19 +29,16 @@
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.function.Consumer;
import javax.security.jacc.PolicyContext;
import javax.security.jacc.PolicyContextException;

import io.undertow.Version;
import org.jboss.as.controller.PathAddress;
import org.jboss.msc.service.Service;
import org.jboss.msc.service.ServiceName;
import org.jboss.msc.service.StartContext;
import org.jboss.msc.service.StartException;
import org.jboss.msc.service.StopContext;
import org.jboss.security.SecurityConstants;
import org.wildfly.extension.undertow.logging.UndertowLogger;
import org.wildfly.extension.undertow.security.jacc.HttpServletRequestPolicyContextHandler;

import io.undertow.Version;

/**
* @author <a href="mailto:tomaz.cerar@redhat.com">Tomaz Cerar</a> (c) 2013 Red Hat Inc.
Expand Down Expand Up @@ -185,22 +182,13 @@ public static ServiceName listenerName(String listenerName) {
@Override
public void start(final StartContext context) throws StartException {
UndertowLogger.ROOT_LOGGER.serverStarting(Version.getVersionString());
// Register the active request PolicyContextHandler
try {
PolicyContext.registerHandler(SecurityConstants.WEB_REQUEST_KEY,
new HttpServletRequestPolicyContextHandler(), true);
} catch (PolicyContextException pce) {
UndertowLogger.ROOT_LOGGER.failedToRegisterPolicyContextHandler(SecurityConstants.WEB_REQUEST_KEY, pce);
}

serviceConsumer.accept(this);
}

@Override
public void stop(final StopContext context) {
serviceConsumer.accept(null);
// Remove PolicyContextHandler
Set handlerKeys = PolicyContext.getHandlerKeys();
handlerKeys.remove(SecurityConstants.WEB_REQUEST_KEY);

UndertowLogger.ROOT_LOGGER.serverStopping(Version.getVersionString());

Expand Down

This file was deleted.

This file was deleted.

Expand Up @@ -34,7 +34,6 @@
import org.jboss.metadata.ear.spec.EarMetaData;
import org.jboss.metadata.web.jboss.JBossWebMetaData;
import org.jboss.msc.service.ServiceName;
import org.jboss.security.SecurityConstants;
import org.wildfly.extension.undertow.Capabilities;
import org.wildfly.extension.undertow.Constants;

Expand All @@ -45,6 +44,8 @@
*/
public class SecurityDomainResolvingProcessor implements DeploymentUnitProcessor {

private static final String JAAS_CONTEXT_ROOT = "java:jboss/jaas/";
private static final String JASPI_CONTEXT_ROOT = "java:jboss/jbsx/";
private static final String LEGACY_JAAS_CONTEXT_ROOT = "java:/jaas/";

private final String defaultSecurityDomain;
Expand Down Expand Up @@ -123,10 +124,10 @@ public static String unprefixSecurityDomain(String securityDomain) {
String result = null;
if (securityDomain != null)
{
if (securityDomain.startsWith(SecurityConstants.JAAS_CONTEXT_ROOT))
result = securityDomain.substring(SecurityConstants.JAAS_CONTEXT_ROOT.length());
else if (securityDomain.startsWith(SecurityConstants.JASPI_CONTEXT_ROOT))
result = securityDomain.substring(SecurityConstants.JASPI_CONTEXT_ROOT.length());
if (securityDomain.startsWith(JAAS_CONTEXT_ROOT))
result = securityDomain.substring(JAAS_CONTEXT_ROOT.length());
else if (securityDomain.startsWith(JASPI_CONTEXT_ROOT))
result = securityDomain.substring(JASPI_CONTEXT_ROOT.length());
else if (securityDomain.startsWith(LEGACY_JAAS_CONTEXT_ROOT))
result = securityDomain.substring(LEGACY_JAAS_CONTEXT_ROOT.length());
else
Expand Down

0 comments on commit e5e9b11

Please sign in to comment.