make ensure authentication a separate middleware from router