LdapServiceFactory.php 914 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

namespace UnicaenAuth\Provider\Identity;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use UnicaenAuth\Acl\NamedRole;

/**
 * LDAP identity provider factory
 *
 * @author Bertrand GAUTHIER <bertrand.gauthier@unicaen.fr>
 */
class LdapServiceFactory implements FactoryInterface
{
    /**
     * {@inheritDoc}
18
     * @deprecated
19
20
21
22
23
24
25
26
27
28
29
30
31
     */
    public function createService(ServiceLocatorInterface $serviceLocator)
    {
        $config                 = $serviceLocator->get('BjyAuthorize\Config');
        $user                   = $serviceLocator->get('zfcuser_user_service');
        $simpleIdentityProvider = new Ldap($user->getAuthService());
        
        $simpleIdentityProvider->setDefaultRole($config['default_role']);
        $simpleIdentityProvider->setAuthenticatedRole($config['authenticated_role']);

        return $simpleIdentityProvider;
    }
}