I'm writing an application with Google Web Toolkit and am trying to figure out the Google Apps domain of the user currently logged in.
public LoginInfo login(String requestUri) {
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
LoginInfo loginInfo = new LoginInfo();
if (user != null) {
loginInfo.setLoggedIn(true);
loginInfo.setEmailAddress(user.getEmail());
loginInfo.setNickname(user.getNickname());
loginInfo.setAuthDomain(user.getAuthDomain());
loginInfo.setLogoutUrl(userService.createLogoutURL(requestUri));
loginInfo.setIsAdmin(userService.isUserAdmin());
} else {
loginInfo.setLoggedIn(false);
loginInfo.setLoginUrl(userService.createLoginURL(requestUri));
}
return loginInfo;
}
But user.getAuthDomain() is always returning "gmail.com".
which should be correct for non-google-apps-users. But it also returns gmail.com when I log in with my google apps account.
Any ideas why? Or is there an other method to get the users current domain?