feat(auth): implement site-based passcode-to-JWT endpoint

- Add POST /api/authenticate_passcode to verify site access codes
- Refactor sign_jwt to support arbitrary role flags (super, admin, etc.)
- Update dependencies_v3 to extract role flags from JWT payloads
- Add E2E test for passcode auth verification
This commit is contained in:
Scott Idem
2026-01-20 17:51:54 -05:00
parent e16fbaa34b
commit d4e46a4a97
4 changed files with 183 additions and 3 deletions

View File

@@ -89,13 +89,22 @@ def get_account_context_optional(
resolved_account_id_random = '--- NO ACCOUNT ---'
auth_method = 'bypass'
is_admin = (auth_method == 'bypass')
is_manager = (auth_method == 'bypass')
is_super = (auth_method == 'bypass')
if resolved_token_payload:
if resolved_token_payload.get('administrator'): is_admin = True
if resolved_token_payload.get('manager'): is_manager = True
if resolved_token_payload.get('super'): is_super = True
return AccountContext(
account_id=resolved_account_id,
account_id_random=resolved_account_id_random,
auth_method=auth_method,
administrator=(auth_method == 'bypass'),
manager=(auth_method == 'bypass'),
super=(auth_method == 'bypass'),
administrator=is_admin,
manager=is_manager,
super=is_super,
token_payload=resolved_token_payload
)