You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken in Nashua <kc...@live.com> on 2013/04/25 15:57:22 UTC

logout taking me to home instead of login

Hi Folks,

I believe my webapp is wired up properly. But not so when I click logout link.

Here is my logout link handler.

    @InjectPage("Login")
    private Login loginPage;

    Object onActionFromTynamoLogoutLink() {
        // Need to call this explicitly to invoke onlogout handlers (for
        // remember me etc.)
        SecurityUtils.getSubject().logout();
        try {
            // the session is already invalidated, but need to cause an
            // exception since tapestry doesn't know about it
            // and you'll get a container exception message instead without
            // this. Unfortunately, there's no way of
            // configuring Shiro to not invalidate sessions right now. See
            // DefaultSecurityManager.logout()
            // There's a similar issues in Tapestry - Howard has fixed, but no
            // in T5.2.x releases yet
            request.getSession(false).invalidate();
        } catch (Exception e) {
        }

        return loginPage;
    }

I have yet to see it take me to Login on clicking my logout link on my home page.

USE CASE: So... if while the app is up and running at Home page... I click logout link, it takes me to Home page and I get NPE for referring to what become null structures in my home template.

USE CASE: But... if while the app is up and running at Home page... I click the URL http://localhost:9011/pphl/login i am brought to login page in its inverted form which shows the same logout link <t:actionlink t:id="tynamoLogoutLink">Logout</t:actionlink> and when I click that same structured link as the same one in my home page, this one takes me back to the login page like its suppose to.

I have these configured
        configuration.add(SecuritySymbols.LOGIN_URL, "/" + PATH_PREFIX + "/login");
        configuration.add(SecuritySymbols.SUCCESS_URL, "/home");
        configuration.add(SecuritySymbols.UNAUTHORIZED_URL, "/" + PATH_PREFIX + "/unauthorized");


Is there a deficiency in tapestry preventing me from gracefully operating the first USE CASE ?


Thanks for any tips.

Ken
 		 	   		  

RE: logout taking me to home instead of login

Posted by Ken in Nashua <kc...@live.com>.
George,

Thanks friend... that worked terrific. I used both annotations

@RequiresAuthentication
@RequiresUser
 		 	   		  

Re: logout taking me to home instead of login

Posted by George Christman <gc...@cardaddy.com>.
Do you have security associated with the home page? That might be needed to
force the redirection and eliminate your NP. I have the following
configuration,

 @RequiresUser added to my index page.

App Module

configuration.add(SecuritySymbols.LOGIN_URL, "/login");

Logout Action

Class onActionFromLogout() {
        // Need to call this explicitly to invoke onlogout handlers (for
remember me etc.)
        SecurityUtils.getSubject().logout();
        try {
                // the session is already invalidated, but need to cause an
exception since tapestry doesn't know about it
                // and you'll get a container exception message instead
without this. Unfortunately, there's no way of
                // configuring Shiro to not invalidate sessions right now.
See DefaultSecurityManager.logout()
                // There's a similar issues in Tapestry - Howard has fixed,
but no in T5.2.x releases yet
                request.getSession(false).invalidate();
        } catch (Exception e) {
        }
        return Index.class;
    }



On Thu, Apr 25, 2013 at 10:10 AM, Ken in Nashua <kc...@live.com> wrote:

> The logout handlers are virtually identical for HOME and LOGIN pages
>
> Here is the HOME one...
> http://localhost:9011/pphl/home.layout.loginlink.tynamologoutlink
>
> Here is the LOGIN one for the URL on my browser bar
> http://localhost:9011/pphl/login.tynamologoutlink
>
> Can anyone explain why the HOME link keeps bringing me home instead of
> back to LOGIN ?
>
> Thank You
>




-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

RE: logout taking me to home instead of login

Posted by Ken in Nashua <kc...@live.com>.
The logout handlers are virtually identical for HOME and LOGIN pages

Here is the HOME one...  
http://localhost:9011/pphl/home.layout.loginlink.tynamologoutlink

Here is the LOGIN one for the URL on my browser bar
http://localhost:9011/pphl/login.tynamologoutlink

Can anyone explain why the HOME link keeps bringing me home instead of back to LOGIN ?

Thank You