From 94f6a8993ec2e83802dd3f02b8d2a957d9c9f819 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Fri, 21 Aug 2020 14:23:03 +0200 Subject: [PATCH] core:TargetedID: Deprecate attributename in favour of identifyingAttribute --- docs/simplesamlphp-changelog.md | 2 ++ modules/core/docs/authproc_targetedid.md | 7 ++++++- modules/core/lib/Auth/Process/TargetedID.php | 9 +++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/docs/simplesamlphp-changelog.md b/docs/simplesamlphp-changelog.md index bab62afbe..901af9c25 100644 --- a/docs/simplesamlphp-changelog.md +++ b/docs/simplesamlphp-changelog.md @@ -17,6 +17,8 @@ Released TBD * Dropped support for Symfony 3.x and Twig 1.x * Update the SAML2 library dependency to 4.1.8 * Allow additional audiences to be specified (#1345) + * The `attributename`-setting in the core:TargetedID authproc-filter has been deprecated in + favour of the `identifyingAttribute`-setting. ## Version 1.18.8 diff --git a/modules/core/docs/authproc_targetedid.md b/modules/core/docs/authproc_targetedid.md index f6cea7da7..f55e4febf 100644 --- a/modules/core/docs/authproc_targetedid.md +++ b/modules/core/docs/authproc_targetedid.md @@ -10,6 +10,11 @@ Parameters ---------- `attributename` +: The name of the attribute we should use for the unique user identifier. + Optional, will use the attribute set by the `userid.attribute` metadata option by default. + *deprecated:* Please use `identifyingAttribute` instead. + +`identifyingAttribute` : The name of the attribute we should use for the unique user identifier. Optional, will use the attribute set by the `userid.attribute` metadata option by default. @@ -35,7 +40,7 @@ A custom attribute: 'authproc' => array( 50 => array( 'class' => 'core:TargetedID', - 'attributename' => 'eduPersonPrincipalName' + 'identifyingAttribute' => 'eduPersonPrincipalName' ), ), diff --git a/modules/core/lib/Auth/Process/TargetedID.php b/modules/core/lib/Auth/Process/TargetedID.php index 66095c0c7..e6a804cc8 100644 --- a/modules/core/lib/Auth/Process/TargetedID.php +++ b/modules/core/lib/Auth/Process/TargetedID.php @@ -66,10 +66,15 @@ class TargetedID extends \SimpleSAML\Auth\ProcessingFilter assert(is_array($config)); - if (array_key_exists('attributename', $config)) { + if (array_key_exists('identifyingAttribute', $config)) { + $this->attribute = $config['identifyingAttribute']; + if (!is_string($this->attribute)) { + throw new \Exception('Invalid `identifyingAttribute` name given to core:TargetedID filter.'); + } + } elseif (array_key_exists('attributename', $config)) { $this->attribute = $config['attributename']; if (!is_string($this->attribute)) { - throw new \Exception('Invalid attribute name given to core:TargetedID filter.'); + throw new \Exception('Invalid `attributename` given to core:TargetedID filter.'); } } -- GitLab