north-scape/relayboard

Relayboard: accessible team boards with audited actions, dependency maps, and shared web/MCP use cases.

A remix template · 0 remixes · Remix north-scape/relayboard

app/boards/doors/identity.py

"""The configured Dodil gateway strips forged headers and inserts appid identity.
Never expose the raw container port publicly. No local login bypass is shipped.
"""
import json
from boards.domain.model import Person

def person_from(headers):
    raw=headers.get('x-dodil-user')
    if not isinstance(raw,str) or len(raw)>16384: return None
    try: user=json.loads(raw)
    except (ValueError,TypeError): return None
    if not isinstance(user,dict): return None
    # Membership is bound to appid email, not an arbitrary subject id supplied as email.
    email=user.get('email')
    if not isinstance(email,str) or not email.strip() or len(email)>254: return None
    return Person(email.strip().lower())