Add postgresql dependency
Split auth functions out into seperate module