public function authenticate(IdentityProvider $identityProvider)
    {
        try {
            // Authenticate the user.
            $identityProvider->authenticate();
            // Success!
            $this->isAuthenticated = true;
            // Set the data obtained from the identity provider.
            $this->name = $identityProvider->getUserName();
            $this->email = $identityProvider->getUserEmail();
        } catch (IdentityException $exception) {
            $this->isAuthenticated = false;
            throw $exception;
        }
    }