MCPcopy Index your code
hub / github.com/tiny-pilot/tinypilot / handler_with_auth_check

Function handler_with_auth_check

app/socket_api.py:53–64  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

51
52 @functools.wraps(handler)
53 def handler_with_auth_check(*args, **kwargs):
54 next_check_due = _auth_expiry_timestamps.get(flask.request.sid, None)
55
56 if (not next_check_due) or (utc.now() > next_check_due):
57 if not session.is_auth_valid(satisfies_role=auth.Role.OPERATOR):
58 flask_socketio.disconnect()
59 return None
60
61 _auth_expiry_timestamps[flask.request.sid] = utc.now(
62 ) + datetime.timedelta(seconds=cache_ttl_seconds)
63
64 return handler(*args, **kwargs)
65
66 return handler_with_auth_check
67

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected