Added basic auth router and JWT support.

Refactored code.