Skip to content

Commit

Permalink
Repair the SelfVet ACS Controller
Browse files Browse the repository at this point in the history
The controller was not autoconfigurable fixed that by adding a service
definition.

And the MW client bundle command: SelfVetSecondFactorCommand was not
configured correctly. A none existant field was set on it. Repaired that

This actally fixed two PHPStan issues :hurray:
  • Loading branch information
MKodde committed May 22, 2024
1 parent 715f928 commit 3beac96
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
10 changes: 0 additions & 10 deletions ci/qa/phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,6 @@
'count' => 2,
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/SelfVet/SelfVetConsumeController.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, Surfnet\\\\StepupSelfService\\\\SelfServiceBundle\\\\Value\\\\SelfVetRequestId given\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/SelfVet/SelfVetConsumeController.php',
];
$ignoreErrors[] = [
'message' => '#^Property Surfnet\\\\StepupSelfService\\\\SelfServiceBundle\\\\Command\\\\SelfVetCommand\\:\\:\\$authoringLoa \\(string\\) does not accept string\\|null\\.$#',
'count' => 1,
Expand Down Expand Up @@ -886,11 +881,6 @@
'count' => 1,
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Service/RaLocationService.php',
];
$ignoreErrors[] = [
'message' => '#^Access to an undefined property Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Command\\\\SelfVetSecondFactorCommand\\:\\:\\$authoringSecondFactorLoa\\.$#',
'count' => 1,
'path' => __DIR__ . '/../../src/Surfnet/StepupSelfService/SelfServiceBundle/Service/SecondFactorService.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method getElements\\(\\) on Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\UnverifiedSecondFactorCollection\\|Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\VerifiedSecondFactorCollection\\|Surfnet\\\\StepupMiddlewareClientBundle\\\\Identity\\\\Dto\\\\VettedSecondFactorCollection\\|null\\.$#',
'count' => 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function consumeSelfVetAssertion(Request $httpRequest, string $secondFact
$samlLogger->error(
sprintf(
'Expected a response to the request with ID "%s", but the SAMLResponse was a response to a different request',
$initiatedRequestId
$initiatedRequestId->requestId()
)
);
throw new AuthenticationException('Unexpected InResponseTo in SAMLResponse');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,21 @@ services:
- '@surfnet_saml.http.redirect_binding'
- '@surfnet_saml.http.post_binding'
- '@surfnet_saml.hosted.service_provider'
- '@self_service.second_factor_test_idp'
- '@surfnet_saml.remote.idp'
- '@surfnet_saml.logger'
- '@logger'

Surfnet\StepupSelfService\SelfServiceBundle\Controller\SelfVet\SelfVetConsumeController:
arguments:
- "@logger"
- "@surfnet_stepup_self_service_self_service.service.second_factor"
- "@self_service.service.self_vet_marshaller"
- "@surfnet_saml.hosted.service_provider"
- '@surfnet_saml.remote.idp'
- "@surfnet_saml.http.post_binding"
- "@surfnet_saml.logger"
- "@request_stack"

surfnet_stepup_self_service_self_service.service.command:
class: Surfnet\StepupSelfService\SelfServiceBundle\Service\CommandService
arguments:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function selfVet(SelfVetCommand $command): bool
$apiCommand->secondFactorId = $command->secondFactor->secondFactorIdentifier;
$apiCommand->secondFactorType = $command->secondFactor->type;
$apiCommand->authorityId = $command->identity->id;
$apiCommand->authoringSecondFactorLoa = $command->authoringLoa;
$apiCommand->authoringSecondFactorIdentifier = $command->authoringLoa;

$result = $this->commandService->execute($apiCommand);
return $result->isSuccessful();
Expand Down

0 comments on commit 3beac96

Please sign in to comment.