check method
Inspects context and returns a SecurityResult.
Implementations should be side-effect-light with respect to
context.body (avoid destructive mutation) but may freely read/write
context.metadata to communicate with later layers.
Implementation
@override
Future<SecurityResult> check(RequestContext context) async {
final entry = SecurityLogEntry(
timestamp: DateTime.now().toUtc(),
layerName: name,
userId: context.userId ?? 'anonymous',
ipAddress: context.ipAddress,
message: 'Request reached final logging stage',
);
history.add(entry);
sink(entry.toString());
return SecurityResult.allow(message: 'Logged');
}