Skip to content

Commit 765513f

Browse files
committed
Move to SspBridge in PromptRule
1 parent bd91dda commit 765513f

File tree

9 files changed

+14
-11
lines changed

9 files changed

+14
-11
lines changed

rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
]);
1717

1818
$rectorConfig->paths([
19-
// TODO mivanci also go trough commented out paths...
19+
// TODO v7 mivanci also go trough commented out paths...
2020
//__DIR__ . '/docker',
2121
//__DIR__ . '/hooks',
2222
//__DIR__ . '/public',

src/Factories/RequestRulesManagerFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ private function getDefaultRules(): array
102102
$this->helpers,
103103
$this->authSimpleFactory,
104104
$this->authenticationService,
105+
$this->sspBridge,
105106
),
106107
new MaxAgeRule(
107108
$this->requestParamsResolver,

src/ModuleConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public function config(): Configuration
234234
return $this->moduleConfig;
235235
}
236236

237-
// TODO mivanci Move to dedicated \SimpleSAML\Module\oidc\Utils\Routes::getModuleUrl
237+
// TODO mivanci v7 Move to dedicated \SimpleSAML\Module\oidc\Utils\Routes::getModuleUrl
238238
public function getModuleUrl(?string $path = null): string
239239
{
240240
$base = $this->sspBridge->module()->getModuleURL(self::MODULE_NAME);

src/Server/RequestRules/Rules/PromptRule.php

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

77
use League\OAuth2\Server\Exception\OAuthServerException;
88
use Psr\Http\Message\ServerRequestInterface;
9+
use SimpleSAML\Module\oidc\Bridges\SspBridge;
910
use SimpleSAML\Module\oidc\Factories\AuthSimpleFactory;
1011
use SimpleSAML\Module\oidc\Helpers;
1112
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 PromptRule 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
}
@@ -82,9 +83,10 @@ public function checkRule(
8283
if (in_array('login', $prompt, true) && $authSimple->isAuthenticated()) {
8384
unset($requestParams[ParamsEnum::Prompt->value]);
8485
$loginParams = [];
85-
// TODO mivanci move to SSP Bridge
86-
$loginParams['ReturnTo'] = (new HTTP())
87-
->addURLParameters((new HTTP())->getSelfURLNoQuery(), $requestParams);
86+
$loginParams['ReturnTo'] = $this->sspBridge->utils()->http()->addURLParameters(
87+
$this->sspBridge->utils()->http()->getSelfURLNoQuery(),
88+
$requestParams,
89+
);
8890

8991
$this->authenticationService->authenticate($client, $loginParams);
9092
}

src/Server/RequestRules/Rules/ResponseTypeRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function checkRule(
3838
throw OidcServerException::invalidRequest('Missing response_type or client_id');
3939
}
4040

41-
// TODO consider checking for supported response types, for example, from configuration...
41+
// TODO v7 consider checking for supported response types, for example, from configuration...
4242

4343
return new Result($this->getKey(), $requestParams[ParamsEnum::ResponseType->value]);
4444
}

src/Services/AuthenticationService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function processRequest(
8989
ServerRequestInterface $request,
9090
OAuth2AuthorizationRequest $authorizationRequest,
9191
): array {
92-
// TODO mivanci Fix: client has already been resolved up to this point, but we are again fetching it from DB.
92+
// TODO mivanci v7 Fix: client has already been resolved up to this point, but we are again fetching it from DB.
9393
$oidcClient = $this->helpers->client()->getFromRequest($request, $this->clientRepository);
9494
$authSimple = $this->authSimpleFactory->build($oidcClient);
9595

src/Services/Container.php

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

templates/config/protocol.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
<p>
9494
{% for scope, claims in moduleConfig.getScopes %}
9595
{{ scope }}{{ loop.last ? '' : ', ' }}
96-
{# TODO mivanci Add claims or extract scopes to sepparate page. #}
96+
{# TODO v7 mivanci Add claims or extract scopes to sepparate page. #}
9797
{% endfor %}
9898
</p>
9999

tests/unit/src/Controllers/Federation/EntityStatementControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function testCanGetConfigurationStatement(): void
9999
$this->moduleConfigMock->expects($this->once())->method('getFederationEnabled')->willReturn(true);
100100
$this->federationCacheMock->expects($this->once())->method('get')->willReturn(null);
101101

102-
// TODO mivanci
102+
// TODO v7 mivanci
103103
$this->markTestIncomplete('Move to simplesamlphp/openid library for building entity statements.');
104104
}
105105
}

0 commit comments

Comments
 (0)