Seems like this method belongs in the common authentication module.