fixes Unit Test related to authentication model changes.
Some code refactoring.