tidy Security/Auth functions to be more idiomatic