Add pre auth checks to authentication.
Merge pull request #277 from petergallagher/master

Add pre auth checks to authentication.