CAS-1238 New Authentication API

This branch is feature complete and ready for final review.