GAE(google app engine)でアプリを開発しています。このアプリは、ユーザーがいくつかのリソースにアクセスするために使用できるチャット ボットです。個人情報を管理しているため、アプリIDを知っているユーザーがそのチャットボットを連絡先に追加できないようにしたいので、自分のドメインアカウントだけにアクセスを制限したいのが問題です。GAE のドキュメントを読み、これ (https://developers.google.com/appengine/docs/python/xmpp/overview#Handling_Subscriptions) を見つけましたが、適用方法がよくわかりません。私はこのようなことをしました:
class SuscribeHandler(webapp.RequestHandler):
def post(self):
sender = self.request.get('from').split('/')[0]
domain = sender.split("@")[1]
if domain == "mydomain.com":
#Add contact code goes here
app = webapp.WSGIApplication([
('/_ah/xmpp/subscription/subscribe/', SuscribeHandler),
], debug=True)