I can give you what I did in my application. Maybe that you will prefer this
method :

* When the application loads, the server store a login/logout status of the
user in a json format (just for optimization like this :
http://code.google.com/intl/fr/webtoolkit/articles/dynamic_host_page.html. You
can make an init query to the server to get the status instead of the
previous method, but it is a bit slower)

* My login/logout link is inside its own activity and it has its own
activity manager too.
* I send a new LoginStatusEvent(boolean login) when my status is updated and
it is handled by my Login/Logout activity.
* When user successfully login or logout, I send a new LoginStatusEvent.
* On server side, I use a security framework that check permission on rpc
call. If user is not logged in (session has expired) but want to access to a
"secured method" -> I throw a special remote exception. This exceptions is
handled by a custom AsyncCallback that will redirects the user to a login
page + sends a new LoginStatusEvent(false)

Tell me if this is not clear.

Nicolas.

2010/11/9 koma <[email protected]>

> Hi GWT gurus,
>
> Learning the new GWT 2.1 framework and I got security up&running on my
> GAE application.
> Now working with the new Activities/Places.
>
> My applicaiton will have a login/logout link in the top right of the
> website/app.
>
> How do I keep this link in sync with the security status of the
> current visitor/user.
> Will every activity have to check for the status of the of current
> user ?
>
> Do I create a super class AbstractMyApplicationActivity that
> implements this functionality and then call this in start() for each
> child activity ?
>
> like this
> public AbstractMyApplicationActivity extends AbstractActivity {
>    public void updateLoginLogoutLink() {
>       // set the login/logout link correctly
>    }
> }
>
> public SomeActivity extends AbstractMyApplicationActivity {
>    public void start(AcceptsOneWidget containerWidget, EventBus
> eventBus)  {
>     updateLoginLogoutLink()
>     ... some other activity specific stuff.
>    }
> }
>
> Is there a more elegant pattern for implementing this? Now the
> responsibility of making this calling is present in every activity....
> feels uncomfortable;
>
> thx,
>
> koen
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to