implementation for login / signout

Based on #12 . Merge that first.