MCPcopy
hub / github.com/cft0808/edict / _check_auth

Method _check_auth

dashboard/server.py:2392–2401  ·  view source on GitHub ↗

检查认证,未通过返回 True(已发送 401 响应)。

(self)

Source from the content-addressed store, hash-verified

2390 return False
2391
2392 def _check_auth(self):
2393 """检查认证,未通过返回 True(已发送 401 响应)。"""
2394 p = urlparse(self.path).path.rstrip('/')
2395 if not requires_auth(p):
2396 return False
2397 token = extract_token(self.headers)
2398 if not token or not verify_token(token):
2399 self.send_json({'ok': False, 'error': '未登录或会话已过期'}, 401)
2400 return True
2401 return False
2402
2403 def do_GET(self):
2404 p = urlparse(self.path).path.rstrip('/')

Callers 2

do_GETMethod · 0.95
do_POSTMethod · 0.95

Calls 4

send_jsonMethod · 0.95
requires_authFunction · 0.90
extract_tokenFunction · 0.90
verify_tokenFunction · 0.90

Tested by

no test coverage detected