add logout middleware