add authentication. Fixes #11, #12, #13, #14