Skip to content

Commit

Permalink
Merge pull request #117 from OpenConext/feature/sf-subset/apply-allow…
Browse files Browse the repository at this point in the history
…ed-second-factors-in-ss

Apply Allowed Second Factors in SS
  • Loading branch information
Alex Rothuis authored Feb 14, 2017
2 parents b737968 + 9487f5e commit 41294cc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 22 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"fortawesome/font-awesome": "~4.2.0",
"jms/translation-bundle": "~1.1.0",
"jms/di-extra-bundle": "~1.4.0",
"surfnet/stepup-middleware-client-bundle": "^1.3",
"surfnet/stepup-middleware-client-bundle": "^1.5",
"guzzlehttp/guzzle": "~4",
"surfnet/stepup-saml-bundle": "^2.5",
"surfnet/stepup-bundle": "^1.5",
Expand Down
28 changes: 14 additions & 14 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,20 @@ class RegistrationController extends Controller
*/
public function displaySecondFactorTypesAction()
{
$enabledSecondFactors = $this->getParameter('ss.enabled_second_factors');
$institutionConfigurationOptions = $this->get('self_service.service.institution_configuration_options')
->getInstitutionConfigurationOptionsFor($this->getIdentity()->institution);

$availableSecondFactors = $this->getParameter('ss.enabled_second_factors');
if (!empty($institutionConfigurationOptions->allowedSecondFactors)) {
$availableSecondFactors = array_intersect(
$availableSecondFactors,
$institutionConfigurationOptions->allowedSecondFactors
);
}

return [
'commonName' => $this->getIdentity()->commonName,
'enabledSecondFactors' => array_combine($enabledSecondFactors, $enabledSecondFactors),
'availableSecondFactors' => array_combine($availableSecondFactors, $availableSecondFactors),
'tiqrAppAndroidUrl' => $this->getParameter('tiqr_app_android_url'),
'tiqrAppIosUrl' => $this->getParameter('tiqr_app_ios_url'),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<h2>{{ block('page_title') }}</h2>

<div class="row">
{% if enabledSecondFactors.sms is defined %}
{% if availableSecondFactors.sms is defined %}
{% include 'SurfnetStepupSelfServiceSelfServiceBundle::Registration/partial/secondFactor.html.twig' with {
'type': 'sms',
'security': 2,
Expand All @@ -21,7 +21,7 @@
'tiqrAppIosUrl': tiqrAppIosUrl,
} only %}
{% endif %}
{% if enabledSecondFactors.tiqr is defined %}
{% if availableSecondFactors.tiqr is defined %}
{% include 'SurfnetStepupSelfServiceSelfServiceBundle::Registration/partial/secondFactor.html.twig' with {
'type': 'tiqr',
'security': 2,
Expand All @@ -30,7 +30,7 @@
'tiqrAppIosUrl': tiqrAppIosUrl,
} only %}
{% endif %}
{% if enabledSecondFactors.yubikey is defined %}
{% if availableSecondFactors.yubikey is defined %}
{% include 'SurfnetStepupSelfServiceSelfServiceBundle::Registration/partial/secondFactor.html.twig' with {
'type': 'yubikey',
'security': 3,
Expand All @@ -39,7 +39,7 @@
'tiqrAppIosUrl': tiqrAppIosUrl,
} only %}
{% endif %}
{% if enabledSecondFactors.u2f is defined %}
{% if availableSecondFactors.u2f is defined %}
{% include 'SurfnetStepupSelfServiceSelfServiceBundle::Registration/partial/secondFactor.html.twig' with {
'type': 'u2f',
'security': 3,
Expand All @@ -48,7 +48,7 @@
'tiqrAppIosUrl': tiqrAppIosUrl,
} only %}
{% endif %}
{% if enabledSecondFactors.biometric is defined %}
{% if availableSecondFactors.biometric is defined %}
{% include 'SurfnetStepupSelfServiceSelfServiceBundle::Registration/partial/secondFactor.html.twig' with {
'type': 'biometric',
'security': 3,
Expand Down

0 comments on commit 41294cc

Please sign in to comment.