def setup(self): self.auth_header_test = AuthHeader() self.auth_header = self.auth_header_test.get(self.client) self.namespace = self.auth_header['X-Test-Namespace'] self.user = User.load(None, self.auth_header['X-User']) self.provisioner_id = None
def identity(payload): """ Read user_id from payload and return User. Args: payload (dict): Request payload Returns: user: detected user """ user_id = payload['identity'] try: user = User.load(None, user_id) except Exception: user = None return user