Porting change from 2.9 authentication controller.