From b4bab95a954e7600b0427b86540db1706ffcad5b Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 2 May 2022 22:38:44 +0200 Subject: [PATCH] Publish AAAShiroFilter as a proper Filter service We do not really need WebContextSecurer to address these paths. Change-Id: Ie4258f2533e6eaa104ae2de0f2866e9ad04a10b2 Signed-off-by: Robert Varga --- .../aaa/shiro/filters/AAAShiroFilter.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/filters/AAAShiroFilter.java b/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/filters/AAAShiroFilter.java index 0045a2ddc..8eb825a04 100644 --- a/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/filters/AAAShiroFilter.java +++ b/aaa-shiro/impl/src/main/java/org/opendaylight/aaa/shiro/filters/AAAShiroFilter.java @@ -8,7 +8,13 @@ package org.opendaylight.aaa.shiro.filters; +import javax.servlet.Filter; import org.apache.shiro.web.servlet.ShiroFilter; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ServiceScope; +import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardFilterAsyncSupported; +import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardFilterName; +import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardFilterPattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -25,11 +31,15 @@ import org.slf4j.LoggerFactory; * * log:set DEBUG AAAShiroFilter * - * @see javax.servlet.Filter - * @see org.apache.shiro.web.servlet.ShiroFilter + * @see javax.servlet.Filter + * @see ShiroFilter */ -public class AAAShiroFilter extends ShiroFilter { - +// FIXME: @WebFilter? +@HttpWhiteboardFilterAsyncSupported +@HttpWhiteboardFilterPattern("/*") +@HttpWhiteboardFilterName("AAAShiroFilter") +@Component(service = Filter.class, scope = ServiceScope.PROTOTYPE) +public final class AAAShiroFilter extends ShiroFilter { private static final Logger LOG = LoggerFactory.getLogger(AAAShiroFilter.class); public AAAShiroFilter() { @@ -41,11 +51,11 @@ public class AAAShiroFilter extends ShiroFilter { * * Adds context clues that aid in debugging. * - * @see org.apache.shiro.web.servlet.ShiroFilter#init() + * @see ShiroFilter#init() */ @Override public void init() throws Exception { super.init(); - LOG.debug("Initializing the AAAShiroFilter"); + LOG.debug("AAAShiroFilter initialized"); } } -- 2.36.6