Add security middleware