current property

AuthContext? get current

The caller for the request in flight, or null for an anonymous one.

null means one of: the server has no auth middleware (open mode), the method does not require auth, or the code is not running inside a request. Handlers that must not serve anonymous callers check for null and refuse — absence is never "trusted by default".

Implementation

static AuthContext? get current {
  final v = Zone.current[_callerZoneKey];
  return v is AuthContext ? v : null;
}