shiro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filipe Sousa <nat...@gmail.com>
Subject Re: Guice + Shiro + GWT
Date Fri, 05 Aug 2011 11:32:02 GMT
Hi.

I didn't know there was a guice module being developed for shiro

I'm trying the examples on the documentation but I'm getting a warning

Aug 5, 2011 12:28:49 PM
com.google.inject.servlet.InternalServletModule$BackwardsCompatibleServletContextProvider
get
WARNING: You are attempting to use a deprecated API (specifically,
attempting to @Inject ServletContext inside an eagerly created
singleton. While we allow this for backwards compatibility, be warned
that this MAY have unexpected behavior if you have more than one
injector (with ServletModule) running in the same JVM. Please consult
the Guice documentation at
http://code.google.com/p/google-guice/wiki/Servlets for more
information.

public class GuiceListener extends GuiceServletContextListener {
	private ServletContext servletContext;

	@Override
	protected Injector getInjector() {
		return Guice.createInjector(DEVELOPMENT, new
MyShiroWebModule(servletContext), new MyApplicationModule());
	}

	@Override
	public void contextInitialized(ServletContextEvent servletContextEvent) {
		servletContext = servletContextEvent.getServletContext();
		super.contextInitialized(servletContextEvent);
	}
}

public class MyShiroWebModule extends ShiroWebModule {
	public MyShiroWebModule(ServletContext servletContext) {
		super(servletContext);
	}

	@Override
	protected void configureShiroWeb() {
		bindRealm().to(IpbRealm.class);
		addFilterChain("/**", AUTHC_BASIC);
	}
}

public class MyApplicationModule extends ServletModule {
	@Override
	protected void configureServlets() {
		bind(Context.class).to(InitialContext.class);
		bind(DataSource.class).toProvider(fromJndi(DataSource.class, "jdbc/rad"));
	}
}


On Thu, Aug 4, 2011 at 11:38 PM, Jared Bunting
<jared.bunting@peachjean.com> wrote:
> I don't know much about GWT, but I can help you with basic Guice
> integration.
>
> The current release of Shiro (1.1.0) doesn't have Guice support, but the
> trunk codebase does (1.2.0-SNAPSHOT).  To get started, have a look at the
> documentation here: http://shiro.apache.org/guice.html.
>
> Once you've done that, I'd be happy to answer any more specific questions
> that you may have.
>
> -Jared
>
> On 08/04/2011 05:15 PM, Fabricio Pizzichillo wrote:
>
> hello friends.
> I am a beginner with shiro. I'm trying to integrate with an
> application developed with GWT + Guice + Postgresql. Can be oriented on how
> to configure the servlet Guice as authenticating users database?
> Thank you very much and greetings
>



-- 
Filipe Sousa

Mime
View raw message