This removes a lot of duplicated code and adds time.Duration support to parseutil, needed by the jwt auth method.