def test_payload(self): app = AppSignatureAuthHandler( "app-b9p6qxqj", "jimLjavU3uQAGxrv6FkeJKd58ieRiuWeVtilFl7V") extracted_payload = app.extract_payload( "eyJsYW5nIjoiemgtY24iLCJ1c2VyX2lkIjoidXNyLWluZWE5dzdaIiwiem9uZSI6ImFsbGlub25lIiwiYWNjZXNzX3Rva2VuIjoiYWhacEhCOFZ2aUJ1bXB0YTBHeTZGMUFDUFNtbkZNeGsiLCJleHBpcmVzIjoiMjAxNS0wMS0yOFQwOTozNTozNFoiLCJhY3Rpb24iOiJ2aWV3X2FwcCJ9", "3k-0pqvAjf5BvFtssV3_2t_KBkesEpYEmesv3O5sJeI") self.assertIsNotNone(extracted_payload)
def __init__(self, payload, signature): auth = AppSignatureAuthHandler(settings.APP_ID, settings.SECRET_APP_KEY) access_info = auth.extract_payload(payload, signature) if not access_info: raise AuthException("Incorrect signature") self.zone = access_info["zone"] self.conn = AppConnection(settings.APP_ID, settings.SECRET_APP_KEY, access_info["zone"], access_token=access_info["access_token"])
def __init__(self, payload, signature): auth = AppSignatureAuthHandler(settings.APP_ID, settings.SECRET_APP_KEY) self.req = auth.extract_payload(payload, signature) if not self.req: raise AuthException("Incorrect signature") self.zone = self.req["zone"] self.conn = self.get_connection(self.req.get("access_token"), self.zone) self.app_action = self.req["action"] self.is_notification = True self.handle_map = { "view_app": self.view_app, "install_app": self.install_app, "uninstall_app": self.uninstall_app, "suspend_resource": self.suspend_resource, "resume_resource": self.resume_resource, "terminate_resource": self.terminate_resource }
def setUp(self): super(AppAuthTestCase, self).setUp() self.app = AppSignatureAuthHandler(APP_ID, APP_KEY)