• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

contributte / security / #21

pending completion
#21

push

github

f3l1x
Composer: allow codesniffer

23 of 40 relevant lines covered (57.5%)

0.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/Auth/DebugAuthenticator.php
1
<?php declare(strict_types = 1);
2

3
namespace Contributte\Security\Auth;
4

5
use Nette\Security\AuthenticationException;
6
use Nette\Security\Authenticator;
7
use Nette\Security\IIdentity;
8
use Nette\Security\SimpleIdentity;
9

10
class DebugAuthenticator implements Authenticator
11
{
12

13
        /** @var bool */
14
        private $pass;
15

16
        /** @var IIdentity|null */
17
        private $identity;
18

19
        public function __construct(bool $pass = true)
20
        {
21
                $this->pass = $pass;
1✔
22
        }
1✔
23

24
        public function setIdentity(IIdentity $identity): void
25
        {
26
                $this->identity = $identity;
×
27
        }
×
28

29
        /**
30
         * @throws AuthenticationException
31
         */
32
        public function authenticate(string $username, string $password): IIdentity
33
        {
34
                if ($this->pass === false) {
1✔
35
                        throw new AuthenticationException('Cannot login', Authenticator::FAILURE);
1✔
36
                }
37

38
                if ($this->identity !== null) {
1✔
39
                        return $this->identity;
×
40
                }
41

42
                return new SimpleIdentity(1, null, null);
1✔
43
        }
44

45
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc