Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
auth
Commits
5c57ded8
Commit
5c57ded8
authored
Mar 10, 2019
by
Bertrand Gauthier
Browse files
Corrections pour passer à ZF3.
parent
e0827096
Pipeline
#3939
passed with stage
in 19 seconds
Changes
29
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Module.php
View file @
5c57ded8
...
...
@@ -90,7 +90,7 @@ class Module implements AutoloaderProviderInterface, ConfigProviderInterface, Se
*/
private
function
reconfigureRoutesForAuth
(
ServiceLocatorInterface
$sl
)
{
/* @var $router \Zend\
Mvc\
Router\Http\TreeRouteStack */
/* @var $router \Zend\Router\Http\TreeRouteStack */
$router
=
$sl
->
get
(
'router'
);
// si l'auth CAS est activée, modif de la route de connexion pour zapper le formulaire d'auth maison.
...
...
src/UnicaenAuth/Assertion/AbstractAssertion.php
View file @
5c57ded8
...
...
@@ -5,7 +5,7 @@ namespace UnicaenAuth\Assertion;
use
BjyAuthorize\Service\Authorize
;
use
UnicaenAuth\Service\Traits\UserContextServiceAwareTrait
;
use
Zend\Mvc\Application
;
use
Zend\Mvc\
Controller\Plugin
\FlashMessenger
;
use
Zend\Mvc\
Plugin\FlashMessenger
\FlashMessenger
;
use
Zend\Mvc\MvcEvent
;
use
Zend\Permissions\Acl\Acl
;
use
Zend\Permissions\Acl\Assertion\AssertionInterface
;
...
...
src/UnicaenAuth/Authentication/Adapter/AbstractFactory.php
View file @
5c57ded8
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenAuth\Authentication\Adapter
;
use
Interop\Container\ContainerInterface
;
use
UnicaenApp\Exception\LogicException
;
use
Zend\EventManager\EventManager
;
use
Zend\EventManager\EventManagerAwareInterface
;
...
...
@@ -15,28 +16,22 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class
AbstractFactory
implements
AbstractFactoryInterface
{
/**
* Determine if we can create a service with name
*
* @param ServiceLocatorInterface $serviceLocator
* @param $name
* @param $requestedName
* @return bool
*/
public
function
canCreateServiceWithName
(
ServiceLocatorInterface
$serviceLocator
,
$name
,
$requestedName
)
{
return
strpos
(
$requestedName
,
__NAMESPACE__
)
===
0
&&
class_exists
(
$requestedName
);
return
$this
->
canCreate
(
$serviceLocator
,
$requestedName
);
}
/**
* Create service with name
*
* @param ServiceLocatorInterface $serviceLocator
* @param $name
* @param $requestedName
* @return \ZfcUser\Authentication\Adapter\AbstractAdapter
*/
public
function
createServiceWithName
(
ServiceLocatorInterface
$serviceLocator
,
$name
,
$requestedName
)
{
return
$this
->
__invoke
(
$serviceLocator
,
$requestedName
);
}
public
function
canCreate
(
ContainerInterface
$container
,
$requestedName
)
{
return
strpos
(
$requestedName
,
__NAMESPACE__
)
===
0
&&
class_exists
(
$requestedName
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
switch
(
$requestedName
)
{
case
__NAMESPACE__
.
'\Ldap'
:
...
...
@@ -61,9 +56,9 @@ class AbstractFactory implements AbstractFactoryInterface
if
(
$adapter
instanceof
EventManagerAwareInterface
)
{
/** @var EventManager $eventManager */
$eventManager
=
$
serviceLocato
r
->
get
(
'event_manager'
);
$eventManager
=
$
containe
r
->
get
(
'event_manager'
);
$adapter
->
setEventManager
(
$eventManager
);
$userService
=
$
serviceLocato
r
->
get
(
'unicaen-auth_user_service'
);
/* @var $userService \UnicaenAuth\Service\User */
$userService
=
$
containe
r
->
get
(
'unicaen-auth_user_service'
);
/* @var $userService \UnicaenAuth\Service\User */
$eventManager
->
attach
(
'userAuthenticated'
,
[
$userService
,
'userAuthenticated'
],
100
);
}
...
...
src/UnicaenAuth/Authentication/Adapter/Cas.php
View file @
5c57ded8
...
...
@@ -12,7 +12,7 @@ use Zend\Authentication\Result as AuthenticationResult;
use
Zend\EventManager\EventManager
;
use
Zend\EventManager\EventManagerAwareInterface
;
use
Zend\EventManager\EventManagerInterface
;
use
Zend\
Mvc\
Router\Http\TreeRouteStack
;
use
Zend\Router\Http\TreeRouteStack
;
use
Zend\ServiceManager\ServiceLocatorAwareTrait
;
use
ZfcUser\Authentication\Adapter\AbstractAdapter
;
use
ZfcUser\Authentication\Adapter\AdapterChainEvent
as
AuthEvent
;
...
...
src/UnicaenAuth/Authentication/AuthenticationServiceFactory.php
View file @
5c57ded8
...
...
@@ -2,9 +2,10 @@
namespace
UnicaenAuth\Authentication
;
use
Interop\Container\ContainerInterface
;
use
Zend\Authentication\AuthenticationService
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
use
Zend\Authentication\AuthenticationService
;
/**
* Description of AuthenticationServiceFactory
...
...
@@ -13,17 +14,16 @@ use Zend\Authentication\AuthenticationService;
*/
class
AuthenticationServiceFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return AuthenticationService
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
return
new
AuthenticationService
(
$
serviceLocato
r
->
get
(
'UnicaenAuth\Authentication\Storage\Chain'
),
$
serviceLocato
r
->
get
(
'ZfcUser\Authentication\Adapter\AdapterChain'
)
$
containe
r
->
get
(
'UnicaenAuth\Authentication\Storage\Chain'
),
$
containe
r
->
get
(
'ZfcUser\Authentication\Adapter\AdapterChain'
)
);
}
}
\ No newline at end of file
src/UnicaenAuth/Authentication/RedirectCallback.php
View file @
5c57ded8
...
...
@@ -5,8 +5,8 @@ namespace UnicaenAuth\Authentication;
use
Zend\Http\PhpEnvironment\Request
;
use
Zend\Http\PhpEnvironment\Response
;
use
Zend\Mvc\Application
;
use
Zend\
Mvc\
Router\Exception
;
use
Zend\
Mvc\
Router\RouteInterface
;
use
Zend\Router\Exception
;
use
Zend\Router\RouteInterface
;
use
ZfcUser\Options\ModuleOptions
;
/**
...
...
src/UnicaenAuth/Authentication/RedirectCallbackFactory.php
View file @
5c57ded8
...
...
@@ -2,30 +2,29 @@
namespace
UnicaenAuth\Authentication
;
use
Interop\Container\ContainerInterface
;
use
Zend\Mvc\Application
;
use
Zend\
Mvc\
Router\RouteInterface
;
use
Zend\Router\RouteInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
use
ZfcUser\Options\ModuleOptions
;
class
RedirectCallbackFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return mixed
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
/* @var RouteInterface $router */
$router
=
$
serviceLocato
r
->
get
(
'Router'
);
$router
=
$
containe
r
->
get
(
'Router'
);
/* @var Application $application */
$application
=
$
serviceLocato
r
->
get
(
'Application'
);
$application
=
$
containe
r
->
get
(
'Application'
);
/* @var ModuleOptions $options */
$options
=
$
serviceLocato
r
->
get
(
'zfcuser_module_options'
);
$options
=
$
containe
r
->
get
(
'zfcuser_module_options'
);
return
new
RedirectCallback
(
$application
,
$router
,
$options
);
}
...
...
src/UnicaenAuth/Authentication/Storage/ChainServiceFactory.php
View file @
5c57ded8
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenAuth\Authentication\Storage
;
use
Interop\Container\ContainerInterface
;
use
UnicaenAuth\Options\ModuleOptions
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -21,18 +22,17 @@ class ChainServiceFactory implements FactoryInterface
protected
$storages
=
[];
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return mixed
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$chain
=
new
Chain
();
/** @var ModuleOptions $options */
$options
=
$
serviceLocato
r
->
get
(
'unicaen-auth_module_options'
);
$options
=
$
containe
r
->
get
(
'unicaen-auth_module_options'
);
// retrait du fournisseur Ldap si l'auth LDAP est désactivée
if
(
isset
(
$options
->
getLdap
()[
'enabled'
])
&&
!
$options
->
getLdap
()[
'enabled'
])
{
...
...
@@ -43,7 +43,7 @@ class ChainServiceFactory implements FactoryInterface
krsort
(
$storages
);
foreach
(
$storages
as
$priority
=>
$name
)
{
$storage
=
$
serviceLocato
r
->
get
(
$name
);
$storage
=
$
containe
r
->
get
(
$name
);
$chain
->
getEventManager
()
->
attach
(
'read'
,
[
$storage
,
'read'
],
$priority
);
$chain
->
getEventManager
()
->
attach
(
'write'
,
[
$storage
,
'write'
],
$priority
);
$chain
->
getEventManager
()
->
attach
(
'clear'
,
[
$storage
,
'clear'
],
$priority
);
...
...
src/UnicaenAuth/Mouchard/MouchardCompleterAuthFactory.php
View file @
5c57ded8
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenAuth\Mouchard
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -12,17 +13,16 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class
MouchardCompleterAuthFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return MouchardCompleterAuth
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
return
$this
->
__invoke
(
$serviceLocator
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$mouchardCompleterAuth
=
new
MouchardCompleterAuth
();
$serviceUserContext
=
$
serviceLocato
r
->
get
(
'UnicaenAuth\Service\UserContext'
);
$serviceUserContext
=
$
containe
r
->
get
(
'UnicaenAuth\Service\UserContext'
);
$mouchardCompleterAuth
->
setServiceUserContext
(
$serviceUserContext
);
return
$mouchardCompleterAuth
;
...
...
src/UnicaenAuth/Options/ModuleOptionsFactory.php
View file @
5c57ded8
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenAuth\Options
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -12,15 +13,14 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class
ModuleOptionsFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return mixed
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
$config
=
$serviceLocator
->
get
(
'Configuration'
);
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$config
=
$container
->
get
(
'Configuration'
);
$moduleConfig
=
isset
(
$config
[
'unicaen-auth'
])
?
$config
[
'unicaen-auth'
]
:
[];
$moduleConfig
=
array_merge
(
$config
[
'zfcuser'
],
$moduleConfig
);
...
...
src/UnicaenAuth/Provider/Identity/BasicServiceFactory.php
View file @
5c57ded8
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenAuth\Provider\Identity
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -17,8 +18,13 @@ class BasicServiceFactory implements FactoryInterface
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
$user
=
$serviceLocator
->
get
(
'zfcuser_user_service'
);
$config
=
$serviceLocator
->
get
(
'BjyAuthorize\Config'
);
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$user
=
$container
->
get
(
'zfcuser_user_service'
);
$config
=
$container
->
get
(
'BjyAuthorize\Config'
);
$identityProvider
=
new
Basic
(
$user
->
getAuthService
());
$identityProvider
->
setDefaultRole
(
$config
[
'default_role'
]);
...
...
src/UnicaenAuth/Provider/Identity/ChainServiceFactory.php
View file @
5c57ded8
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenAuth\Provider\Identity
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -12,21 +13,20 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class
ChainServiceFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return mixed
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$chain
=
new
Chain
();
$chain
->
setServiceLocator
(
$
serviceLocato
r
);
$chain
->
setServiceLocator
(
$
containe
r
);
$providers
=
$this
->
computeProviders
(
$
serviceLocato
r
);
$providers
=
$this
->
computeProviders
(
$
containe
r
);
foreach
(
$providers
as
$priority
=>
$name
)
{
$provider
=
$
serviceLocato
r
->
get
(
$name
);
$provider
=
$
containe
r
->
get
(
$name
);
$chain
->
getEventManager
()
->
attach
(
'getIdentityRoles'
,
[
$provider
,
'injectIdentityRoles'
],
$priority
);
}
...
...
src/UnicaenAuth/Provider/Identity/DbServiceFactory.php
View file @
5c57ded8
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenAuth\Provider\Identity
;
use
Interop\Container\ContainerInterface
;
use
UnicaenApp\Options\ModuleOptions
;
use
Zend\Ldap\Ldap
;
use
Zend\ServiceManager\FactoryInterface
;
...
...
@@ -19,18 +20,23 @@ class DbServiceFactory implements FactoryInterface
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
$user
=
$serviceLocator
->
get
(
'zfcuser_user_service'
);
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$user
=
$container
->
get
(
'zfcuser_user_service'
);
$identityProvider
=
new
Db
(
$user
->
getAuthService
());
$unicaenAppOptions
=
$
serviceLocato
r
->
get
(
'unicaen-app_module_options'
);
$unicaenAppOptions
=
$
containe
r
->
get
(
'unicaen-app_module_options'
);
/* @var $unicaenAppOptions ModuleOptions */
$ldap
=
new
Ldap
(
$unicaenAppOptions
->
getLdap
()[
'connection'
][
'default'
][
'params'
]);
$identityProvider
->
setLdap
(
$ldap
);
$identityProvider
->
setServiceRole
(
$
serviceLocato
r
->
get
(
'UnicaenAuth\Service\Role'
));
$identityProvider
->
setServiceRole
(
$
containe
r
->
get
(
'UnicaenAuth\Service\Role'
));
$config
=
$
serviceLocato
r
->
get
(
'BjyAuthorize\Config'
);
$config
=
$
containe
r
->
get
(
'BjyAuthorize\Config'
);
$identityProvider
->
setDefaultRole
(
$config
[
'default_role'
]);
$identityProvider
->
setAuthenticatedRole
(
$config
[
'authenticated_role'
]);
...
...
src/UnicaenAuth/Provider/Identity/LdapServiceFactory.php
View file @
5c57ded8
...
...
@@ -2,9 +2,9 @@
namespace
UnicaenAuth\Provider\Identity
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
use
UnicaenAuth\Acl\NamedRole
;
/**
* LDAP identity provider factory
...
...
@@ -19,10 +19,15 @@ class LdapServiceFactory implements FactoryInterface
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
$config
=
$serviceLocator
->
get
(
'BjyAuthorize\Config'
);
$user
=
$serviceLocator
->
get
(
'zfcuser_user_service'
);
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$config
=
$container
->
get
(
'BjyAuthorize\Config'
);
$user
=
$container
->
get
(
'zfcuser_user_service'
);
$simpleIdentityProvider
=
new
Ldap
(
$user
->
getAuthService
());
$simpleIdentityProvider
->
setDefaultRole
(
$config
[
'default_role'
]);
$simpleIdentityProvider
->
setAuthenticatedRole
(
$config
[
'authenticated_role'
]);
...
...
src/UnicaenAuth/Provider/Role/ConfigServiceFactory.php
View file @
5c57ded8
...
...
@@ -3,6 +3,7 @@
namespace
UnicaenAuth\Provider\Role
;
use
BjyAuthorize\Exception\InvalidArgumentException
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -15,23 +16,26 @@ class ConfigServiceFactory implements FactoryInterface
{
/**
* {@inheritDoc}
*
* @return \BjyAuthorize\Provider\Role\Config
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
$config
=
$serviceLocator
->
get
(
'BjyAuthorize\Config'
);
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$config
=
$container
->
get
(
'BjyAuthorize\Config'
);
if
(
!
isset
(
$config
[
'role_providers'
][
'UnicaenAuth\Provider\Role\Config'
]))
{
throw
new
InvalidArgumentException
(
'Config for "UnicaenAuth\Provider\Role\Config" not set'
);
}
$providerConfig
=
$config
[
'role_providers'
][
'UnicaenAuth\Provider\Role\Config'
];
/* @var $mapper \UnicaenApp\Mapper\Ldap\Group */
$mapper
=
$
serviceLocato
r
->
get
(
'ldap_group_mapper'
);
$mapper
=
$
containe
r
->
get
(
'ldap_group_mapper'
);
$service
=
new
Config
(
$mapper
,
$providerConfig
);
...
...
src/UnicaenAuth/Provider/Role/DbRoleServiceFactory.php
View file @
5c57ded8
...
...
@@ -2,7 +2,7 @@
namespace
UnicaenAuth\Provider\Role
;
use
BjyAuthorize\Exception\InvalidArgumentException
;
use
Interop\Container\ContainerInterface
;
use
UnicaenAuth\Service\RoleService
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -14,12 +14,15 @@ class DbRoleServiceFactory implements FactoryInterface
{
/**
* {@inheritDoc}
*
* @return DbRole
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
$serviceRole
=
$serviceLocator
->
get
(
'UnicaenAuth\Service\Role'
);
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$serviceRole
=
$container
->
get
(
'UnicaenAuth\Service\Role'
);
/* @var $serviceRole RoleService */
return
new
DbRole
(
$serviceRole
->
getRepo
());
...
...
src/UnicaenAuth/Provider/Role/UsernameServiceFactory.php
View file @
5c57ded8
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenAuth\Provider\Role
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -12,26 +13,25 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class
UsernameServiceFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return Username
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
$config
=
$serviceLocator
->
get
(
'BjyAuthorize\Config'
);
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$config
=
$container
->
get
(
'BjyAuthorize\Config'
);
if
(
!
isset
(
$config
[
'role_providers'
][
'UnicaenAuth\Provider\Role\Username'
]))
{
throw
new
InvalidArgumentException
(
throw
new
\
InvalidArgumentException
(
'Config for "UnicaenAuth\Provider\Role\Username" not set'
);
}
$providerConfig
=
$config
[
'role_providers'
][
'UnicaenAuth\Provider\Role\Username'
];
$authService
=
$
serviceLocato
r
->
get
(
'zfcuser_auth_service'
);
/* @var $authService \Zend\Authentication\AuthenticationService */
$authService
=
$
containe
r
->
get
(
'zfcuser_auth_service'
);
/* @var $authService \Zend\Authentication\AuthenticationService */
return
new
Username
(
$authService
,
$providerConfig
);
}
}
\ No newline at end of file
src/UnicaenAuth/Service/AuthorizeServiceFactory.php
View file @
5c57ded8
...
...
@@ -8,6 +8,7 @@
namespace
UnicaenAuth\Service
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -20,11 +21,13 @@ class AuthorizeServiceFactory implements FactoryInterface
{
/**
* {@inheritDoc}
*
* @return \Application\Service\Authorize
*/
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
return
new
AuthorizeService
(
$serviceLocator
->
get
(
'BjyAuthorize\Config'
),
$serviceLocator
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
return
new
AuthorizeService
(
$container
->
get
(
'BjyAuthorize\Config'
),
$container
);
}
}
src/UnicaenAuth/Service/PrivilegeServiceFactory.php
View file @
5c57ded8
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenAuth\Service
;
use
Interop\Container\ContainerInterface
;
use
UnicaenAuth\Entity\Db\Privilege
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -10,7 +11,12 @@ class PrivilegeServiceFactory implements FactoryInterface
{
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
$config
=
$serviceLocator
->
get
(
'Config'
);
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$config
=
$container
->
get
(
'Config'
);
if
(
!
isset
(
$config
[
'unicaen-auth'
][
'privilege_entity_class'
]))
{
// throw new InvalidArgumentException("La classe de l'entité privilège n'a pas été trouvée dans la config");
...
...
src/UnicaenAuth/Service/RoleServiceFactory.php
View file @
5c57ded8
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenAuth\Service
;
use
Interop\Container\ContainerInterface
;
use
UnicaenAuth\Entity\Db\Role
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -10,7 +11,12 @@ class RoleServiceFactory implements FactoryInterface
{
public
function
createService
(
ServiceLocatorInterface
$serviceLocator
)
{
$config
=
$serviceLocator
->
get
(
'Config'
);
return
$this
->
__invoke
(
$serviceLocator
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$config
=
$container
->
get
(
'Config'
);
if
(
!
isset
(
$config
[
'unicaen-auth'
][
'role_entity_class'
]))
{
$config
[
'unicaen-auth'
][
'role_entity_class'
]
=
Role
::
class
;
...
...
Prev
1
2
Next