Lot's of changes to handle CAS authentication
bunch of bad changes