setAuthenticationProviderName() публичный Метод

Set the authentication provider name this account corresponds to
public setAuthenticationProviderName ( string $authenticationProviderName ) : void
$authenticationProviderName string The authentication provider name
Результат void
 /**
  * Creates a new account and sets the given password and roles
  *
  * @param string $identifier Identifier of the account, must be unique
  * @param string $password The clear text password
  * @param array $roleIdentifiers Optionally an array of role identifiers to assign to the new account
  * @param string $authenticationProviderName Optional name of the authentication provider the account is affiliated with
  * @param string $passwordHashingStrategy Optional password hashing strategy to use for the password
  * @return Account A new account, not yet added to the account repository
  */
 public function createAccountWithPassword($identifier, $password, $roleIdentifiers = [], $authenticationProviderName = 'DefaultProvider', $passwordHashingStrategy = 'default')
 {
     $account = new Account();
     $account->setAccountIdentifier($identifier);
     $account->setCredentialsSource($this->hashService->hashPassword($password, $passwordHashingStrategy));
     $account->setAuthenticationProviderName($authenticationProviderName);
     $roles = [];
     foreach ($roleIdentifiers as $roleIdentifier) {
         $roles[] = $this->policyService->getRole($roleIdentifier);
     }
     $account->setRoles($roles);
     return $account;
 }
 /**
  * @test
  */
 public function shutdownCreatesSpecialDataEntryForSessionWithAuthenticatedAccounts()
 {
     $session = new Session();
     $this->inject($session, 'bootstrap', $this->mockBootstrap);
     $this->inject($session, 'objectManager', $this->mockObjectManager);
     $this->inject($session, 'settings', $this->settings);
     $this->inject($session, 'metaDataCache', $this->createCache('Meta'));
     $this->inject($session, 'storageCache', $this->createCache('Storage'));
     $session->initializeObject();
     $session->start();
     $account = new Account();
     $account->setAccountIdentifier('admin');
     $account->setAuthenticationProviderName('MyProvider');
     $token = new UsernamePassword();
     $token->setAuthenticationStatus(TokenInterface::AUTHENTICATION_SUCCESSFUL);
     $token->setAccount($account);
     $this->mockSecurityContext->expects($this->any())->method('isInitialized')->will($this->returnValue(true));
     $this->mockSecurityContext->expects($this->any())->method('getAuthenticationTokens')->will($this->returnValue([$token]));
     $session->close();
     $this->httpRequest->setCookie($this->httpResponse->getCookie('TYPO3_Flow_Session'));
     $session->resume();
     $this->assertEquals(['MyProvider:admin'], $session->getData('TYPO3_Flow_Security_Accounts'));
 }
 /**
  * @test
  */
 public function administratorsCanSeeTestEntityAAssociatedToATestEntityBSomeoneElsesAccount()
 {
     $myAccount = $this->authenticateRoles(['Neos.Flow:Administrator']);
     $myAccount->setAccountIdentifier('MyAccount');
     $myAccount->setAuthenticationProviderName('SomeProvider');
     $andisAccount = new Security\Account();
     $andisAccount->setAccountIdentifier('Andi');
     $andisAccount->setAuthenticationProviderName('SomeProvider');
     $this->persistenceManager->add($myAccount);
     $this->persistenceManager->add($andisAccount);
     $testEntityB = new Fixtures\TestEntityB('testEntityB');
     $testEntityB->setOwnerAccount($myAccount);
     $testEntityA = new Fixtures\TestEntityA($testEntityB);
     $testEntityB2 = new Fixtures\TestEntityB('testEntityB2');
     $testEntityB2->setOwnerAccount($andisAccount);
     $testEntityA2 = new Fixtures\TestEntityA($testEntityB2);
     $this->testEntityADoctrineRepository->add($testEntityA);
     $this->testEntityADoctrineRepository->add($testEntityA2);
     $testEntityAIdentifier = $this->persistenceManager->getIdentifierByObject($testEntityA);
     $testEntityA2Identifier = $this->persistenceManager->getIdentifierByObject($testEntityA2);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $result = $this->testEntityADoctrineRepository->findAllWithDql();
     $this->assertTrue(count($result) === 2);
     $this->assertNotNull($this->persistenceManager->getObjectByIdentifier($testEntityAIdentifier, Fixtures\TestEntityA::class));
     $this->assertNotNull($this->persistenceManager->getObjectByIdentifier($testEntityA2Identifier, Fixtures\TestEntityA::class));
     $this->restrictableEntityDoctrineRepository->removeAll();
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
 }