Skip to content

Commit

Permalink
Changed Provider repo to viewConfig collection
Browse files Browse the repository at this point in the history
  • Loading branch information
parijke committed Dec 11, 2023
1 parent 84b8a50 commit 9954800
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ services:

Surfnet\StepupSelfService\SelfServiceBundle\Service\SecondFactorAvailabilityHelper:
arguments:
$providerRepository: '@gssp.provider_repository'
$viewConfigCollection: '@Surfnet\StepupBundle\Value\Provider\ViewConfigCollection'

self_service.service.locale_provider:
class: Surfnet\StepupSelfService\SelfServiceBundle\Service\LocaleProviderService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@

namespace Surfnet\StepupSelfService\SelfServiceBundle\Service;

use Surfnet\StepupSelfService\SamlStepupProviderBundle\Provider\ProviderRepository;

use Surfnet\StepupBundle\Value\Provider\ViewConfigCollection;
use Surfnet\StepupSelfService\SamlStepupProviderBundle\Provider\ViewConfig;
use Surfnet\StepupSelfService\SelfServiceBundle\Value\AvailableTokenCollection;

readonly class SecondFactorAvailabilityHelper
{
public function __construct(private ProviderRepository $providerRepository)
public function __construct(private ViewConfigCollection $viewConfigCollection)
{
}
// Based on a list of available SF types for the current identity
Expand All @@ -33,9 +35,9 @@ public function filter(SecondFactorTypeCollection $secondFactors): AvailableToke
{
$availableGsspSecondFactors = [];
foreach ($secondFactors->available as $index => $secondFactor) {
if ($this->providerRepository->has($secondFactor)) {
if ($this->viewConfigCollection->isGssp($secondFactor)) {
/** @var ViewConfig $secondFactorConfig */
$secondFactorConfig = $this->providerRepository->get($secondFactor);
$secondFactorConfig = $this->viewConfigCollection->getByIdentifier($secondFactor);
$availableGsspSecondFactors[$index] = $secondFactorConfig;
// Remove the gssp second factors from the regular second factors.
unset($secondFactors->available[$index]);
Expand Down

0 comments on commit 9954800

Please sign in to comment.