0

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.

Raghav Kukreja
  • 165
  • 2
  • 6
  • Use OAuth authentication for this. Java documentation is https://cloud.google.com/appengine/docs/java/oauth/ and Frontend code for this is https://cloud.google.com/appengine/docs/java/endpoints/consume_js – Arun Shinde Apr 01 '16 at 13:06
  • @arun-shinde How will I be able to create different logins for different types of users? I mean....won't OAuth provide a single platform for all the users to login? – Raghav Kukreja Apr 01 '16 at 13:11
  • OAuth is basically for security purpose. Give user roles based on user email at your backend. – Arun Shinde Apr 01 '16 at 13:21
  • @arun-shinde I was looking at Apache Shiro for doing the same. Will that work? – Raghav Kukreja Apr 01 '16 at 14:08
  • I never tried this. But make sure that Google App Engine is Paas type. Google restricted most of the functionalities for security purpose. – Arun Shinde Apr 01 '16 at 14:12
  • 1
    Welcome to stackoverflow. see [how to write a good stackoverflow question](http://stackoverflow.com/help/how-to-ask) you need to do a lot more reading and trying beforehand. – Zig Mandel Apr 01 '16 at 14:15

1 Answers1

0

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.

Yoram
  • 572
  • 6
  • 21