<commit_before><?php
namespace TYPO3\SingleSignOn\Client\Service;

/*                                                                        *
 * This script belongs to the TYPO3 Flow package "TYPO3.SingleSignOn.Client".*
 *                                                                        *
 *                                                                        */

use TYPO3\Flow\Annotations as Flow;
use TYPO3\SingleSignOn\Client\Domain\Model\SsoClient;

/**
 * Maps global accounts to local accounts by mapping all safe properties (when existing)
 */
class SimpleGlobalAccountMapper implements GlobalAccountMapperInterface {

	/**
	 * @param \TYPO3\SingleSignOn\Client\Domain\Model\SsoClient $ssoClient
	 * @param array $globalAccountData
	 * @return \TYPO3\Flow\Security\Account
	 */
	public function getAccount(SsoClient $ssoClient, array $globalAccountData) {
		$account = new \TYPO3\Flow\Security\Account();
		$account->setAccountIdentifier($globalAccountData['accountIdentifier']);
		$account->setAuthenticationProviderName('SingleSignOn');

		$roleIdentifiers = array_map(function($role) {
			return $role['identifier'];
		}, $globalAccountData['roles']);
		$account->setRoles($roleIdentifiers);
		return $account;
	}

}
?><commit_msg>[TASK] Update account mapper to new authentication data format<commit_after><?php
namespace TYPO3\SingleSignOn\Client\Service;

/*                                                                        *
 * This script belongs to the TYPO3 Flow package "TYPO3.SingleSignOn.Client".*
 *                                                                        *
 *                                                                        */

use TYPO3\Flow\Annotations as Flow;
use TYPO3\SingleSignOn\Client\Domain\Model\SsoClient;

/**
 * Maps global accounts to local accounts by mapping all safe properties (when existing)
 */
class SimpleGlobalAccountMapper implements GlobalAccountMapperInterface {

	/**
	 * @param \TYPO3\SingleSignOn\Client\Domain\Model\SsoClient $ssoClient
	 * @param array $globalAccountData
	 * @return \TYPO3\Flow\Security\Account
	 */
	public function getAccount(SsoClient $ssoClient, array $globalAccountData) {
		$account = new \TYPO3\Flow\Security\Account();
		$account->setAccountIdentifier($globalAccountData['accountIdentifier']);
		$account->setAuthenticationProviderName('SingleSignOn');
		$account->setRoles($globalAccountData['roles']);
		return $account;
	}

}
?>
{'fraction_non_alphanumeric': 0.10277324632952692, 'fraction_numerical': 0.0065252854812398045, 'mean_word_length': 2.3193504736129906, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6721820', 'n_tokens_mistral': 636, 'n_tokens_neox': 609, 'n_words': 127}