Implements authentication, not yet finished