Refactor authentication module
Merge pull request #54 from dpolivaev/master

refactoring
Manual Merge