This commit is contained in:
Timothy Jaeryang Baek
2026-08-24 18:38:29 -04:00
parent 9dff5e9327
commit 97466deea1
5 changed files with 26 additions and 30 deletions
+13
View File
@@ -20,6 +20,19 @@ log = logging.getLogger(__name__)
USER_GROUPS_PLACEHOLDERS = ('{{USER_GROUPS}}', '{{USER_GROUP_IDS}}')
def normalize_bearer_token(token: Any) -> str:
return token.strip() if isinstance(token, str) else token or ''
def bearer_auth_header(token: Any) -> dict[str, str]:
token = normalize_bearer_token(token)
return {'Authorization': f'Bearer {token}'} if token else {}
def get_json_bearer_headers(token: Any = '') -> dict[str, str]:
return {'Content-Type': 'application/json', **bearer_auth_header(token)}
def _mint_forward_user_jwt(user: Any) -> str:
now = int(time.time())
payload = {