diff options
author | Martin Polden <mpolden@mpolden.no> | 2018-02-22 11:00:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-22 11:00:59 +0100 |
commit | bf8625d8ad5c371d4247590d21a179c0c092a3d4 (patch) | |
tree | 7b93e6cc6588eda074bab85a5b8ef743f835fb1d /controller-server/src/main | |
parent | 1e7d98b23ae6b97734e1248c6028075f9b3f5d2e (diff) | |
parent | 33477b7b83c33dab18ded974a8afbcfaaf9918ca (diff) |
Merge pull request #5110 from vespa-engine/bjorncs/remove-security-context
Remove unused SecurityContext wiring
Diffstat (limited to 'controller-server/src/main')
4 files changed, 0 insertions, 104 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/securitycontext/CreateSecurityContextFilter.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/securitycontext/CreateSecurityContextFilter.java deleted file mode 100644 index 5fc15f4baa6..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/securitycontext/CreateSecurityContextFilter.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.controller.restapi.filter.securitycontext; - -import com.yahoo.jdisc.handler.ResponseHandler; -import com.yahoo.jdisc.http.filter.DiscFilterRequest; -import com.yahoo.jdisc.http.filter.SecurityRequestFilter; -import com.yahoo.vespa.hosted.controller.common.ContextAttributes; -import com.yahoo.yolean.chain.After; -import com.yahoo.yolean.chain.Provides; - -import javax.ws.rs.core.SecurityContext; -import java.security.Principal; - -/** - * Exposes the security information from the disc filter request - * by storing a security context in the request context. - * - * @author Tony Vaagenes - */ -@After("BouncerFilter") -@Provides("SecurityContext") -@SuppressWarnings("unused") // Injected -@Deprecated -// TODO Remove once Bouncer filter is gone -public class CreateSecurityContextFilter implements SecurityRequestFilter { - - @Override - public void filter(DiscFilterRequest request, ResponseHandler handler) { - request.setAttribute(ContextAttributes.SECURITY_CONTEXT_ATTRIBUTE, - new SecurityContext() { - @Override - public Principal getUserPrincipal() { - return request.getUserPrincipal(); - } - - @Override - public boolean isUserInRole(String role) { - return request.isUserInRole(role); - } - - @Override - public boolean isSecure() { - return request.isSecure(); - } - - @Override - public String getAuthenticationScheme() { - throw new UnsupportedOperationException(); - } - }); - } - -} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/securitycontext/PropagateSecurityContextFilter.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/securitycontext/PropagateSecurityContextFilter.java deleted file mode 100644 index 23f94f2fc21..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/securitycontext/PropagateSecurityContextFilter.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.controller.restapi.filter.securitycontext; - -import com.yahoo.vespa.hosted.controller.common.ContextAttributes; - -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerRequestFilter; -import javax.ws.rs.container.PreMatching; -import javax.ws.rs.core.SecurityContext; -import javax.ws.rs.ext.Provider; -import java.io.IOException; - -/** - * Get the security context from the underlying Servlet request, and expose it to - * Jersey resources. - * - * @author Tony Vaagenes - */ -@PreMatching -@Provider -// TODO Remove once Bouncer filter is gone -@Deprecated -public class PropagateSecurityContextFilter implements ContainerRequestFilter { - @Override - public void filter(ContainerRequestContext requestContext) throws IOException { - SecurityContext securityContext = - (SecurityContext) requestContext.getProperty(ContextAttributes.SECURITY_CONTEXT_ATTRIBUTE); - - if (securityContext != null) { - requestContext.setSecurityContext(securityContext); - } - } -} diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/securitycontext/package-info.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/securitycontext/package-info.java deleted file mode 100644 index 0b98599dbb0..00000000000 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/filter/securitycontext/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -/** - * Jersey requires that the package is exported to be able to instantiate the filter. - * - * @author Tony Vaagenes - */ -@ExportPackage -package com.yahoo.vespa.hosted.controller.restapi.filter.securitycontext; - -import com.yahoo.osgi.annotation.ExportPackage; diff --git a/controller-server/src/main/resources/WEB-INF/web.xml b/controller-server/src/main/resources/WEB-INF/web.xml deleted file mode 100644 index f294a8eb46e..00000000000 --- a/controller-server/src/main/resources/WEB-INF/web.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0"?> -<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<jdisc-config> - <init-param> - <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name> - <param-value>com.yahoo.vespa.hosted.controller.restapi.filter.securitycontext.PropagateSecurityContextFilter</param-value> - </init-param> -</jdisc-config> |