Skip to content

Commit b35d12d

Browse files
committed
Make rememberChoicePerIdp a public property on DiContainerRuntime
# If applied, this commit will... Make $rememberChoicePerIdp public on DiContainerRuntime and remove the isRememberChoicePerIdpEnabled() getter. # Why is this change needed? Prior to this change, this was the only property on this readonly class guarded by a private property plus getter; every sibling property is accessed directly, which was raised in review as redundant given the class is already readonly. # How does it address the issue? This change makes the property public, matching the rest of the class, and updates the four call sites and two unit test assertions to read $runtime->rememberChoicePerIdp directly. # Provide links to any relevant tickets, articles or other resources #2091
1 parent 1e6600f commit b35d12d

4 files changed

Lines changed: 7 additions & 12 deletions

File tree

‎library/EngineBlock/Corto/Module/Service/ContinueToIdp.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private function _persistRememberedChoice(ServiceProvider $sp, $idp, $rememberCh
141141

142142
if (!RememberedIdpCookie::isEnabledForServiceProvider(
143143
$container->getRememberChoice() === true,
144-
$runtime->isRememberChoicePerIdpEnabled(),
144+
$runtime->rememberChoicePerIdp,
145145
$sp
146146
)) {
147147
return;

‎library/EngineBlock/Corto/Module/Service/SingleSignOn.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function serve($serviceName, Request $httpRequest)
231231
// Auto-select IdP when 'wayf.rememberChoice' feature is enabled and is allowed for the current request,
232232
// and the per-SP remembered-choice feature is not enabled.
233233
$legacyRememberChoiceAllowed = $container->getRememberChoice() === true
234-
&& $runtime->isRememberChoicePerIdpEnabled() === false
234+
&& $runtime->rememberChoicePerIdp === false
235235
&& !$request->getForceAuthn()
236236
&& !$request->isDebugRequest();
237237

@@ -486,7 +486,7 @@ protected function _sendAuthenticationRequestForRememberedIdpPerServiceProvider(
486486

487487
$notEligibleForRememberedIdp = !RememberedIdpCookie::isEnabledForServiceProvider(
488488
$container->getRememberChoice() === true,
489-
$runtime->isRememberChoicePerIdpEnabled(),
489+
$runtime->rememberChoicePerIdp,
490490
$sp
491491
) || $request->getForceAuthn() || $request->isDebugRequest();
492492

@@ -553,7 +553,7 @@ protected function _showWayf(EngineBlock_Saml2_AuthnRequestAnnotationDecorator $
553553

554554
$diContainerRuntime = $application->getDiContainerRuntime();
555555

556-
$isRememberChoicePerIdpEnabled = $diContainerRuntime->isRememberChoicePerIdpEnabled();
556+
$isRememberChoicePerIdpEnabled = $diContainerRuntime->rememberChoicePerIdp;
557557
$rememberChoicePerIdp = RememberedIdpCookie::isEnabledForServiceProvider(
558558
$container->getRememberChoice() === true,
559559
$isRememberChoicePerIdpEnabled,

‎src/OpenConext/EngineBlockBundle/Bridge/DiContainerRuntime.php‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __construct(
4848
public FeedbackInfoCollectorInterface $feedbackInfoCollector,
4949
public LoginLogger $loginLogger,
5050
public RememberedIdpCookie $rememberedIdpCookie,
51-
private bool $rememberChoicePerIdp = false,
51+
public bool $rememberChoicePerIdp = false,
5252
private array $preferredIdpEntityIds = [],
5353
) {
5454
}
@@ -57,9 +57,4 @@ public function getPreferredIdpEntityIds(): array
5757
{
5858
return $this->preferredIdpEntityIds;
5959
}
60-
61-
public function isRememberChoicePerIdpEnabled(): bool
62-
{
63-
return $this->rememberChoicePerIdp;
64-
}
6560
}

‎tests/unit/OpenConext/EngineBlockBundle/DiContainerRuntimeTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ public function testIsRememberChoicePerIdpEnabledDefaultsToFalse(): void
6262
{
6363
$runtime = $this->runtimeFactory();
6464

65-
$this->assertFalse($runtime->isRememberChoicePerIdpEnabled());
65+
$this->assertFalse($runtime->rememberChoicePerIdp);
6666
}
6767

6868
public function testIsRememberChoicePerIdpEnabledReturnsConfiguredValue(): void
6969
{
7070
$runtime = $this->runtimeFactory(rememberChoicePerIdp: true);
7171

72-
$this->assertTrue($runtime->isRememberChoicePerIdpEnabled());
72+
$this->assertTrue($runtime->rememberChoicePerIdp);
7373
}
7474

7575
/**

0 commit comments

Comments
 (0)