Implements authentication