Add security middleware.