From ae2f0bb40f0f7776ac47932ea0d5a71ee73bab3b Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Fri, 9 Mar 2018 14:35:43 +0100 Subject: [PATCH 01/17] Add gssp name to view config The user friendly name used for a GSSP was not yet specifically configured. This commit enforces the addition of a name entry in the view_config section of the gssp config. The DI configuration and the DI extension are configured to validate the GSSP name is actually set, and tag them for use in a collection later on. --- app/config/samlstepupproviders.yml | 2 ++ .../samlstepupproviders_parameters.yml.dist | 6 ++++++ .../DependencyInjection/Configuration.php | 12 ++++++++++++ ...SurfnetStepupRaSamlStepupProviderExtension.php | 6 ++++++ .../Provider/ViewConfig.php | 15 +++++++++++++++ .../Tests/Provider/ViewConfigTest.php | 3 +++ 6 files changed, 44 insertions(+) diff --git a/app/config/samlstepupproviders.yml b/app/config/samlstepupproviders.yml index 615857dc..2905a1a3 100644 --- a/app/config/samlstepupproviders.yml +++ b/app/config/samlstepupproviders.yml @@ -19,6 +19,7 @@ surfnet_stepup_ra_saml_stepup_provider: sso_url: %gssp_tiqr_remote_sso_url% certificate: %gssp_tiqr_remote_certificate% view_config: + name: %gssp_tiqr_name% page_title: %gssp_tiqr_page_title% explanation: %gssp_tiqr_explanation% initiate: %gssp_tiqr_initiate% @@ -36,6 +37,7 @@ surfnet_stepup_ra_saml_stepup_provider: sso_url: %gssp_biometric_remote_sso_url% certificate: %gssp_biometric_remote_certificate% view_config: + name: %gssp_biometric_name% page_title: %gssp_biometric_page_title% explanation: %gssp_biometric_explanation% initiate: %gssp_biometric_initiate% diff --git a/app/config/samlstepupproviders_parameters.yml.dist b/app/config/samlstepupproviders_parameters.yml.dist index bcddceb2..626a3c28 100644 --- a/app/config/samlstepupproviders_parameters.yml.dist +++ b/app/config/samlstepupproviders_parameters.yml.dist @@ -6,6 +6,9 @@ parameters: gssp_tiqr_remote_entity_id: 'https://actual-gssp.entity-id.tld' gssp_tiqr_remote_sso_url: 'https://actual-gssp.entity-id.tld/single-sign-on/url' gssp_tiqr_remote_certificate: 'The contents of the certificate published by the gssp' + gssp_tiqr_name: + en_GB: 'Tiqr' + nl_NL: 'Tiqr' gssp_tiqr_page_title: en_GB: 'EN ra.vetting.gssf.initiate.tiqr.title.page' nl_NL: 'NL ra.vetting.gssf.initiate.tiqr.title.page' @@ -25,6 +28,9 @@ parameters: gssp_biometric_remote_entity_id: 'https://actual-gssp.entity-id.tld' gssp_biometric_remote_sso_url: 'https://actual-gssp.entity-id.tld/single-sign-on/url' gssp_biometric_remote_certificate: 'The contents of the certificate published by the gssp' + gssp_biometric_name: + en_GB: 'Biometric' + nl_NL: 'Biometrisch' gssp_biometric_page_title: en_GB: 'EN ra.vetting.gssf.initiate.biometric.title.page' nl_NL: 'NL ra.vetting.gssf.initiate.biometric.title.page' diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php index f44dbe8a..ca5c08c8 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php @@ -134,6 +134,18 @@ private function addProvidersSection(ArrayNodeDefinition $rootNode) ->end() ->arrayNode('view_config') ->children() + ->arrayNode('name') + ->children() + ->scalarNode('en_GB') + ->isRequired() + ->info('English gssp name translation') + ->end() + ->scalarNode('nl_NL') + ->isRequired() + ->info('Dutch gssp name translation') + ->end() + ->end() + ->end() ->arrayNode('page_title') ->children() ->scalarNode('en_GB') diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index d22b75e3..d80b658b 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -28,6 +28,9 @@ class SurfnetStepupRaSamlStepupProviderExtension extends Extension { + + const VIEW_CONFIG_TAG_NAME = 'gssp.view_config'; + /** * {@inheritdoc} */ @@ -82,12 +85,15 @@ private function loadProviderConfiguration( $viewConfigDefinition = new Definition('Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfig', [ new Reference('request'), + $configuration['view_config']['name'], $configuration['view_config']['page_title'], $configuration['view_config']['explanation'], $configuration['view_config']['initiate'], $configuration['view_config']['gssf_id_mismatch'], ]); $viewConfigDefinition->setScope('request'); + $viewConfigDefinition->setPublic(false); + $viewConfigDefinition->addTag(self::VIEW_CONFIG_TAG_NAME); $container->setDefinition('gssp.view_config.' . $provider, $viewConfigDefinition); diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php index d8b96f40..88ecd78b 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php @@ -23,6 +23,10 @@ class ViewConfig { + /** + * @var array + */ + public $name; /** * @var array @@ -53,6 +57,7 @@ class ViewConfig * The arrays are arrays of translated text, indexed on locale. * * @param Request $request + * @param array $name * @param array $pageTitle * @param array $explanation * @param array $initiate @@ -61,18 +66,28 @@ class ViewConfig */ public function __construct( Request $request, + array $name, array $pageTitle, array $explanation, array $initiate, array $gssfIdMismatch ) { $this->request = $request; + $this->name = $name; $this->pageTitle = $pageTitle; $this->explanation = $explanation; $this->initiate = $initiate; $this->gssfIdMismatch = $gssfIdMismatch; } + /** + * @return array + */ + public function getName() + { + return $this->getTranslation($this->name); + } + /** * @return array */ diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php index a19e4abd..046aeaaa 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php @@ -37,12 +37,14 @@ public function view_config_translates_correctly() { $viewConfig = $this->buildViewConfig('nl_NL'); + $this->assertEquals('NL name', $viewConfig->getName()); $this->assertEquals('NL pageTitle', $viewConfig->getPageTitle()); $this->assertEquals('NL explanation', $viewConfig->getExplanation()); $this->assertEquals('NL initiate', $viewConfig->getInitiate()); $this->assertEquals('NL gssfIdMismatch', $viewConfig->getGssfIdMismatch()); $viewConfig = $this->buildViewConfig('en_GB'); + $this->assertEquals('EN name', $viewConfig->getName()); $this->assertEquals('EN pageTitle', $viewConfig->getPageTitle()); $this->assertEquals('EN explanation', $viewConfig->getExplanation()); $this->assertEquals('EN initiate', $viewConfig->getInitiate()); @@ -84,6 +86,7 @@ private function buildViewConfig($locale = '') $request->shouldReceive('getLocale')->andReturn($locale)->byDefault(); return new ViewConfig( $request, + $this->getTranslationsArray('name'), $this->getTranslationsArray('pageTitle'), $this->getTranslationsArray('explanation'), $this->getTranslationsArray('initiate'), From 2040b4f59470cf527643067cbbc79d8611cfa4c1 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Fri, 9 Mar 2018 14:42:50 +0100 Subject: [PATCH 02/17] Add a view config collection The ViewConfigCollection collects ViewConfig services that are tagged to be collected in the collection. This will help the SecondFactorTypeChoiceList that will be created at a later stage to display the correct GSSP name. --- .../Provider/ViewConfigCollection.php | 68 +++++++++++++++++++ .../Resources/config/services.yml | 4 ++ 2 files changed, 72 insertions(+) create mode 100644 src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfigCollection.php diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfigCollection.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfigCollection.php new file mode 100644 index 00000000..fee506bf --- /dev/null +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfigCollection.php @@ -0,0 +1,68 @@ +collection[$identifier] = $viewConfig; + } + + /** + * @param $identifier + * @return ViewConfig + */ + public function getByIdentifier($identifier) + { + if (isset($this->collection[$identifier])) { + return $this->collection[$identifier]; + } + throw new UnknownProviderException( + sprintf( + 'The provider identified by "%s" can not be found in the ViewConfigCollection', + $identifier + ) + ); + } + + /** + * @param $identifier + * @return bool + */ + public function isGssp($identifier) + { + return isset($this->collection[$identifier]); + } +} diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml index dadc0b56..9de52ad3 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml @@ -15,3 +15,7 @@ services: - '/' calls: - [setName, ['gssp']] + + gssp.provider.collection: + class: Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfigCollection + scope: request From 7ee3d9420dc2cbc402dcb4270cd6599a73e884db Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Fri, 9 Mar 2018 14:47:26 +0100 Subject: [PATCH 03/17] Add and configure view config compiler pass The ViewConfig collection that was previously created is now configured with a compiler pass. Any services tagged with VIEW_CONFIG_TAG_NAME are registered on the collection. The servicenames of the tagged service are regexed to distill the actual GSSP id. This can be safely done as the service is named in the DI container. If at any point the service base name is changed or a custom ViewConfig object is tagged in the service config. A validation is in place to check the input. --- .../Compiler/ViewConfigCollectionPass.php | 53 +++++++++++++++++++ ...urfnetStepupRaSamlStepupProviderBundle.php | 2 + 2 files changed, 55 insertions(+) create mode 100644 src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php new file mode 100644 index 00000000..2b16b412 --- /dev/null +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Compiler/ViewConfigCollectionPass.php @@ -0,0 +1,53 @@ +has('gssp.provider.collection')) { + return; + } + + $definition = $container->findDefinition('gssp.provider.collection'); + $taggedServices = $container->findTaggedServiceIds( + SurfnetStepupRaSamlStepupProviderExtension::VIEW_CONFIG_TAG_NAME + ); + + $taggedServices = array_keys($taggedServices); + + foreach ($taggedServices as $id) { + preg_match('/^gssp\.view_config\.(\w+)$/', $id, $gsspIdMatches); + if (!is_array($gsspIdMatches)) { + throw new InvalidConfigurationException('A manually tagged view config service was named incorrectly.'); + } + $definition->addMethodCall('addViewConfig', [new Reference($id), end($gsspIdMatches)]); + } + } +} diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php index f25d677d..04189bda 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/SurfnetStepupRaSamlStepupProviderBundle.php @@ -19,6 +19,7 @@ namespace Surfnet\StepupRa\SamlStepupProviderBundle; use Surfnet\StepupRa\SamlStepupProviderBundle\DependencyInjection\Compiler\StateHandlerSessionPass; +use Surfnet\StepupRa\SamlStepupProviderBundle\DependencyInjection\Compiler\ViewConfigCollectionPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; @@ -27,5 +28,6 @@ class SurfnetStepupRaSamlStepupProviderBundle extends Bundle public function build(ContainerBuilder $container) { $container->addCompilerPass(new StateHandlerSessionPass()); + $container->addCompilerPass(new ViewConfigCollectionPass()); } } From a1b72b240c8e38aa3d26d9b6248492f5eab2be1d Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Fri, 9 Mar 2018 14:50:19 +0100 Subject: [PATCH 04/17] Add the second factor type choice list This choice list acts as a type extension for the SearchRaSecondFactorsType. This list creates an array of choices that can be to populate the second factor type select list. --- .../Extension/SecondFactorTypeChoiceList.php | 118 ++++++++++++++++++ .../Form/Type/SearchRaSecondFactorsType.php | 17 ++- .../RaBundle/Resources/config/services.yml | 12 ++ 3 files changed, 142 insertions(+), 5 deletions(-) create mode 100644 src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php new file mode 100644 index 00000000..e933b3a1 --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php @@ -0,0 +1,118 @@ + 'SMS', + * 'yubi' => 'Yubikey', + * 'tiqr' => 'Tiqr' + * ] + * + * Translations should be provided in the translations file for this project and should follow the format specified in + * the 'translationIdFormat' field. + * + * A message is logged when the second factor type id cannot be translated. Second factor type id's that cannot be + * translated, are not added to the choice list. + */ +class SecondFactorTypeChoiceList +{ + private $translationIdFormat = 'ra.form.ra_search_ra_second_factors.choice.type.%s'; + /** + * @var SecondFactorTypeService + */ + private $secondFactorTypeService; + + /** + * @var ViewConfig + */ + private $gsspConfigCollection; + + /** + * @var TranslatorInterface + */ + private $translator; + + /** + * @var LoggerInterface + */ + private $logger; + + public function __construct( + SecondFactorTypeService $service, + ViewConfigCollection $gsspConfigCollection, + TranslatorInterface $translator, + LoggerInterface $logger + ) { + $this->secondFactorTypeService = $service; + $this->gsspConfigCollection = $gsspConfigCollection; + $this->translator = $translator; + $this->logger = $logger; + } + + /** + * @return array + */ + public function create() + { + $selectOptions = []; + $collection = $this->secondFactorTypeService->getAvailableSecondFactorTypes(); + + sort($collection); + + foreach ($collection as $sfTypeIdentifier) { + $translationId = sprintf($this->translationIdFormat, $sfTypeIdentifier); + + if ($this->gsspConfigCollection->isGssp($sfTypeIdentifier)) { + $translation = $this->gsspConfigCollection + ->getByIdentifier($sfTypeIdentifier) + ->getName(); + } else { + $translation = $this->translator->trans($translationId); + } + + // Test if the translator was able to translate the second factor type + if ($translationId === $translation) { + $this->logger->warning( + sprintf( + 'Unable to add a filter option on the second factor type select list for type: "%s"', + $sfTypeIdentifier + ) + ); + continue; + } + $selectOptions[$sfTypeIdentifier] = $translation; + } + + return $selectOptions; + } +} diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php index 8441ce17..b8ea9e3e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php @@ -18,12 +18,23 @@ namespace Surfnet\StepupRa\RaBundle\Form\Type; +use Surfnet\StepupRa\RaBundle\Form\Extension\SecondFactorTypeChoiceList; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; class SearchRaSecondFactorsType extends AbstractType { + /** + * @var SecondFactorTypeChoiceList + */ + private $secondFactorTypeChoiseList; + + public function __construct(SecondFactorTypeChoiceList $secondFactorTypeChoiceList) + { + $this->secondFactorTypeChoiseList = $secondFactorTypeChoiceList; + } + public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('name', null, [ @@ -31,11 +42,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) ]); $builder->add('type', 'choice', [ 'label' => 'ra.form.ra_search_ra_second_factors.label.type', - 'choices' => [ - 'sms' => 'ra.form.ra_search_ra_second_factors.choice.type.sms', - 'yubikey' => 'ra.form.ra_search_ra_second_factors.choice.type.yubikey', - 'tiqr' => 'ra.form.ra_search_ra_second_factors.choice.type.tiqr', - ], + 'choices' => $this->secondFactorTypeChoiseList->create(), 'required' => false, ]); $builder->add('secondFactorId', null, [ diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index aaa9493d..b0b49e8e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -48,7 +48,10 @@ services: ra.form.type.search_ra_second_factors: class: Surfnet\StepupRa\RaBundle\Form\Type\SearchRaSecondFactorsType + arguments: + - "@ra.form.extension.second_factor_type_choice_list" tags: [{ name: form.type, alias: ra_search_ra_second_factors }] + scope: request ra.form.type.ra_revoke_second_factor: class: Surfnet\StepupRa\RaBundle\Form\Type\RevokeSecondFactorType @@ -88,6 +91,15 @@ services: arguments: - "@surfnet_stepup_middleware_client.identity.service.institution_listing" + ra.form.extension.second_factor_type_choice_list: + class: Surfnet\StepupRa\RaBundle\Form\Extension\SecondFactorTypeChoiceList + arguments: + - "@surfnet_stepup.service.second_factor_type" + - "@gssp.provider.collection" + - "@translator" + - "@logger" + scope: request + # Services ra.service.vetting: class: Surfnet\StepupRa\RaBundle\Service\VettingService From f0fe330955cd2957199bad3756860afbc5b67342 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Fri, 9 Mar 2018 15:21:46 +0100 Subject: [PATCH 05/17] Stop using ViewConfig directly Use the gssp provider collection instead. --- .../StepupRa/RaBundle/Controller/Vetting/GssfController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index c3203f69..e65ccc2e 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -254,8 +254,8 @@ private function getVettingService() */ private function renderInitiateForm($procedureId, $provider, array $parameters = []) { - /** @var ViewConfig $secondFactorConfig */ - $secondFactorConfig = $this->get("gssp.view_config.{$provider}"); + $collection = $this->get("gssp.provider.collection"); + $secondFactorConfig = $collection->getByIdentifier($provider); $form = $this->createForm( 'ra_initiate_gssf', From 2f52d58a471b4683fbd6196237ad9e4b5964b11f Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Fri, 9 Mar 2018 15:32:52 +0100 Subject: [PATCH 06/17] Move translations and rescan The translations previously defined in the SF filter form are now added to the translations.html.twig file as they would otherwise be lost. The Tiqr translation is not added to this list as it is translated in by its ViewConfig representation. --- .../translations/messages.en_GB.xliff | 33 ++++++++----------- .../translations/messages.nl_NL.xliff | 33 ++++++++----------- .../Resources/views/translations.html.twig | 4 +++ 3 files changed, 32 insertions(+), 38 deletions(-) diff --git a/app/Resources/translations/messages.en_GB.xliff b/app/Resources/translations/messages.en_GB.xliff index 0acf41bc..7b383ec7 100644 --- a/app/Resources/translations/messages.en_GB.xliff +++ b/app/Resources/translations/messages.en_GB.xliff @@ -1,6 +1,6 @@ - +
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. @@ -338,72 +338,67 @@ ra.form.ra_search_ra_second_factors.button.export Export - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.button.search Search - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.choice.status.revoked Removed - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.choice.status.unverified Not verified - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.choice.status.verified Verified - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.choice.status.vetted Activated - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.choice.type.sms SMS - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php - - - ra.form.ra_search_ra_second_factors.choice.type.tiqr - Tiqr - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.ra_search_ra_second_factors.choice.type.yubikey Yubikey - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.ra_search_ra_second_factors.label.email E-mail - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.label.name Name - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.label.second_factor_id Token ID - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.label.status Status - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.label.type Type - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_select_institution.button.select_and_apply diff --git a/app/Resources/translations/messages.nl_NL.xliff b/app/Resources/translations/messages.nl_NL.xliff index a6248d87..e4656c74 100644 --- a/app/Resources/translations/messages.nl_NL.xliff +++ b/app/Resources/translations/messages.nl_NL.xliff @@ -1,6 +1,6 @@ - +
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. @@ -338,72 +338,67 @@ ra.form.ra_search_ra_second_factors.button.export Exporteren - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.button.search Zoek - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.choice.status.revoked Verwijderd - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.choice.status.unverified Niet geverifieerd - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.choice.status.verified Geverifieerd - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.choice.status.vetted Geactiveerd - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.choice.type.sms SMS - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php - - - ra.form.ra_search_ra_second_factors.choice.type.tiqr - Tiqr - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.ra_search_ra_second_factors.choice.type.yubikey Yubikey - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.ra_search_ra_second_factors.label.email E-mail - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.label.name Naam - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.label.second_factor_id Token-ID - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.label.status Status - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_search_ra_second_factors.label.type Type - /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php + /../src/Surfnet/StepupRa/RaBundle/Form/Type/SearchRaSecondFactorsType.php ra.form.ra_select_institution.button.select_and_apply diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig b/src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig index 6191101c..bd42b330 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig +++ b/src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig @@ -66,3 +66,7 @@ {# U2fController #} {{ 'ra.vetting.u2f.alert.device_reported_an_error'|trans }} {{ 'ra.vetting.u2f.alert.error'|trans }} + +{# Second factor type choise options #} +{{ 'ra.form.ra_search_ra_second_factors.choice.type.sms'|trans }} +{{ 'ra.form.ra_search_ra_second_factors.choice.type.yubikey'|trans }} \ No newline at end of file From fc2750011ce20543201d198d393b5a9d13c6d7c1 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Mon, 12 Mar 2018 09:58:32 +0100 Subject: [PATCH 07/17] Rename ViewConfig property from name to title From a consistency viewpoint it makes more sense to name the gssp name parameter 'title' instead of 'name'. This provides consistency between the SelfService and RA applications. --- app/config/samlstepupproviders.yml | 4 ++-- app/config/samlstepupproviders_parameters.yml.dist | 4 ++-- .../Form/Extension/SecondFactorTypeChoiceList.php | 2 +- .../DependencyInjection/Configuration.php | 6 +++--- .../SurfnetStepupRaSamlStepupProviderExtension.php | 2 +- .../SamlStepupProviderBundle/Provider/ViewConfig.php | 12 ++++++------ .../Tests/Provider/ViewConfigTest.php | 6 +++--- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/config/samlstepupproviders.yml b/app/config/samlstepupproviders.yml index 2905a1a3..25befcaa 100644 --- a/app/config/samlstepupproviders.yml +++ b/app/config/samlstepupproviders.yml @@ -19,7 +19,7 @@ surfnet_stepup_ra_saml_stepup_provider: sso_url: %gssp_tiqr_remote_sso_url% certificate: %gssp_tiqr_remote_certificate% view_config: - name: %gssp_tiqr_name% + title: %gssp_tiqr_title% page_title: %gssp_tiqr_page_title% explanation: %gssp_tiqr_explanation% initiate: %gssp_tiqr_initiate% @@ -37,7 +37,7 @@ surfnet_stepup_ra_saml_stepup_provider: sso_url: %gssp_biometric_remote_sso_url% certificate: %gssp_biometric_remote_certificate% view_config: - name: %gssp_biometric_name% + title: %gssp_biometric_title% page_title: %gssp_biometric_page_title% explanation: %gssp_biometric_explanation% initiate: %gssp_biometric_initiate% diff --git a/app/config/samlstepupproviders_parameters.yml.dist b/app/config/samlstepupproviders_parameters.yml.dist index 626a3c28..52751ff1 100644 --- a/app/config/samlstepupproviders_parameters.yml.dist +++ b/app/config/samlstepupproviders_parameters.yml.dist @@ -6,7 +6,7 @@ parameters: gssp_tiqr_remote_entity_id: 'https://actual-gssp.entity-id.tld' gssp_tiqr_remote_sso_url: 'https://actual-gssp.entity-id.tld/single-sign-on/url' gssp_tiqr_remote_certificate: 'The contents of the certificate published by the gssp' - gssp_tiqr_name: + gssp_tiqr_title: en_GB: 'Tiqr' nl_NL: 'Tiqr' gssp_tiqr_page_title: @@ -28,7 +28,7 @@ parameters: gssp_biometric_remote_entity_id: 'https://actual-gssp.entity-id.tld' gssp_biometric_remote_sso_url: 'https://actual-gssp.entity-id.tld/single-sign-on/url' gssp_biometric_remote_certificate: 'The contents of the certificate published by the gssp' - gssp_biometric_name: + gssp_biometric_title: en_GB: 'Biometric' nl_NL: 'Biometrisch' gssp_biometric_page_title: diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php index e933b3a1..4b57e986 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php @@ -95,7 +95,7 @@ public function create() if ($this->gsspConfigCollection->isGssp($sfTypeIdentifier)) { $translation = $this->gsspConfigCollection ->getByIdentifier($sfTypeIdentifier) - ->getName(); + ->getTitle(); } else { $translation = $this->translator->trans($translationId); } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php index ca5c08c8..b31f8214 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/Configuration.php @@ -134,15 +134,15 @@ private function addProvidersSection(ArrayNodeDefinition $rootNode) ->end() ->arrayNode('view_config') ->children() - ->arrayNode('name') + ->arrayNode('title') ->children() ->scalarNode('en_GB') ->isRequired() - ->info('English gssp name translation') + ->info('English gssp title translation') ->end() ->scalarNode('nl_NL') ->isRequired() - ->info('Dutch gssp name translation') + ->info('Dutch gssp title translation') ->end() ->end() ->end() diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index d80b658b..d75e1e39 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -85,7 +85,7 @@ private function loadProviderConfiguration( $viewConfigDefinition = new Definition('Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfig', [ new Reference('request'), - $configuration['view_config']['name'], + $configuration['view_config']['title'], $configuration['view_config']['page_title'], $configuration['view_config']['explanation'], $configuration['view_config']['initiate'], diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php index 88ecd78b..02682cdc 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php @@ -26,7 +26,7 @@ class ViewConfig /** * @var array */ - public $name; + public $title; /** * @var array @@ -57,7 +57,7 @@ class ViewConfig * The arrays are arrays of translated text, indexed on locale. * * @param Request $request - * @param array $name + * @param array $title * @param array $pageTitle * @param array $explanation * @param array $initiate @@ -66,14 +66,14 @@ class ViewConfig */ public function __construct( Request $request, - array $name, + array $title, array $pageTitle, array $explanation, array $initiate, array $gssfIdMismatch ) { $this->request = $request; - $this->name = $name; + $this->title = $title; $this->pageTitle = $pageTitle; $this->explanation = $explanation; $this->initiate = $initiate; @@ -83,9 +83,9 @@ public function __construct( /** * @return array */ - public function getName() + public function getTitle() { - return $this->getTranslation($this->name); + return $this->getTranslation($this->title); } /** diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php index 046aeaaa..ea305b0f 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php @@ -37,14 +37,14 @@ public function view_config_translates_correctly() { $viewConfig = $this->buildViewConfig('nl_NL'); - $this->assertEquals('NL name', $viewConfig->getName()); + $this->assertEquals('NL title', $viewConfig->getTitle()); $this->assertEquals('NL pageTitle', $viewConfig->getPageTitle()); $this->assertEquals('NL explanation', $viewConfig->getExplanation()); $this->assertEquals('NL initiate', $viewConfig->getInitiate()); $this->assertEquals('NL gssfIdMismatch', $viewConfig->getGssfIdMismatch()); $viewConfig = $this->buildViewConfig('en_GB'); - $this->assertEquals('EN name', $viewConfig->getName()); + $this->assertEquals('EN title', $viewConfig->getTitle()); $this->assertEquals('EN pageTitle', $viewConfig->getPageTitle()); $this->assertEquals('EN explanation', $viewConfig->getExplanation()); $this->assertEquals('EN initiate', $viewConfig->getInitiate()); @@ -86,7 +86,7 @@ private function buildViewConfig($locale = '') $request->shouldReceive('getLocale')->andReturn($locale)->byDefault(); return new ViewConfig( $request, - $this->getTranslationsArray('name'), + $this->getTranslationsArray('title'), $this->getTranslationsArray('pageTitle'), $this->getTranslationsArray('explanation'), $this->getTranslationsArray('initiate'), From 6e7d863bdb9aafb4eddff5872fa09052fed27d01 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Mon, 12 Mar 2018 10:11:46 +0100 Subject: [PATCH 08/17] Remove hardcoded validation on second factor types Hard coding these values is not the way to go. Sadly it's not possible to use a callback on the SecondFactorTypeService to retrieve them at runtime, as the 'getAvailableSecondFactorTypes' method cannot be called statically. Translations have been updated as we lost the 'ra.search_ra_second_factors.type.invalid_choice' message. Note that in extracting the translations, 'middleware_client.dto.configuration.verify_email.must_be_boolean' was added to the translations. This translation is left untranslated as it is not used in RA. --- app/Resources/translations/validators.en_GB.xliff | 10 +++++----- app/Resources/translations/validators.nl_NL.xliff | 10 +++++----- .../RaBundle/Command/ExportRaSecondFactorsCommand.php | 2 -- .../RaBundle/Command/SearchRaSecondFactorsCommand.php | 2 -- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/Resources/translations/validators.en_GB.xliff b/app/Resources/translations/validators.en_GB.xliff index e01a0ec1..d8bcd53e 100644 --- a/app/Resources/translations/validators.en_GB.xliff +++ b/app/Resources/translations/validators.en_GB.xliff @@ -1,6 +1,6 @@ - +
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. @@ -18,6 +18,10 @@ middleware_client.dto.configuration.use_ra_locations.must_be_boolean Use RA locations option must be boolean. + + middleware_client.dto.configuration.verify_email.must_be_boolean + middleware_client.dto.configuration.verify_email.must_be_boolean + middleware_client.dto.identity.common_name.must_be_string Remote identity common name must be a string. @@ -418,10 +422,6 @@ ra.search_ra_second_factors.status.invalid_choice Cannot filter by given status. - - ra.search_ra_second_factors.type.invalid_choice - Cannot filter by given token type. - ra.start_vetting_procedure.registration_code.may_not_be_empty Please enter the registration code the user has received by e-mail diff --git a/app/Resources/translations/validators.nl_NL.xliff b/app/Resources/translations/validators.nl_NL.xliff index 6837969f..45c47725 100644 --- a/app/Resources/translations/validators.nl_NL.xliff +++ b/app/Resources/translations/validators.nl_NL.xliff @@ -1,6 +1,6 @@ - +
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. @@ -19,6 +19,10 @@ Use RA locations option must be boolean. + + middleware_client.dto.configuration.verify_email.must_be_boolean + middleware_client.dto.configuration.verify_email.must_be_boolean + middleware_client.dto.identity.common_name.must_be_string Remote identity common name must be a string. @@ -419,10 +423,6 @@ ra.search_ra_second_factors.status.invalid_choice Kan niet filteren op de opgegeven status. - - ra.search_ra_second_factors.type.invalid_choice - Kan niet filteren op het opgegeven tokentype. - ra.start_vetting_procedure.registration_code.may_not_be_empty Typ hier de registratiecode die de gebruiker per e-mail heeft ontvangen. diff --git a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php index 08e3a346..ba8d4f14 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/ExportRaSecondFactorsCommand.php @@ -41,8 +41,6 @@ final class ExportRaSecondFactorsCommand public $name; /** - * @Assert\Choice({"sms", "yubikey", "tiqr"}, message="ra.search_ra_second_factors.type.invalid_choice") - * * @var string|null */ public $type; diff --git a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php index d76566f3..664271f7 100644 --- a/src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php +++ b/src/Surfnet/StepupRa/RaBundle/Command/SearchRaSecondFactorsCommand.php @@ -41,8 +41,6 @@ final class SearchRaSecondFactorsCommand public $name; /** - * @Assert\Choice({"sms", "yubikey", "tiqr"}, message="ra.search_ra_second_factors.type.invalid_choice") - * * @var string|null */ public $type; From ca3d232b268d49de5a554b4ef08b10170d55b849 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Mon, 12 Mar 2018 12:09:14 +0100 Subject: [PATCH 09/17] Revert use of scope request Instead of injecting the Request object (which enfoced using the request scope) inject the request stack instead. This commit includes the required change to the ViewConfig class and updates most of the service definitions in the DI configurations. Some are left for an upcoming commit. --- .../SurfnetStepupRaSamlStepupProviderExtension.php | 3 +-- .../Provider/ViewConfig.php | 13 +++++++------ .../Resources/config/services.yml | 1 - .../Tests/Provider/ViewConfigTest.php | 5 +++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php index d75e1e39..e09ff840 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/DependencyInjection/SurfnetStepupRaSamlStepupProviderExtension.php @@ -84,14 +84,13 @@ private function loadProviderConfiguration( $container->setDefinition('gssp.provider.' . $provider, $providerDefinition); $viewConfigDefinition = new Definition('Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfig', [ - new Reference('request'), + new Reference('request_stack'), $configuration['view_config']['title'], $configuration['view_config']['page_title'], $configuration['view_config']['explanation'], $configuration['view_config']['initiate'], $configuration['view_config']['gssf_id_mismatch'], ]); - $viewConfigDefinition->setScope('request'); $viewConfigDefinition->setPublic(false); $viewConfigDefinition->addTag(self::VIEW_CONFIG_TAG_NAME); diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php index 02682cdc..ed1968cf 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php @@ -20,6 +20,7 @@ use Surfnet\StepupRa\RaBundle\Exception\LogicException; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; class ViewConfig { @@ -49,14 +50,14 @@ class ViewConfig public $gssfIdMismatch; /** - * @var Request + * @var RequestStack */ - private $request; + private $requestStack; /** * The arrays are arrays of translated text, indexed on locale. * - * @param Request $request + * @param RequestStack $requestStack * @param array $title * @param array $pageTitle * @param array $explanation @@ -65,14 +66,14 @@ class ViewConfig * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - Request $request, + RequestStack $requestStack, array $title, array $pageTitle, array $explanation, array $initiate, array $gssfIdMismatch ) { - $this->request = $request; + $this->requestStack = $requestStack; $this->title = $title; $this->pageTitle = $pageTitle; $this->explanation = $explanation; @@ -127,7 +128,7 @@ public function getPageTitle() */ private function getTranslation(array $translations) { - $currentLocale = $this->request->getLocale(); + $currentLocale = $this->requestStack->getCurrentRequest()->getLocale(); if (is_null($currentLocale)) { throw new LogicException('The current language is not set'); } diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml index 9de52ad3..6c8a4fe4 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml @@ -18,4 +18,3 @@ services: gssp.provider.collection: class: Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfigCollection - scope: request diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php index ea305b0f..edb31233 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Tests/Provider/ViewConfigTest.php @@ -22,6 +22,7 @@ use PHPUnit_Framework_TestCase as TestCase; use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfig; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; /** * Tests the ViewConfig class @@ -82,8 +83,8 @@ public function view_config_cannot_serve_french_translations() */ private function buildViewConfig($locale = '') { - $request = m::mock(Request::class); - $request->shouldReceive('getLocale')->andReturn($locale)->byDefault(); + $request = m::mock(RequestStack::class); + $request->shouldReceive('getCurrentRequest->getLocale')->andReturn($locale)->byDefault(); return new ViewConfig( $request, $this->getTranslationsArray('title'), From cdbe6bbf588a4f3232aeb50669a566ed51dd8e31 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Mon, 12 Mar 2018 12:11:29 +0100 Subject: [PATCH 10/17] Move SF type translation logic to a service class The translation logic that was built into SecondFactorTypeChoiceList was moved to a separate translation service class. This class is injected into the SecondFactorTypeChoiceList. And will later be used by a Twig extension. --- .../Extension/SecondFactorTypeChoiceList.php | 38 +++------ .../SecondFactorTypeTranslationService.php | 83 +++++++++++++++++++ 2 files changed, 95 insertions(+), 26 deletions(-) create mode 100644 src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php index 4b57e986..60f5a360 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php @@ -18,12 +18,9 @@ namespace Surfnet\StepupRa\RaBundle\Form\Extension; - use Psr\Log\LoggerInterface; use Surfnet\StepupBundle\Service\SecondFactorTypeService; -use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfig; -use Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfigCollection; -use Symfony\Component\Translation\TranslatorInterface; +use Surfnet\StepupRa\RaBundle\Service\SecondFactorTypeTranslationService; /** * Used to build a choice list of second factor types @@ -38,27 +35,18 @@ * 'tiqr' => 'Tiqr' * ] * - * Translations should be provided in the translations file for this project and should follow the format specified in - * the 'translationIdFormat' field. - * * A message is logged when the second factor type id cannot be translated. Second factor type id's that cannot be * translated, are not added to the choice list. */ class SecondFactorTypeChoiceList { - private $translationIdFormat = 'ra.form.ra_search_ra_second_factors.choice.type.%s'; /** * @var SecondFactorTypeService */ private $secondFactorTypeService; /** - * @var ViewConfig - */ - private $gsspConfigCollection; - - /** - * @var TranslatorInterface + * @var SecondFactorTypeTranslationService */ private $translator; @@ -67,14 +55,16 @@ class SecondFactorTypeChoiceList */ private $logger; + /** + * @param SecondFactorTypeService $service + * @param SecondFactorTypeTranslationService $translator + */ public function __construct( SecondFactorTypeService $service, - ViewConfigCollection $gsspConfigCollection, - TranslatorInterface $translator, + SecondFactorTypeTranslationService $translator, LoggerInterface $logger ) { $this->secondFactorTypeService = $service; - $this->gsspConfigCollection = $gsspConfigCollection; $this->translator = $translator; $this->logger = $logger; } @@ -90,18 +80,14 @@ public function create() sort($collection); foreach ($collection as $sfTypeIdentifier) { - $translationId = sprintf($this->translationIdFormat, $sfTypeIdentifier); - if ($this->gsspConfigCollection->isGssp($sfTypeIdentifier)) { - $translation = $this->gsspConfigCollection - ->getByIdentifier($sfTypeIdentifier) - ->getTitle(); - } else { - $translation = $this->translator->trans($translationId); - } + $translation = $this->translator->translate( + $sfTypeIdentifier, + 'ra.form.ra_search_ra_second_factors.choice.type.%s' + ); // Test if the translator was able to translate the second factor type - if ($translationId === $translation) { + if ($sfTypeIdentifier === $translation) { $this->logger->warning( sprintf( 'Unable to add a filter option on the second factor type select list for type: "%s"', diff --git a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php new file mode 100644 index 00000000..149099fd --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php @@ -0,0 +1,83 @@ +gsspConfigCollection = $gsspConfigCollection; + $this->translator = $translator; + } + + /** + * @param string $secondFactorTypeId + * @param string $translationIdFormat The format used to read a translation from the Symfony translator. Should be + * compatible with sprintf. Where one string parameter represents the seconf + * factor type. Example 'ra.gssp_token.%s.title' + * @return string + */ + public function translate($secondFactorTypeId, $translationIdFormat) + { + $translationId = sprintf($translationIdFormat, $secondFactorTypeId); + + if ($this->gsspConfigCollection->isGssp($secondFactorTypeId)) { + // Attempt a gssp translation based on the gssp config + $translation = $this->gsspConfigCollection + ->getByIdentifier($secondFactorTypeId) + ->getTitle(); + } else { + // Attempt a regular symfony translation for any non gssp sf type. + $translation = $this->translator->trans($translationId); + } + + // If unable to translate, return the translation id, the user of this translator should decide how to handle + // this situation. + if ($translationId === $translation) { + return $secondFactorTypeId; + } + + return $translation; + } +} From 496ebef85465bad010e75bd2dc9e5ddfa7589ed7 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Mon, 12 Mar 2018 12:12:47 +0100 Subject: [PATCH 11/17] Add Twig extension for SF type translations A Twig extension was used to provide a specific second factor type trans filter. This filter utilizes the translation service that was added in the previous commit. --- .../views/SecondFactor/search.html.twig | 2 +- .../Extensions/Extension/SecondFactorType.php | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/SecondFactor/search.html.twig b/src/Surfnet/StepupRa/RaBundle/Resources/views/SecondFactor/search.html.twig index 58b571cf..f0dcb968 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/SecondFactor/search.html.twig +++ b/src/Surfnet/StepupRa/RaBundle/Resources/views/SecondFactor/search.html.twig @@ -30,7 +30,7 @@ {% for secondFactor in secondFactors.elements %} {{ secondFactor.secondFactorId }} - {{ ('ra.second_factor.search.type.'~secondFactor.type)|trans }} + {{ secondFactor.type|trans_second_factor_type }} {{ secondFactor.name }} {{ secondFactor.email }} {% if secondFactor.documentNumber is not empty %}{{ secondFactor.documentNumber}}{% else %}—{% endif %} diff --git a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php new file mode 100644 index 00000000..014552d0 --- /dev/null +++ b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php @@ -0,0 +1,53 @@ +translator = $translator; + } + + public function getName() + { + return 'ra.twig.second_factor_type'; + } + + public function getFilters() + { + return [ + new Twig_SimpleFilter('trans_second_factor_type', [$this, 'translateSecondFactorType']), + ]; + } + + public function translateSecondFactorType($secondFactorType) + { + return $this->translator->translate($secondFactorType, 'ra.second_factor.search.type.%s'); + } +} From 212fa813331a2a15260f10f4c92b010cf0611cd8 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Mon, 12 Mar 2018 12:13:02 +0100 Subject: [PATCH 12/17] Update of services.yml --- .../RaBundle/Resources/config/services.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index b0b49e8e..b02b0543 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -51,7 +51,6 @@ services: arguments: - "@ra.form.extension.second_factor_type_choice_list" tags: [{ name: form.type, alias: ra_search_ra_second_factors }] - scope: request ra.form.type.ra_revoke_second_factor: class: Surfnet\StepupRa\RaBundle\Form\Type\RevokeSecondFactorType @@ -95,10 +94,8 @@ services: class: Surfnet\StepupRa\RaBundle\Form\Extension\SecondFactorTypeChoiceList arguments: - "@surfnet_stepup.service.second_factor_type" - - "@gssp.provider.collection" - - "@translator" + - "@ra.service.second_factor_type_translator" - "@logger" - scope: request # Services ra.service.vetting: @@ -233,6 +230,12 @@ services: - "@surfnet_stepup_middleware_client.identity.service.second_factor" - "@logger" + ra.service.second_factor_type_translator: + class: Surfnet\StepupRa\RaBundle\Service\SecondFactorTypeTranslationService + arguments: + - "@gssp.provider.collection" + - "@translator" + ra.service.global_view_parameters: class: Surfnet\StepupRa\RaBundle\Service\GlobalViewParameters arguments: @@ -280,3 +283,10 @@ services: class: Surfnet\StepupRa\RaBundle\Twig\InstitutionConfigurationOptions arguments: - "@security.token_storage" + + ra.twig.second_factor_type: + class: Surfnet\StepupRa\RaBundle\Twig\Extensions\Extension\SecondFactorType + arguments: + - "@ra.service.second_factor_type_translator" + tags: + - { name : twig.extension } From 0428ac3f648cd60a82aa7b4c99ce605851cf937f Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Wed, 14 Mar 2018 11:54:48 +0100 Subject: [PATCH 13/17] Move ViewConfigCollection to Stepup-bundle To be able to collect the ViewConfig objects that live in the SS and RA projects. The Stepup-bundle ViewConfigCollection now collects ViewConfigInterface instances. This required a ViewConfigInterface implementation in the RA project. The parts of the RA application that use the ViewConfigCollection are updated to use the one from the bundle instead. The DI config was updated and usages where changed accordingly. Updated classes include: - ViewConfigCollectionPass - SecondFactorTypeTranslationService --- .../Controller/Vetting/GssfController.php | 2 +- .../RaBundle/Resources/config/services.yml | 2 +- .../SecondFactorTypeTranslationService.php | 5 +- .../Compiler/ViewConfigCollectionPass.php | 4 +- .../Provider/ViewConfig.php | 4 +- .../Provider/ViewConfigCollection.php | 68 ------------------- .../Resources/config/services.yml | 3 - 7 files changed, 8 insertions(+), 80 deletions(-) delete mode 100644 src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfigCollection.php diff --git a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php index e65ccc2e..d781549b 100644 --- a/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php +++ b/src/Surfnet/StepupRa/RaBundle/Controller/Vetting/GssfController.php @@ -254,7 +254,7 @@ private function getVettingService() */ private function renderInitiateForm($procedureId, $provider, array $parameters = []) { - $collection = $this->get("gssp.provider.collection"); + $collection = $this->get("surfnet_stepup.provider.collection"); $secondFactorConfig = $collection->getByIdentifier($provider); $form = $this->createForm( diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index b02b0543..aded0481 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -233,7 +233,7 @@ services: ra.service.second_factor_type_translator: class: Surfnet\StepupRa\RaBundle\Service\SecondFactorTypeTranslationService arguments: - - "@gssp.provider.collection" + - "@surfnet_stepup.provider.collection" - "@translator" ra.service.global_view_parameters: diff --git a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php index 149099fd..89b98dbc 100644 --- a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php +++ b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php @@ -1,7 +1,7 @@ has('gssp.provider.collection')) { + if (!$container->has('surfnet_stepup.provider.collection')) { return; } - $definition = $container->findDefinition('gssp.provider.collection'); + $definition = $container->findDefinition('surfnet_stepup.provider.collection'); $taggedServices = $container->findTaggedServiceIds( SurfnetStepupRaSamlStepupProviderExtension::VIEW_CONFIG_TAG_NAME ); diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php index ed1968cf..0a5fbbf7 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfig.php @@ -18,11 +18,11 @@ namespace Surfnet\StepupRa\SamlStepupProviderBundle\Provider; +use Surfnet\StepupBundle\Value\Provider\ViewConfigInterface; use Surfnet\StepupRa\RaBundle\Exception\LogicException; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; -class ViewConfig +class ViewConfig implements ViewConfigInterface { /** * @var array diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfigCollection.php b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfigCollection.php deleted file mode 100644 index fee506bf..00000000 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Provider/ViewConfigCollection.php +++ /dev/null @@ -1,68 +0,0 @@ -collection[$identifier] = $viewConfig; - } - - /** - * @param $identifier - * @return ViewConfig - */ - public function getByIdentifier($identifier) - { - if (isset($this->collection[$identifier])) { - return $this->collection[$identifier]; - } - throw new UnknownProviderException( - sprintf( - 'The provider identified by "%s" can not be found in the ViewConfigCollection', - $identifier - ) - ); - } - - /** - * @param $identifier - * @return bool - */ - public function isGssp($identifier) - { - return isset($this->collection[$identifier]); - } -} diff --git a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml index 6c8a4fe4..dadc0b56 100644 --- a/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/SamlStepupProviderBundle/Resources/config/services.yml @@ -15,6 +15,3 @@ services: - '/' calls: - [setName, ['gssp']] - - gssp.provider.collection: - class: Surfnet\StepupRa\SamlStepupProviderBundle\Provider\ViewConfigCollection From 15d66215af188a6c5fc06a4400d1302acd7be46b Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Wed, 14 Mar 2018 11:59:42 +0100 Subject: [PATCH 14/17] Translate SF types in audit log This came up while investigating the audit logs. This is a perfect opportunity to use the trans_second_factor_type filter. --- .../RaBundle/Resources/views/SecondFactor/auditLog.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/SecondFactor/auditLog.html.twig b/src/Surfnet/StepupRa/RaBundle/Resources/views/SecondFactor/auditLog.html.twig index 238b0497..ceb14fc5 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/SecondFactor/auditLog.html.twig +++ b/src/Surfnet/StepupRa/RaBundle/Resources/views/SecondFactor/auditLog.html.twig @@ -30,7 +30,7 @@ {% for logEntry in auditLog.elements %} {{ logEntry.secondFactorIdentifier }} - {{ logEntry.secondFactorType }} + {{ logEntry.secondFactorType|trans_second_factor_type }} {{ ('ra.auditlog.action.' ~ logEntry.action)|trans }} {{ logEntry.actorCommonName }} From 62e332e12d24b8fea50c2c50547591e462db783b Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Wed, 14 Mar 2018 13:17:15 +0100 Subject: [PATCH 15/17] Move SecondFactorTypeTranslationService to Stepup-bundle As SelfService and RA will both use this service is will be moved to the stepup bundle. --- .../Extension/SecondFactorTypeChoiceList.php | 2 +- .../RaBundle/Resources/config/services.yml | 10 +-- .../SecondFactorTypeTranslationService.php | 82 ------------------- .../Extensions/Extension/SecondFactorType.php | 2 +- 4 files changed, 4 insertions(+), 92 deletions(-) delete mode 100644 src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php diff --git a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php index 60f5a360..14820a06 100644 --- a/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php +++ b/src/Surfnet/StepupRa/RaBundle/Form/Extension/SecondFactorTypeChoiceList.php @@ -20,7 +20,7 @@ use Psr\Log\LoggerInterface; use Surfnet\StepupBundle\Service\SecondFactorTypeService; -use Surfnet\StepupRa\RaBundle\Service\SecondFactorTypeTranslationService; +use Surfnet\StepupBundle\Service\SecondFactorTypeTranslationService; /** * Used to build a choice list of second factor types diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml index aded0481..4f51d834 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml +++ b/src/Surfnet/StepupRa/RaBundle/Resources/config/services.yml @@ -94,7 +94,7 @@ services: class: Surfnet\StepupRa\RaBundle\Form\Extension\SecondFactorTypeChoiceList arguments: - "@surfnet_stepup.service.second_factor_type" - - "@ra.service.second_factor_type_translator" + - "@surfnet_stepup.service.second_factor_type_translator" - "@logger" # Services @@ -230,12 +230,6 @@ services: - "@surfnet_stepup_middleware_client.identity.service.second_factor" - "@logger" - ra.service.second_factor_type_translator: - class: Surfnet\StepupRa\RaBundle\Service\SecondFactorTypeTranslationService - arguments: - - "@surfnet_stepup.provider.collection" - - "@translator" - ra.service.global_view_parameters: class: Surfnet\StepupRa\RaBundle\Service\GlobalViewParameters arguments: @@ -287,6 +281,6 @@ services: ra.twig.second_factor_type: class: Surfnet\StepupRa\RaBundle\Twig\Extensions\Extension\SecondFactorType arguments: - - "@ra.service.second_factor_type_translator" + - "@surfnet_stepup.service.second_factor_type_translator" tags: - { name : twig.extension } diff --git a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php b/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php deleted file mode 100644 index 89b98dbc..00000000 --- a/src/Surfnet/StepupRa/RaBundle/Service/SecondFactorTypeTranslationService.php +++ /dev/null @@ -1,82 +0,0 @@ -gsspConfigCollection = $gsspConfigCollection; - $this->translator = $translator; - } - - /** - * @param string $secondFactorTypeId - * @param string $translationIdFormat The format used to read a translation from the Symfony translator. Should be - * compatible with sprintf. Where one string parameter represents the seconf - * factor type. Example 'ra.gssp_token.%s.title' - * @return string - */ - public function translate($secondFactorTypeId, $translationIdFormat) - { - $translationId = sprintf($translationIdFormat, $secondFactorTypeId); - - if ($this->gsspConfigCollection->isGssp($secondFactorTypeId)) { - // Attempt a gssp translation based on the gssp config - $translation = $this->gsspConfigCollection - ->getByIdentifier($secondFactorTypeId) - ->getTitle(); - } else { - // Attempt a regular symfony translation for any non gssp sf type. - $translation = $this->translator->trans($translationId); - } - - // If unable to translate, return the translation id, the user of this translator should decide how to handle - // this situation. - if ($translationId === $translation) { - return $secondFactorTypeId; - } - - return $translation; - } -} diff --git a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php index 014552d0..5b0711fd 100644 --- a/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php +++ b/src/Surfnet/StepupRa/RaBundle/Twig/Extensions/Extension/SecondFactorType.php @@ -18,7 +18,7 @@ namespace Surfnet\StepupRa\RaBundle\Twig\Extensions\Extension; -use Surfnet\StepupRa\RaBundle\Service\SecondFactorTypeTranslationService; +use Surfnet\StepupBundle\Service\SecondFactorTypeTranslationService; use Twig_Extension; use Twig_SimpleFilter; From a61fc7b36db0f0df1edd934d38a9d24adb8f6bf6 Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Wed, 14 Mar 2018 14:31:53 +0100 Subject: [PATCH 16/17] Upgrade stepup-bundle to 3.2.0 --- composer.json | 2 +- composer.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 2af5d8c8..0e15d36b 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "jms/translation-bundle": "~1.3.0", "jms/di-extra-bundle": "~1.4.0", "surfnet/stepup-middleware-client-bundle": "^2.0", - "surfnet/stepup-bundle": "^3.0", + "surfnet/stepup-bundle": "^3.2", "surfnet/stepup-u2f-bundle": "dev-develop", "guzzlehttp/guzzle": "^6", "knplabs/knp-paginator-bundle": "~2.4", diff --git a/composer.lock b/composer.lock index 1f2efcd0..59164526 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "d539a0fc966484aa4d5c257d4bd97a26", + "content-hash": "6430f5ef57cda9f51ebef7dd3658aeef", "packages": [ { "name": "beberlei/assert", @@ -2210,16 +2210,16 @@ }, { "name": "surfnet/stepup-bundle", - "version": "3.0.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/OpenConext/Stepup-bundle.git", - "reference": "4564d2b468a9a9a0bcfa6356e055aacbd3c4e4f0" + "reference": "547c5bcb8fe1841fa657bbf43c5ea4b8e575ec3a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/OpenConext/Stepup-bundle/zipball/4564d2b468a9a9a0bcfa6356e055aacbd3c4e4f0", - "reference": "4564d2b468a9a9a0bcfa6356e055aacbd3c4e4f0", + "url": "https://api.github.com/repos/OpenConext/Stepup-bundle/zipball/547c5bcb8fe1841fa657bbf43c5ea4b8e575ec3a", + "reference": "547c5bcb8fe1841fa657bbf43c5ea4b8e575ec3a", "shasum": "" }, "require": { @@ -2263,7 +2263,7 @@ "suaas", "surfnet" ], - "time": "2017-11-30T07:47:43+00:00" + "time": "2018-03-14T13:11:17+00:00" }, { "name": "surfnet/stepup-middleware-client-bundle", From 08bddf80bc960afdce0ced23f169b5326c16fd6d Mon Sep 17 00:00:00 2001 From: Michiel Kodde Date: Wed, 14 Mar 2018 15:38:20 +0100 Subject: [PATCH 17/17] Make disabled token type text reusable --- .../translations/messages.en_GB.xliff | 108 +++++++----------- .../translations/messages.nl_NL.xliff | 108 +++++++----------- .../secondFactorTypeDisabled.html.twig | 2 +- .../Resources/views/translations.html.twig | 7 -- 4 files changed, 89 insertions(+), 136 deletions(-) diff --git a/app/Resources/translations/messages.en_GB.xliff b/app/Resources/translations/messages.en_GB.xliff index 7b383ec7..6eb07411 100644 --- a/app/Resources/translations/messages.en_GB.xliff +++ b/app/Resources/translations/messages.en_GB.xliff @@ -1,6 +1,6 @@ - +
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. @@ -35,72 +35,72 @@ ra.auditlog.action.accredited_as_ra Accredited as RA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.accredited_as_raa Accredited as RAA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.appointed_as_ra Appointed as RA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.appointed_as_raa Appointed as RAA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.bootstrapped Identity and Token bootstrapped - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.created Identity Created - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.email_changed E-mail changed - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.email_verified E-mail verified - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.possession_proven Token possession proven - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.renamed Name changed - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.retracted_as_ra Removed as RA(A) - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.revoked Token revoked - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.revoked_by_ra Token revoked by RA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.vetted Token vetted - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.actor @@ -287,12 +287,12 @@ ra.form.extension.ra_role_choice.ra RA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.extension.ra_role_choice.raa RAA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.ra_create_ra_location.label.cancel @@ -368,12 +368,12 @@ ra.form.ra_search_ra_second_factors.choice.type.sms SMS - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.ra_search_ra_second_factors.choice.type.yubikey Yubikey - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.ra_search_ra_second_factors.label.email @@ -479,7 +479,7 @@ ra.management.amend_ra_info.error.middleware_command_failed The amendment of the RA's information failed due to a server error. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.management.amend_ra_info.info_amended @@ -567,7 +567,7 @@ ra.management.create_ra.error.middleware_command_failed The identity could not be granted the chosen role due to a server error. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.management.create_ra.identity_accredited @@ -743,17 +743,17 @@ ra.management.overview.role.value.ra RA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.management.overview.role.value.raa RAA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.management.overview.role.value.sraa SRAA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.management.overview.update_information @@ -833,22 +833,22 @@ ra.prove_phone_possession.challenge_expired Your code has expired. Please request a new code. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.prove_phone_possession.challenge_response_incorrect This code is not correct. Please try again or request a new code. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.prove_phone_possession.too_many_attempts You have exceeded the limit of ten attempts; you can no longer attempt verification of any more codes. Contact your helpdesk or try again later. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.prove_yubikey_possession.different_yubikey_used A different Yubikey was used by the user during the registration process. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.ra_location.change.title @@ -1040,22 +1040,22 @@ ra.second_factor.search.status.revoked Removed - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.status.unverified Not verified - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.status.verified Verified - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.status.vetted Activated - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.text.no_second_factors @@ -1075,22 +1075,17 @@ ra.second_factor.search.type.sms SMS - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig - - - ra.second_factor.search.type.tiqr - Tiqr - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.type.u2f U2F - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.type.yubikey Yubikey - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.secondfactor.auditlog @@ -1120,7 +1115,7 @@ ra.sms_send_challenge.send_sms_challenge_failed The sending of the code via SMS failed. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.sraa.changed_institution @@ -1147,12 +1142,12 @@ ra.verify_yubikey_command.otp.otp_invalid The Yubikey code was invalid. Please try again. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.verify_yubikey_command.otp.verification_error The Yubikey code could not be verified due to unknown reasons. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.vetting.button.cancel_procedure @@ -1191,25 +1186,10 @@ Verify identity /../src/Surfnet/StepupRa/RaBundle/Resources/views/Vetting/partial/progressBar.html.twig - - ra.vetting.second_factor_type_disabled.text.explanation.sms - The token type SMS is currently disabled. Please contact your helpdesk to correct this problem. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig - - - ra.vetting.second_factor_type_disabled.text.explanation.tiqr - The token type Tiqr is currently disabled. Please contact your helpdesk to correct this problem. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig - - - ra.vetting.second_factor_type_disabled.text.explanation.u2f - The token type U2F is currently disabled. Please contact your helpdesk to correct this problem. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig - - - ra.vetting.second_factor_type_disabled.text.explanation.yubikey - The token type Yubikey is currently disabled. Please contact your helpdesk to correct this problem. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + + ra.vetting.second_factor_type_disabled.text.explanation + Tokens of type %token_name% cannot be vetted. This token type has been disabled. + /../src/Surfnet/StepupRa/RaBundle/Resources/views/Vetting/secondFactorTypeDisabled.html.twig ra.vetting.second_factor_type_disabled.title @@ -1269,12 +1249,12 @@ ra.vetting.u2f.alert.device_reported_an_error The U2F device reported an error. Try again or visit your IT helpdesk. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.vetting.u2f.alert.error The authentication using the U2F device failed. Try again or visit your IT helpdesk. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.vetting.u2f.button.authenticate diff --git a/app/Resources/translations/messages.nl_NL.xliff b/app/Resources/translations/messages.nl_NL.xliff index e4656c74..e47c0246 100644 --- a/app/Resources/translations/messages.nl_NL.xliff +++ b/app/Resources/translations/messages.nl_NL.xliff @@ -1,6 +1,6 @@ - +
The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message. @@ -35,72 +35,72 @@ ra.auditlog.action.accredited_as_ra Geaccrediteerd als RA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.accredited_as_raa Geaccrediteerd als RAA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.appointed_as_ra RA rol toegewezen gekregen - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.appointed_as_raa RAA rol toegewezen gekregen - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.bootstrapped Identiteit en Token gebootstrapped - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.created Identiteit aangemaakt - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.email_changed E-mail gewijzigd - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.email_verified E-mail geverifieerd - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.possession_proven Bezit aangetoond - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.renamed Naam gewijzigd - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.retracted_as_ra Verwijderd als RA(A) - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.revoked Token verwijderd - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.revoked_by_ra Token verwijderd door RA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.action.vetted Token gevet - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.auditlog.actor @@ -287,12 +287,12 @@ ra.form.extension.ra_role_choice.ra RA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.extension.ra_role_choice.raa RAA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.ra_create_ra_location.label.cancel @@ -368,12 +368,12 @@ ra.form.ra_search_ra_second_factors.choice.type.sms SMS - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.ra_search_ra_second_factors.choice.type.yubikey Yubikey - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.form.ra_search_ra_second_factors.label.email @@ -479,7 +479,7 @@ ra.management.amend_ra_info.error.middleware_command_failed Het wijzigen van de gegevens van de RA is mislukt vanwege een serverfout. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.management.amend_ra_info.info_amended @@ -567,7 +567,7 @@ ra.management.create_ra.error.middleware_command_failed De gekozen rol kon niet aan de identiteit toegekend worden vanwege een serverfout. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.management.create_ra.identity_accredited @@ -743,17 +743,17 @@ ra.management.overview.role.value.ra RA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.management.overview.role.value.raa RAA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.management.overview.role.value.sraa SRAA - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.management.overview.update_information @@ -833,22 +833,22 @@ ra.prove_phone_possession.challenge_expired Uw code is verlopen. Vraag een nieuwe code aan. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.prove_phone_possession.challenge_response_incorrect Deze code is niet juist. Probeer het nog eens, of vraag een nieuwe code op. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.prove_phone_possession.too_many_attempts U heeft de limiet van tien pogingen bereikt; u kunt geen codes meer verifiëren. Neem contact op met uw helpdesk of probeer het later nog eens. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.prove_yubikey_possession.different_yubikey_used Tijdens het registratieproces heeft de gebruiker een andere Yubikey gebruikt. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.ra_location.change.title @@ -1040,22 +1040,22 @@ ra.second_factor.search.status.revoked Verwijderd - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.status.unverified Niet geverifieerd - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.status.verified Geverifieerd - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.status.vetted Geactiveerd - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.text.no_second_factors @@ -1075,22 +1075,17 @@ ra.second_factor.search.type.sms SMS - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig - - - ra.second_factor.search.type.tiqr - Tiqr - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.type.u2f U2F - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.second_factor.search.type.yubikey Yubikey - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.secondfactor.auditlog @@ -1120,7 +1115,7 @@ ra.sms_send_challenge.send_sms_challenge_failed Het versturen van de SMS-code is mislukt. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.sraa.changed_institution @@ -1147,12 +1142,12 @@ ra.verify_yubikey_command.otp.otp_invalid De Yubikey code is ongeldig. Probeer het nog eens - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.verify_yubikey_command.otp.verification_error De Yubikey-code kon om onbekende redenen niet geverifieerd worden. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.vetting.button.cancel_procedure @@ -1191,25 +1186,10 @@ Identiteit controleren /../src/Surfnet/StepupRa/RaBundle/Resources/views/Vetting/partial/progressBar.html.twig - - ra.vetting.second_factor_type_disabled.text.explanation.sms - Het tokentype SMS is uitgeschakeld. Neem contact op met de helpdesk om dit probleem te verhelpen. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig - - - ra.vetting.second_factor_type_disabled.text.explanation.tiqr - Het tokentype Tiqr is uitgeschakeld. Neem contact op met de helpdesk om dit probleem te verhelpen. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig - - - ra.vetting.second_factor_type_disabled.text.explanation.u2f - Het tokentype U2F is uitgeschakeld. Neem contact op met de helpdesk om dit probleem te verhelpen. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig - - - ra.vetting.second_factor_type_disabled.text.explanation.yubikey - Het tokentype Yubikey is uitgeschakeld. Neem contact op met de helpdesk om dit probleem te verhelpen. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + + ra.vetting.second_factor_type_disabled.text.explanation + Tokens van het type %token_name% kunnen niet geactiveerd worden. Dit tokentype is uitgeschakeld. + /../src/Surfnet/StepupRa/RaBundle/Resources/views/Vetting/secondFactorTypeDisabled.html.twig ra.vetting.second_factor_type_disabled.title @@ -1269,12 +1249,12 @@ ra.vetting.u2f.alert.device_reported_an_error Het U2F-apparaat heeft een foutmelding gerapporteerd. Probeer het opnieuw of neem contact op met de IT-helpdesk. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.vetting.u2f.alert.error De authenticate met het U2F-apparaat is mislukt. Probeer het opnieuw of neem contact op met de IT-helpdesk. - /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig + /../src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig ra.vetting.u2f.button.authenticate diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/Vetting/secondFactorTypeDisabled.html.twig b/src/Surfnet/StepupRa/RaBundle/Resources/views/Vetting/secondFactorTypeDisabled.html.twig index 16c98d6d..e154e3fc 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/Vetting/secondFactorTypeDisabled.html.twig +++ b/src/Surfnet/StepupRa/RaBundle/Resources/views/Vetting/secondFactorTypeDisabled.html.twig @@ -7,7 +7,7 @@

{{ block('page_title') }}

-

{{ ('ra.vetting.second_factor_type_disabled.text.explanation.' ~ secondFactorType)|trans }}

+

{{ 'ra.vetting.second_factor_type_disabled.text.explanation'|trans({'%token_name%': secondFactorType|trans_second_factor_type}) }}

{% endblock %} diff --git a/src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig b/src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig index bd42b330..5a445353 100644 --- a/src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig +++ b/src/Surfnet/StepupRa/RaBundle/Resources/views/translations.html.twig @@ -9,12 +9,6 @@ {{ 'ra.verify_identity.identity_verification_failed'|trans }} {{ 'ra.verify_identity.registration_code_expired'|trans }} -{# VettingController secondFactorTypeDisabled #} -{{ 'ra.vetting.second_factor_type_disabled.text.explanation.sms'|trans }} -{{ 'ra.vetting.second_factor_type_disabled.text.explanation.yubikey'|trans }} -{{ 'ra.vetting.second_factor_type_disabled.text.explanation.tiqr'|trans }} -{{ 'ra.vetting.second_factor_type_disabled.text.explanation.u2f'|trans }} - {# Prove Yubikey form #} {{ 'ra.verify_yubikey_command.otp.otp_invalid'|trans }} {{ 'ra.verify_yubikey_command.otp.verification_error'|trans }} @@ -29,7 +23,6 @@ {# SecondFactorController#search #} {{ 'ra.second_factor.search.type.sms'|trans }} {{ 'ra.second_factor.search.type.yubikey'|trans }} -{{ 'ra.second_factor.search.type.tiqr'|trans }} {{ 'ra.second_factor.search.type.u2f'|trans }} {{ 'ra.second_factor.search.status.unverified'|trans }} {{ 'ra.second_factor.search.status.verified'|trans }}