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

FastyBird / simple-auth / 9818139344

06 Jul 2024 09:09AM UTC coverage: 65.685% (-0.3%) from 66.025%
9818139344

push

github

web-flow
Added ability to redirect to home page when user is signed in (#5)

* Added ability to redirect to home page when user is signed in

* QA fixes

4 of 11 new or added lines in 3 files covered. (36.36%)

379 of 577 relevant lines covered (65.68%)

4.04 hits per line

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

0.0
/src/Configuration.php
1
<?php declare(strict_types = 1);
2

3
/**
4
 * Configuration.php
5
 *
6
 * @license        More in LICENSE.md
7
 * @copyright      https://www.fastybird.com
8
 * @author         Adam Kadlec <adam.kadlec@fastybird.com>
9
 * @package        FastyBird:SimpleAuth!
10
 * @subpackage     common
11
 * @since          0.1.0
12
 *
13
 * @date           01.07.24
14
 */
15

16
namespace FastyBird\SimpleAuth;
17

18
use Nette;
19
use Nette\Application;
20

21
/**
22
 * Simple authentication extension configuration storage.
23
 * Store basic extension settings
24
 *
25
 * @package        FastyBird:SimpleAuth!
26
 * @subpackage     common
27
 *
28
 * @author         Adam Kadlec <adam.kadlec@fastybird.com>
29
 */
30
class Configuration
31
{
32

33
        use Nette\SmartObject;
34

35
        public function __construct(
36
                private readonly Application\LinkGenerator $linkGenerator,
37
                private readonly string $tokenIssuer,
38
                private readonly string $tokenSignature,
39
                private readonly bool $enableMiddleware,
40
                private readonly bool $enableDoctrineMapping,
41
                private readonly bool $enableDoctrineModels,
42
                private readonly bool $enableNetteApplication,
43
                private readonly string|null $applicationSignInUrl = null,
44
                private readonly string $applicationHomeUrl = '/',
45
        )
46
        {
47
        }
×
48

49
        public function getTokenIssuer(): string
50
        {
51
                return $this->tokenIssuer;
×
52
        }
53

54
        public function getTokenSignature(): string
55
        {
56
                return $this->tokenSignature;
×
57
        }
58

59
        public function isEnableMiddleware(): bool
60
        {
61
                return $this->enableMiddleware;
×
62
        }
63

64
        public function isEnableDoctrineMapping(): bool
65
        {
66
                return $this->enableDoctrineMapping;
×
67
        }
68

69
        public function isEnableDoctrineModels(): bool
70
        {
71
                return $this->enableDoctrineModels;
×
72
        }
73

74
        public function isEnableNetteApplication(): bool
75
        {
76
                return $this->enableNetteApplication;
×
77
        }
78

79
        /**
80
         * Build the URL for redirection if is set
81
         *
82
         * @param array<mixed> $params
83
         *
84
         * @throws Application\UI\InvalidLinkException
85
         */
86
        public function getRedirectUrl(array $params = []): string|null
87
        {
NEW
88
                if ($this->applicationSignInUrl !== null) {
×
NEW
89
                        return $this->linkGenerator->link($this->applicationSignInUrl, $params);
×
90
                }
91

92
                return null;
×
93
        }
94

95
        /**
96
         * Build the URL for redirection to homepage
97
         *
98
         * @param array<mixed> $params
99
         *
100
         * @throws Application\UI\InvalidLinkException
101
         */
102
        public function getHomeUrl(array $params = []): string|null
103
        {
NEW
104
                return $this->linkGenerator->link($this->applicationHomeUrl, $params);
×
105
        }
106

107
}
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