Has anyone been successful at getting Shiro (1.2.1) integrated into
Dropwizard (0.6.1)? I've been using DW for prototyping and my company is
considering it for production environments, but role-based access is a
requirement.

My understanding is that I need to use Guice as a bridge between the two, so
I started with the example project for dropwizard-guice
(https://github.com/eliast/dropwizard-guice-example). I've added a basic
shiro.ini [one user, one role], pulled in shiro-guice and shiro-web
dependencies, and set up the following additional classes:

* ShiroSecurityModule: extends ShiroWebModule; identical to the first code
block in http://shiro.apache.org/guice.html#guice-web except with a single
filter chain for /**, ANON
* RootModule: extends com.google.inject.servlet.ServletModule; in
configureServlets() I install ShiroSecurityModule [passing
getServletContext() as constructor arg] and HelloWorldModule, then
filter("/*").through(GuiceShiroFilter.class)

When I attempt to run the service, the following errors come up:

* Scope ServletScopes.REQUEST is already bound to
com.google.inject.servlet.RequestScoped. Cannot bind ServletScopes.REQUEST.
  at
com.google.inject.servlet.InternalServletModule.configure(InternalServletModule.java:77)
* (same error but for ServletScopes.SESSION)
* Binding to null instances is not allowed. Use
toProvider(Providers.of(null)) if this is your intended behaviour.
  at
org.apache.shiro.guice.web.ShiroWebModule.configureShiro(ShiroWebModule.java:120)

I'm new to both Shiro and Guice, so I have little idea of where these issues
might have arisen. If anyone has guidance or insight, please let me know!
I'm also willing to talk about alternatives such as using Stormpath, using
something other than Guice for Shiro's AOP needs, or anything else that
could get me where I need to go.

Cheers, Andrew



--
View this message in context: 
http://shiro-user.582556.n2.nabble.com/Dropwizard-Shiro-integration-tp7578261.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to