protected function saveLoginInfo($resourceOwner)
    {
        // Initialize the user
        $u = new User();
        $u->setAuthenticated(true);
        $u->setAuthenticator($this->getName());

        // Get user id from the Resource Owner
        $attrMap = $this->providerConfig['attributeMap'];
        $userIdAttr = $attrMap['userId'];
        $userId = $this->getResourceAttribute($userIdAttr, $resourceOwner);
        $u->setId($userId);
        unset($attrMap['userId']);

        // Get display name from the Resource Owner (if configured)
        if (isset($attrMap['displayName'])) {
            $name = $this->getResourceAttribute($attrMap['displayName'], $resourceOwner);
            $u->setDisplayName($name);
            unset($attrMap['displayName']);
        }

        // Retrieve all other custom attributes from the attributeMap
        foreach ($attrMap as $mapKey => $mapValue) {
            $value = $this->getResourceAttribute($mapValue, $resourceOwner);
            $u->setAttribute($mapKey, $value);
        }

        // Set default droups and default attributes
        $u->setGroups($this->providerConfig['default']['groups']);
        foreach ($this->providerConfig['default']['attributes'] as $key => $value) {
            if (null === $u->getAttribute($key)) {
                $u->setAttribute($key, $value);
            }
        }

        $this->picoAuth->setUser($u);
        $this->picoAuth->afterLogin();
    }