We also did the validation for authenticating users in backend module(Google cloud module) following the below reference,
https://cloud.google.com/appengine/docs/java/endpoints/add-authorization-backend.
And also we picked the authentication option as Google Apps domain. And also we did the below configuration in
console.cloud.google.com,(Google app engine->Setting->Authentication->Google apps domain->mycompany.com)
We followed the below reference for client application(android app) to make API call,
https://cloud.google.com/appengine/docs/java/endpoints/calling-from-android.
Now we are expecting like the login success will happen only the registered Google apps domain users (Ex:us...@mycompany.com). But all the google account users getting success login.
So kindly provide you advice to make the expected workflow.
import com.google.appengine.api.users.User;
import com.google.api.server.spi.config.Api;
import com.google.api.server.spi.config.ApiMethod;
import javax.servlet.http.HttpServletRequest;
import com.google.appengine.api.users.User; // Need this import when using Google Apps Domain auth
@Api(name = "myApi", version = "v1")
public class TestAPI {
@ApiMethod(name = "test")
public Response test(HttpServletRequest request, User user, BodyParams params) {
Response response = new Response();
if (user == null) {
response.setEmail("unauthorized");
return response;
}
// Do something with the 'request' parameter
// Do something with the 'params' resource parameter
response.setEmail(user.getEmail());
return response;
}
}