| @@ 13-45 (lines=33) @@ | ||
| 10 | /** |
|
| 11 | * @author Stanimir Dimitrov Dimitrov <[email protected]> |
|
| 12 | */ |
|
| 13 | class BasicAuthenticationAdapterFactory implements FactoryInterface |
|
| 14 | { |
|
| 15 | /** @var array|object|string $basicConfig */ |
|
| 16 | private $basicConfig = []; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @param array|object|string $basicConfig |
|
| 20 | */ |
|
| 21 | public function __construct(array $basicConfig = []) |
|
| 22 | { |
|
| 23 | $this->basicConfig = $basicConfig; |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * {@inheritdoc} |
|
| 28 | */ |
|
| 29 | public function createService(ServiceLocatorInterface $basicServiceLocator) |
|
| 30 | { |
|
| 31 | if (empty($this->basicConfig)) { |
|
| 32 | $this->basicConfig = $basicServiceLocator->get('Config'); |
|
| 33 | } |
|
| 34 | ||
| 35 | $authBasicConfig = $this->basicConfig['authentication_basic']['adapter']; |
|
| 36 | $authBasicAdapter = new HttpAdapter($authBasicConfig['config']); |
|
| 37 | ||
| 38 | $basic = new FileResolver(); |
|
| 39 | $basic->setFile($authBasicConfig['basic']); |
|
| 40 | ||
| 41 | $authBasicAdapter->setBasicResolver($basic); |
|
| 42 | ||
| 43 | return $authBasicAdapter; |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||
| @@ 10-42 (lines=33) @@ | ||
| 7 | use Zend\ServiceManager\FactoryInterface; |
|
| 8 | use Zend\ServiceManager\ServiceLocatorInterface; |
|
| 9 | ||
| 10 | class DigestAuthenticationAdapterFactory implements FactoryInterface |
|
| 11 | { |
|
| 12 | /** @var array|object|string $digestConfig */ |
|
| 13 | private $digestConfig = []; |
|
| 14 | ||
| 15 | /** |
|
| 16 | * @param array|object|string $digestConfig |
|
| 17 | */ |
|
| 18 | public function __construct(array $digestConfig = []) |
|
| 19 | { |
|
| 20 | $this->digestConfig = $digestConfig; |
|
| 21 | } |
|
| 22 | ||
| 23 | /** |
|
| 24 | * {@inheritdoc} |
|
| 25 | */ |
|
| 26 | public function createService(ServiceLocatorInterface $digestServiceLocator) |
|
| 27 | { |
|
| 28 | if (empty($this->digestConfig)) { |
|
| 29 | $this->digestConfig = $digestServiceLocator->get('Config'); |
|
| 30 | } |
|
| 31 | ||
| 32 | $authDigestConfig = $this->digestConfig['authentication_digest']['adapter']; |
|
| 33 | $authDigestAdapter = new HttpAdapter($authDigestConfig['config']); |
|
| 34 | ||
| 35 | $digest = new FileResolver(); |
|
| 36 | $digest->setFile($authDigestConfig['digest']); |
|
| 37 | ||
| 38 | $authDigestAdapter->setDigestResolver($digest); |
|
| 39 | ||
| 40 | return $authDigestAdapter; |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||