Reputation: 232
Is it possibile to allow requests to a gae endpoint method only from a specific domain (e.g. www.myname.com) and refuse everything else?
I'm looking for something like an app authentication (I don't want a user login)
many thanks
Upvotes: 0
Views: 189
Reputation: 8806
You could try out the following approach:
Inject the HTTPServletRequest
parameter into your APIMethod.
@ApiMethod(path = "resources/{id}")
public Resource get(@Named("id") int id, HttpServletRequest request) {
//Use the request parameter here...
}
From the request parameter above, use the following:
String host = request.getRemoteHost();
Keep in mind that the host value can be your client or proxy's host name.
Upvotes: 1