Hi all,

I have an embedded Jetty application that has two servlets - the "admin" and
the "application" servlet. I've programmatically added the ShiroFilter to
the ServletContext using code like this:

        handler.addEventListener(new SMFEnvironmentLoaderListener(this));

        final FilterHolder holder = new FilterHolder(ShiroFilter.class);
        handler.getServletHandler().addFilter(holder);

        FilterRegistration.Dynamic reg = holder.getRegistration();
        reg.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class),
true, SECURED_URL_PATH);

SECURED_URL_PATH is set to "/*". SMFEnvironmentLoaderListener is a simple
subclass of EnvironmentLoaderListener that allows me to pass in my
configuration data and use it in building the rest of the infrastructure of
my filters.

The problem I'm having is that the ShiroFilter's doFilter method is
attempting to path match the application-relative path provided by the user
(e.g., /preferences/query) with the global path specification I coded in as
the match path for the filter (e.g., /smf/**).

I'm having a devil of a time figuring out how to configure ShiroFilter so it
matches properly both types of paths and redirects to the appropriate ssl
port. I've configured my filter to redirect to https on a port specific to
the context, but I can't get the paths to match now. When it was all
configured to use the same root path - /** - it worked fine, but redirected
all requests - both admin and application to the application ssl port. There
was no obvious way to differentiate. 

Ideally, I'd differentiate on inbound port - if the inbound port was (for
instance) 8080, I'd redirect to 8443, but if 8081, then to 8444. I've looked
until my eyes burn, but there just doesn't seem to be a way to configure
ShiroFilter to redirect based on inbound port - only on app context. Thus,
I've configured different contexts, and now path matching is broken.

Any help would be much appreciated. I'm dead in the water until I get some
input.

Thanks,
John



--
View this message in context: 
http://shiro-user.582556.n2.nabble.com/Configuring-ShiroFilter-for-multiple-app-paths-tp7580432.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to