Beispiel #1
0
 public function firewallProvider()
 {
     Security::setConfig(__DIR__ . '/../../../ExampleConfig.yaml');
     $config = Config::getInstance()->yaml(__DIR__ . '/../../../ExampleConfig.yaml');
     $firewallConfig = $config->Security->Firewalls->Admin;
     $userProviderMock = new UserProviderMock();
     $encoder = new Encoder($config->Security->Encoders->MockEncoder->Driver, []);
     $firewall = new Firewall('Admin', $firewallConfig, [$userProviderMock], $encoder);
     return [[$firewall]];
 }
Beispiel #2
0
 public function testSecurity()
 {
     // before we can use security we need to set the config
     \Webiny\Component\Security\Security::setConfig(__DIR__ . '/ExampleConfig.yaml');
     // Test instance of Security
     $this->assertInstanceOf('\\Webiny\\Component\\Security\\Security', $this->security());
     // Test instance of Firewall
     $this->assertInstanceOf('\\Webiny\\Component\\Security\\Authentication\\Firewall', $this->security()->firewall('Admin'));
     // Test shorter access to Firewall
     $this->assertInstanceOf('\\Webiny\\Component\\Security\\Authentication\\Firewall', $this->security('Admin'));
 }
Beispiel #3
0
 public function dataProvider()
 {
     Security::setConfig(__DIR__ . '/ExampleConfig.yaml');
     $security = Security::getInstance();
     return [[$security]];
 }
Beispiel #4
0
<?php

require_once '../vendor/autoload.php';
\Webiny\Component\Security\Security::setConfig('./securityConfig.yaml');
\Webiny\Component\Mongo\Mongo::setConfig('./mongoConfig.yaml');
\Webiny\Component\Entity\Entity::setConfig('./entityConfig.yaml');
$security = \Webiny\Component\Security\Security::getInstance();
$loginConfig = \Webiny\Component\Config\Config::getInstance()->yaml('./loginConfig.yaml');
$login = new \Webiny\Login\Login($security, $loginConfig);