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:
@@ -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
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user