Add logout middleware.