Refactored ApiBaseAuthRouter. Created test for it.