Skip to content

Instantly share code, notes, and snippets.

@prb
Last active December 15, 2015 05:39
Show Gist options
  • Save prb/5211125 to your computer and use it in GitHub Desktop.
Save prb/5211125 to your computer and use it in GitHub Desktop.
Minimal integration of Shiro as a filter in front of a Dropwizard application.
environment.setSessionHandler(new SessionHandler());
AbstractShiroFilter sf = new AbstractShiroFilter() { };
IniWebEnvironment iwe = new IniWebEnvironment();
iwe.init();
sf.setSecurityManager(iwe.getWebSecurityManager());
sf.setFilterChainResolver(iwe.getFilterChainResolver());
environment.addFilter(sf,"/*").setName("shiro-filter");
@prb
Copy link
Author

prb commented Mar 21, 2013

Presumes use of .ini-style configuration in one of the usual locations. Extends AbstractShiroFilter to get a concrete class without the dependence on hardwired initialization that comes with ShiroFilter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment