def token_permission_check(self, request): signature = request.META.get('HTTP_SIGNATURE') timestamp = request.META.get('HTTP_TIMESTAMP') app_name = request.META.get('HTTP_APPNAME') if not app_name: return False, '未提供appname(调用loonflow接口需要鉴权,请根据文档中"调用授权"部分说明来调用)' app_token_obj, msg = AccountBaseService.get_token_by_app_name(app_name) if not app_token_obj: return False, 'appname未授权,请联系管理员(调用loonflow接口需要鉴权,请根据文档中"调用授权"部分说明来调用)' # rgc:修改 获取 username的方式 # return CommonService.signature_check(timestamp, signature, app_token_obj.token) method = request.method if method == 'GET': username = request.GET.get('username', '') elif method == 'POST': username = json.loads(str(request.body, encoding='utf-8')).get('username', '') else: username = json.loads(str(request.body, encoding='utf-8')).get('username', '') logger.info('url path is :{},method is {},username is:{}'.format(request.path, method, username)) if username: request.META.update(dict(HTTP_USERNAME=username)) return True, ''
def tocket_permission_check(self, request): signature = request.META.get('SIGNATURE') timestamp = request.META.get('TIMESTAMP') app_name = request.META.get('APPNAME') if not app_name: return False, '未提供appname' app_token, msg = AccountBaseService.get_token_by_app_name(app_name) if not app_token: return False, 'appname未授权,请联系管理员' return CommonService.signature_check(timestamp, signature, app_token)
def token_permission_check(self, request): signature = request.META.get('HTTP_SIGNATURE') timestamp = request.META.get('HTTP_TIMESTAMP') app_name = request.META.get('HTTP_APPNAME') if not app_name: return False, '未提供appname(调用loonflow接口需要鉴权,请根据文档中"调用授权"部分说明来调用)' app_token_obj, msg = AccountBaseService.get_token_by_app_name(app_name) if not app_token_obj: return False, 'appname未授权,请联系管理员(调用loonflow接口需要鉴权,请根据文档中"调用授权"部分说明来调用)' return CommonService.signature_check(timestamp, signature, app_token_obj.token)