You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Peter Munro <sp...@gmail.com> on 2010/10/06 14:53:36 UTC

Authorization using PageParameters

Hi all,

I'm confused... I'd like to setup authorization for a page, where the
authorization decision is based on the parameters passed to the page. For
example, http://blahblah/MyPage/?date=2010-10-06 would authorize correctly
(show the page), but previous dates would not.

Subclassing MyAuthorisationStrategy and overriding isPageAuthorized(final
Class<T> pageClass) doesn't work, since I don't get passed the page
parameters.

What's the best way?

Many thanks,
Peter

Re: Authorization using PageParameters

Posted by Eike Kettner <ne...@eknet.org>.
Hi Peter,

this probably not the best way, I don't know, but I would start with
throwing an UnauthorizedInstantiationException in my page constructor.

regards,
Eike

On [Wed, 06.10.2010 13:53], Peter Munro wrote:
> Hi all,
> 
> I'm confused... I'd like to setup authorization for a page, where the
> authorization decision is based on the parameters passed to the page. For
> example, http://blahblah/MyPage/?date=2010-10-06 would authorize correctly
> (show the page), but previous dates would not.
> 
> Subclassing MyAuthorisationStrategy and overriding isPageAuthorized(final
> Class<T> pageClass) doesn't work, since I don't get passed the page
> parameters.
> 
> What's the best way?
> 
> Many thanks,
> Peter

-- 
email: eike@eknet.org   https://www.eknet.org  pgp: 481161A0

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Authorization using PageParameters

Posted by Peter Munro <sp...@gmail.com>.
Huge thanks to both Eike and Martin.

They both work, so I'm figuring out the best approach. I'll probably go with
Martin's.
BTW, for anyone googling the archive, either:

   - WebRequestCycle.get().getPageParameters(), or
   - WebRequestCycle.get().getRequest().getParameter("myparam")

will do the trick.

Thanks again,
Peter


On Wed, Oct 6, 2010 at 2:32 PM, Martin Grigorov <mg...@apache.org>wrote:

> Try with WebRequestCycle.get().getWebRequest().getParameters() or something
> like that.
>
> On Wed, Oct 6, 2010 at 2:53 PM, Peter Munro <sp...@gmail.com> wrote:
>
> > Hi all,
> >
> > I'm confused... I'd like to setup authorization for a page, where the
> > authorization decision is based on the parameters passed to the page. For
> > example, http://blahblah/MyPage/?date=2010-10-06 would authorize
> correctly
> > (show the page), but previous dates would not.
> >
> > Subclassing MyAuthorisationStrategy and overriding isPageAuthorized(final
> > Class<T> pageClass) doesn't work, since I don't get passed the page
> > parameters.
> >
> > What's the best way?
> >
> > Many thanks,
> > Peter
> >
>

Re: Authorization using PageParameters

Posted by Martin Grigorov <mg...@apache.org>.
Try with WebRequestCycle.get().getWebRequest().getParameters() or something
like that.

On Wed, Oct 6, 2010 at 2:53 PM, Peter Munro <sp...@gmail.com> wrote:

> Hi all,
>
> I'm confused... I'd like to setup authorization for a page, where the
> authorization decision is based on the parameters passed to the page. For
> example, http://blahblah/MyPage/?date=2010-10-06 would authorize correctly
> (show the page), but previous dates would not.
>
> Subclassing MyAuthorisationStrategy and overriding isPageAuthorized(final
> Class<T> pageClass) doesn't work, since I don't get passed the page
> parameters.
>
> What's the best way?
>
> Many thanks,
> Peter
>