adds middleware for authentication
Merge pull request #24 from ceimox/cesar/refactor_tests

refactor and run tests