[TYPO3-50-general] Security: Extend the Account Model
Julian Kleinhans
typo3 at kj187.de
Mon Nov 22 22:29:23 CET 2010
Hi again,
i think i have the solution..
i need a additional own Provider
Settings.yaml
FLOW3:
security:
authentication:
providers:
DefaultProvider:
#providerClass: PersistedUsernamePasswordProvider
providerClass:
F3\MyPackage\Security\Authentication\Provider\MyProvider
F3\MyPackage\Security\Authentication\MyProvider.php with the class
MyProvider exists, the namespace is
F3\MyPackage\Security\Authentication\Provider ... the class implements
the interface
\F3\FLOW3\Security\Authentication\AuthenticationProviderInterface
BUT i have the following problem
Fatal error: F3\FLOW3\Resource\ClassLoader::loadClass()
[function.require]: Failed opening required
'/FLOW3/Packages/Application/MyPackage/Classes/Security/Authentication/Provider/MyProvider.php'
(include_path='.:/opt/local/lib/php') in
/FLOW3/Packages/Framework/FLOW3/Classes/Resource/ClassLoader.php on line 71
but the file exists...
any ideas ?
cheers
julian
Am 22.11.10 21:42, schrieb Julian Kleinhans:
> Hey guys,
>
> i will extend the F3\FLOW3\Security\Account Model with more informations
> like Realname, email, Paypal Account and so on..
>
> My current solution is this:
>
> i create a new Model in my Package
>
> F3\MyPackage\Domain\Model\Account
>
> This Model extends the basic model F3\FLOW3\Security\Account
> Here i defined all the new information i need with his getter and setter.
>
> The next step is to create a new AccountRepository thats extends the
> repository \F3\FLOW3\Security\AccountRepository
>
> The constructor was changend to
>
> public function __construct() {
>
> $this->addedObjects = new \SplObjectStorage();
> $this->removedObjects = new \SplObjectStorage();
> if ($this->objectType === NULL) {
> $this->objectType = str_replace(array('\\Repository\\', 'Repository'),
> array('\\Model\\', ''), $this->FLOW3_AOP_Proxy_getProxyTargetClassName());
> }
>
> $this->objectType = 'F3\MyPackage\Domain\Model\Account';
> }
>
> To tell the Security Framework that he work with the new Model i created
> a Configuration/Objects.yaml with this content
>
> F3\FLOW3\Security\Account:
> autowiring: on
> className: F3\Tutorials\Domain\Model\Account
>
>
> Now, i create a new User like
>
> $roles = array();
> $roles[] = $this->objectManager->create('F3\FLOW3\Security\Policy\Role',
> 'Administrator');
>
> $account = $this->objectManager->create('F3\MyPacke\Domain\Model\Account');
> $account->setAccountIdentifier('test');
> $account->setName('Julian Kleinhans');
> $account->setEmail('typo3 at kj187.de');
> $account->setPaypal('xxx at kj187.de');
> $account->setCredentialsSource($this->hashService->generateSaltedMd5('test'));
>
> $account->setAuthenticationProviderName('DefaultProvider');
> $account->setRoles($roles);
>
> $this->accountRepository->add($account);
>
>
>
> The user is created, but, i cant authentificate with this new user :-(
> Any ideas or hints ?
>
> cheers
> Julian
More information about the TYPO3-project-5_0-general
mailing list