fix(webui): route missing API bootstrap tokens to auth

maintainer edit: handle review feedback by treating bootstrap responses without api_token as auth-required, and remove the obsolete issue_token(api_token=...) compatibility path now that API tokens are issued separately.
This commit is contained in:
chengyongru
2026-07-08 21:01:48 +08:00
committed by Xubin Ren
parent 444f488563
commit 4ddd639e67
6 changed files with 70 additions and 20 deletions
+1 -3
View File
@@ -42,12 +42,10 @@ class GatewayTokenStore:
return False
return True
def issue_token(self, ttl_s: int | float, *, api_token: bool = False) -> str:
def issue_token(self, ttl_s: int | float) -> str:
token_value = f"nbwt_{secrets.token_urlsafe(32)}"
expiry = time.monotonic() + float(ttl_s)
self.issued_tokens[token_value] = expiry
if api_token:
self.api_tokens[token_value] = expiry
return token_value
def issue_api_token(self, ttl_s: int | float) -> str: