Overhauled authentication framework to allow for custom success and failure handlers