Get the userService object from the UserServiceFactory class in
google app engine api. Invoke the getCurrentUser() method in
userService object. Check whether the user is alive or not. if user
is alive call the createLogoutURL(pass_your_ logout_ url), or call the
createLoginURL(pass_your _login _url) in UserService object.
S. Abraham
www.DataStoreGwt.com
Persist objects directly in Google App Engine
//In Jsp page
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
<%
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
%>
<%if (user != null) {%>
<a href="<%= userService.createLogoutURL(request.getRequestURI())
%>">
Sign out <%=user.getNickname()%>
</a>
<%} else {%>
<a href="<%= userService.createLoginURL(request.getRequestURI())
%>">
Sign in
</a>
<%}%>
On Oct 18, 12:26 pm, Miguel <[email protected]> wrote:
> I don't understand if it is a bug or I am doing something wrong ..
>
> I am using the federated login: when I logout from Google I still
> remain logged in my web-application.
>
> I do the authentication in that way .. Is it wrong?
>
> UserService userService = UserServiceFactory.getUserService();
> User loggedUser = userService.getCurrentUser();
> ..
> if(loggedUser!=null) {
> ..
>
> } else {
> ..
> }
>
> Even if I am logged out by google the "loggedUser" I cannot pass by
> the "else" statement. The loggedUser is always different from null ..
>
> Why? What am I doing wrong?
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" 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-appengine-java?hl=en.