I've read that Google App Engine (GAE) provides user authentication using Google Accounts. My app caters to 3 different user types with different functionalities for all. I'm not able to figure out how do I proceed with setting up such a backend. I'm building the app in Java and for the front-end, I'll be using AngularJS.
Please help me proceed in the right direction.
Google App Engine only distinguishes between two types of users. An admin user and a regular user. You can check if the current logged in user is admin or not by:
UserService userService = UserServiceFactory.getUserService();
if(!userService.isUserLoggedIn() {
// No user is logged in (guest)
}
else if(userService.isUserAdmin()) {
// Admin user
}
else {
User user = userService.getCurrentUser();
}
There are some java libraries you can use with GAE that can provide a roles based framework. One such framework that optimized for GAE is Jello Framework.
One of Jello's key features is its inline Authorization Model. With Jello you can assign different access levels for data elements at any resolution (Namespaces, Entities, Fields, Actions) and specify who is authorized to access the data via the REST API.