You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by hemilshah <he...@consult.nordea.com> on 2010/09/29 16:08:21 UTC

isPageAuthorized method runs infinitely

Hi,

I have a authorization mechanism in my application. I have a class which
extends Wicket AbstractPageAuthorizationStrategy class. It has a overridden
method isPageAuthorized() as required by Wicket to implement Authorization
logic. 

Now, if this method returns false then the functionality runs in infinite
loop. I am not sure why this is happening. Following is the code snippet -

protected boolean isPageAuthorized(final Class pageClass){

return isAuthorized((PubSession)Session.get(), pageClass);

}

public static boolean isAuthorized(PubSession ses, Class pageClass){

if (a = b) 
return false; // Here it runs in infinite loop

}

Please help me to solve this problem.

Thanks.
Regards,
Hemil
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/isPageAuthorized-method-runs-infinitely-tp2719086p2719086.html
Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.

Re: isPageAuthorized method runs infinitely

Posted by jcgarciam <jc...@gmail.com>.
Check that your Login / Homepage pages is not protected by the Authorization
mechanism as well.

On Thu, Sep 30, 2010 at 3:26 AM, hemilshah [via Apache Wicket] <
ml-node+2720237-1044583221-65838@n4.nabble.com<ml...@n4.nabble.com>
> wrote:

> Thats correct. Wicket does so the access denied page in case of
> Authorization Exception. But the problem for me is the infinite loop. When i
> am returning false from the isPageAuthorized method it runs into infinite
> loop. It seems that in case of false return, Wicket is invoking this method
> again. If this method returns true, then there is no problem.
>
> I need some clarification in overcoming this infinite loop issue if
> isPageAuthorized returns false.
>
> ------------------------------
>  View message @
> http://apache-wicket.1842946.n4.nabble.com/isPageAuthorized-method-runs-infinitely-tp2719086p2720237.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65838@n4.nabble.com<ml...@n4.nabble.com>
> To unsubscribe from Apache Wicket, click here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>
>


-- 
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/isPageAuthorized-method-runs-infinitely-tp2719086p2720645.html
Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.

Re: isPageAuthorized method runs infinitely

Posted by hemilshah <he...@consult.nordea.com>.
Thats correct. Wicket does so the access denied page in case of Authorization
Exception. But the problem for me is the infinite loop. When i am returning
false from the isPageAuthorized method it runs into infinite loop. It seems
that in case of false return, Wicket is invoking this method again. If this
method returns true, then there is no problem. 

I need some clarification in overcoming this infinite loop issue if
isPageAuthorized returns false.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/isPageAuthorized-method-runs-infinitely-tp2719086p2720237.html
Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.

Re: isPageAuthorized method runs infinitely

Posted by Martin Grigorov <mg...@apache.org>.
See http://wicketstuff.org/wicket/authorization/ for example.
Wicket throws org.apache.wicket.authorization.AuthorizationException and
shows AccessDeniedPage by default.

On Wed, Sep 29, 2010 at 4:59 PM, hemilshah <he...@consult.nordea.com>wrote:

>
> So does it mean that Wicket continuously keep authorizing the page unless
> it
> is not authorized. My purpose is to show a errorpage if its not authorized.
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/isPageAuthorized-method-runs-infinitely-tp2719086p2719185.html
> Sent from the Forum for Wicket Core developers mailing list archive at
> Nabble.com.
>

Re: isPageAuthorized method runs infinitely

Posted by hemilshah <he...@consult.nordea.com>.
So does it mean that Wicket continuously keep authorizing the page unless it
is not authorized. My purpose is to show a errorpage if its not authorized.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/isPageAuthorized-method-runs-infinitely-tp2719086p2719185.html
Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.

Re: isPageAuthorized method runs infinitely

Posted by Igor Vaynberg <ig...@gmail.com>.
probably the code redirects to login page, but the login page is not
authorized, so it redirects to login page, but the login page is not
authorized.

-igor

On Wed, Sep 29, 2010 at 7:08 AM, hemilshah
<he...@consult.nordea.com> wrote:
>
> Hi,
>
> I have a authorization mechanism in my application. I have a class which
> extends Wicket AbstractPageAuthorizationStrategy class. It has a overridden
> method isPageAuthorized() as required by Wicket to implement Authorization
> logic.
>
> Now, if this method returns false then the functionality runs in infinite
> loop. I am not sure why this is happening. Following is the code snippet -
>
> protected boolean isPageAuthorized(final Class pageClass){
>
> return isAuthorized((PubSession)Session.get(), pageClass);
>
> }
>
> public static boolean isAuthorized(PubSession ses, Class pageClass){
>
> if (a = b)
> return false; // Here it runs in infinite loop
>
> }
>
> Please help me to solve this problem.
>
> Thanks.
> Regards,
> Hemil
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/isPageAuthorized-method-runs-infinitely-tp2719086p2719086.html
> Sent from the Forum for Wicket Core developers mailing list archive at Nabble.com.
>