Skip to content

Commit bd91dda

Browse files
committed
Move to SspBridge in MaxAgeRule
1 parent 5e603ad commit bd91dda

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/Factories/RequestRulesManagerFactory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace SimpleSAML\Module\oidc\Factories;
66

7+
use SimpleSAML\Module\oidc\Bridges\SspBridge;
78
use SimpleSAML\Module\oidc\Factories\Entities\ClientEntityFactory;
89
use SimpleSAML\Module\oidc\Helpers;
910
use SimpleSAML\Module\oidc\ModuleConfig;
@@ -60,6 +61,7 @@ public function __construct(
6061
private readonly Helpers $helpers,
6162
private readonly JwksResolver $jwksResolver,
6263
private readonly FederationParticipationValidator $federationParticipationValidator,
64+
private readonly SspBridge $sspBridge,
6365
private readonly ?FederationCache $federationCache = null,
6466
private readonly ?ProtocolCache $protocolCache = null,
6567
) {
@@ -106,6 +108,7 @@ private function getDefaultRules(): array
106108
$this->helpers,
107109
$this->authSimpleFactory,
108110
$this->authenticationService,
111+
$this->sspBridge,
109112
),
110113
new ScopeRule($this->requestParamsResolver, $this->helpers, $this->scopeRepository),
111114
new RequiredOpenIdScopeRule($this->requestParamsResolver, $this->helpers),

src/Server/RequestRules/Rules/MaxAgeRule.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace SimpleSAML\Module\oidc\Server\RequestRules\Rules;
66

77
use Psr\Http\Message\ServerRequestInterface;
8+
use SimpleSAML\Module\oidc\Bridges\SspBridge;
89
use SimpleSAML\Module\oidc\Factories\AuthSimpleFactory;
910
use SimpleSAML\Module\oidc\Helpers;
1011
use SimpleSAML\Module\oidc\Server\Exceptions\OidcServerException;
@@ -16,7 +17,6 @@
1617
use SimpleSAML\Module\oidc\Utils\RequestParamsResolver;
1718
use SimpleSAML\OpenID\Codebooks\HttpMethodsEnum;
1819
use SimpleSAML\OpenID\Codebooks\ParamsEnum;
19-
use SimpleSAML\Utils\HTTP;
2020

2121
class MaxAgeRule extends AbstractRule
2222
{
@@ -25,6 +25,7 @@ public function __construct(
2525
Helpers $helpers,
2626
private readonly AuthSimpleFactory $authSimpleFactory,
2727
private readonly AuthenticationService $authenticationService,
28+
private readonly SspBridge $sspBridge,
2829
) {
2930
parent::__construct($requestParamsResolver, $helpers);
3031
}
@@ -88,9 +89,10 @@ public function checkRule(
8889
if ($isExpired) {
8990
unset($requestParams['prompt']);
9091
$loginParams = [];
91-
// TODO mivanci Move to SspBridge
92-
$loginParams['ReturnTo'] = (new HTTP())
93-
->addURLParameters((new HTTP())->getSelfURLNoQuery(), $requestParams);
92+
$loginParams['ReturnTo'] = $this->sspBridge->utils()->http()->addURLParameters(
93+
$this->sspBridge->utils()->http()->getSelfURLNoQuery(),
94+
$requestParams,
95+
);
9496

9597
$this->authenticationService->authenticate($client, $loginParams);
9698
}

src/Services/Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ public function __construct()
375375
new RedirectUriRule($requestParamsResolver, $helpers),
376376
new RequestObjectRule($requestParamsResolver, $helpers, $jwksResolver),
377377
new PromptRule($requestParamsResolver, $helpers, $authSimpleFactory, $authenticationService),
378-
new MaxAgeRule($requestParamsResolver, $helpers, $authSimpleFactory, $authenticationService),
378+
new MaxAgeRule($requestParamsResolver, $helpers, $authSimpleFactory, $authenticationService, $sspBridge),
379379
new ScopeRule($requestParamsResolver, $helpers, $scopeRepository),
380380
new RequiredOpenIdScopeRule($requestParamsResolver, $helpers),
381381
new CodeChallengeRule($requestParamsResolver, $helpers),

0 commit comments

Comments
 (0)