On Tue, Jan 10, 2012 at 8:00 AM, Jonathan Barker
<jonathan.theit...@gmail.com> wrote:
> We are attempting to use PageTester with an application using
> tapestry-security, and are running into a problem on any secured
> pages, where there is no SecurityManager available.  I think I
> understand the problem, but I suspect that someone has already put in
> the effort to move from understanding to solution.
> Has anyone figured out how to provide a Shiro SecurityManager when
> using PageTester?

There was a previous thread on the same issue with some answers:
On Thu, Oct 27, 2011 at 10:38 AM, Kalle Korhonen
<kalle.o.korho...@gmail.com> wrote:
> The securityManager is bound to the executing thread. You'd need to
> invoke (Tapestry's) request processing pipeline to get it bound, or
> perhaps directly operate Tynamo's SecurityConfiguration directly to
> bind it. Any solution likely involves some hacking.

On Fri, Nov 25, 2011 at 4:54 PM, Robert Zeigler
<robert.zeig...@roxanemy.com> wrote:
> 1) Create your page tester instance: PageTester tester = new 
> PageTester("packagename","Appname","contextpath");
> 2) get the registry from the page tester : tester.getRegistry();
> 3) Get the RequestGlobals service from the registry: RequestGlobals globals = 
> registry.getService(RequestGlobals.class);
> 4) store your overrides: globals.storeServletRequestResponse(customRequest, 
> customResponse);
> You can use a mock framework (easymock, etc.) to make your life easier in 
> overriding the services servlet request/response.

What Robert says is pretty concrete, but I don't think storing the
request/response alone addresses the issue. It's very easy to bind the
securityManager to the thread:
org.apache.shiro.util.ThreadContext.bind(securityManager);

Unfortunately I haven't used PageTester together with security so I
don't have a guaranteed solution.

Kalle

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to