add middleware only if auth is provided
use view helpers as middleware