-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust and bugfix self service features
Points brought up by running the global behat tests
- Loading branch information
Showing
14 changed files
with
161 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,29 @@ | ||
monolog: | ||
channels: | ||
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists | ||
handlers: | ||
prod-signaler: | ||
type: fingers_crossed | ||
action_level: ERROR | ||
passthru_level: NOTICE # this means that all message of level NOTICE or higher are always logged | ||
handler: main_stdout | ||
channels: [ "!event" ] | ||
handler: main_syslog | ||
bubble: false # if we handle it, nothing else should | ||
main_stdout: | ||
main_syslog: | ||
type: stream | ||
ident: stepup-selfservice | ||
path: "php://stderr" | ||
formatter: surfnet_stepup.monolog.json_formatter | ||
channels: [ "!event" ] | ||
|
||
when@dev: | ||
monolog: | ||
handlers: | ||
prod-signaler: | ||
action_level: ERROR | ||
passthru_level: DEBUG # DEV setting: this means that all message of level DEBUG or higher are always logged | ||
channels: [ "!event" ] | ||
bubble: true | ||
main_logfile: | ||
type: stream | ||
handler: logfile | ||
level: NOTICE | ||
path: "%kernel.logs_dir%/%kernel.environment%.log" | ||
deprecation: | ||
type: rotating_file | ||
path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log" | ||
max_files: 2 | ||
channels: [ deprecation ] | ||
|
||
when@test: | ||
monolog: | ||
handlers: | ||
main: | ||
type: fingers_crossed | ||
action_level: error | ||
handler: nested | ||
excluded_http_codes: [ 404, 405 ] | ||
channels: [ "!event" ] | ||
deprecation: | ||
type: rotating_file | ||
path: "%kernel.logs_dir%/%kernel.environment%.deprecations.log" | ||
max_files: 2 | ||
channels: [ deprecation ] | ||
nested: | ||
main_syslog: | ||
type: stream | ||
path: "%kernel.logs_dir%/%kernel.environment%.log" | ||
level: debug | ||
path: php://stderr | ||
level: error | ||
channels: ["!event", "!doctrine", "!deprecation", "!console"] | ||
console: | ||
type: console | ||
process_psr_3_messages: false | ||
channels: ["!event", "!doctrine", "!deprecation", "!console"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...rfnet/StepupSelfService/SelfServiceBundle/Service/YubikeySecondFactorServiceInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright 2024 SURFnet bv | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace Surfnet\StepupSelfService\SelfServiceBundle\Service; | ||
|
||
use Surfnet\StepupSelfService\SelfServiceBundle\Command\VerifyYubikeyOtpCommand; | ||
use Surfnet\StepupSelfService\SelfServiceBundle\Service\YubikeySecondFactor\ProofOfPossessionResult; | ||
|
||
interface YubikeySecondFactorServiceInterface | ||
{ | ||
/** | ||
* Verifies the OTP result status | ||
*/ | ||
public function provePossession(VerifyYubikeyOtpCommand $command): ProofOfPossessionResult; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/Surfnet/StepupSelfService/SelfServiceBundle/Service/YubikeyServiceInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright 2024 SURFnet bv | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace Surfnet\StepupSelfService\SelfServiceBundle\Service; | ||
|
||
use Surfnet\StepupSelfService\SelfServiceBundle\Command\VerifyYubikeyOtpCommand; | ||
|
||
interface YubikeyServiceInterface | ||
{ | ||
/** | ||
* Verifies the OTP result status | ||
*/ | ||
public function verify(VerifyYubikeyOtpCommand $command): YubikeyVerificationResult; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...epupSelfService/SelfServiceBundle/Tests/TestDouble/Service/YubikeySecondFactorService.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright 2024 SURFnet bv | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
namespace Surfnet\StepupSelfService\SelfServiceBundle\Tests\TestDouble\Service; | ||
|
||
use Psr\Log\LoggerInterface; | ||
use Surfnet\StepupMiddlewareClientBundle\Identity\Command\ProveYubikeyPossessionCommand; | ||
use Surfnet\StepupMiddlewareClientBundle\Uuid\Uuid; | ||
use Surfnet\StepupSelfService\SelfServiceBundle\Service\CommandService; | ||
use Surfnet\StepupSelfService\SelfServiceBundle\Command\VerifyYubikeyOtpCommand; | ||
use Surfnet\StepupSelfService\SelfServiceBundle\Service\YubikeySecondFactor\ProofOfPossessionResult; | ||
use Surfnet\StepupSelfService\SelfServiceBundle\Service\YubikeySecondFactorServiceInterface; | ||
|
||
|
||
/** | ||
* Serves a test double for : ApiBundle/Service/YubikeyService | ||
* | ||
* This service will accept any OtpDto that it is fed, always returning a OtpVerificationResult with status STATUS_OK | ||
*/ | ||
class YubikeySecondFactorService implements YubikeySecondFactorServiceInterface | ||
{ | ||
|
||
public function __construct( | ||
private readonly CommandService $commandService, | ||
private readonly LoggerInterface $logger) | ||
{ | ||
} | ||
|
||
public function provePossession(VerifyYubikeyOtpCommand $command): ProofOfPossessionResult | ||
{ | ||
$this->logger->info('Using the Fake Yubikey SF service. This always returns a successful response.'); | ||
$provePossessionCommand = new ProveYubikeyPossessionCommand(); | ||
$provePossessionCommand->identityId = $command->identity; | ||
$provePossessionCommand->secondFactorId = Uuid::generate(); | ||
$provePossessionCommand->yubikeyPublicId = '09999999'; | ||
$this->commandService->execute($provePossessionCommand); | ||
|
||
return ProofOfPossessionResult::secondFactorCreated($provePossessionCommand->secondFactorId); | ||
} | ||
} |
Oops, something went wrong.