Java Reference
In-Depth Information
loginInfo.setNickname(user.getNickname());
loginInfo.setEmailAddress(user.getEmail());
} else {
loginInfo.setLoggedIn(false);
loginInfo.setLoginUrl(userService.createLoginURL(requestUri));
}
return loginInfo;
}
}
Modifying the Deployment Descriptor
In your LoginService class you defined the “login” path annotation. Now you need to
add this definition to the deployment descriptor in Listing 6-6. You can also remove
the reference to greetServlet since it is not needed.
Listing 6-6. Servlet configuration to be added to the deployment descriptor
<servlet>
<servlet-name>loginService</servlet-name>
<servlet-class>com.appirio.timeentry.server.LoginServiceImpl</servlet-
class>
</servlet>
<servlet-mapping>
<servlet-name>loginService</servlet-name>
<url-pattern>/timeentry/login</url-pattern>
</servlet-mapping>
Modifying the User Interface
Now that your login RPC framework is in place, you need to tweak the client to allow
it to use your new authentication functionality. Currently, when your users load the
application, your timecard UI is immediately available. You need to change the flow
of the application to load the timecard UI if the user is already logged in or to redirect
them to the sign-in page if they are not. Once they sign-in with their Google account,
you'll still need to make a check to ensure that they are indeed authenticated.
You'll need to do some refactoring in TimeEntry.java to accomplish these tasks. In
Listing 6-7 you'll move the call to load the UI from the onModuleLoad method to a new
 
Search WWH ::




Custom Search