Skip to content
Snippets Groups Projects
Commit f3164b78 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fixes for modules/smartattributes

parent f070961b
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,8 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter ...@@ -10,6 +10,8 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter
* IMPORTANT: If you use the (default) attributemaps (twitter2name, facebook2name, * IMPORTANT: If you use the (default) attributemaps (twitter2name, facebook2name,
* etc., be sure to comment out the entries that map xxx_targetedID to * etc., be sure to comment out the entries that map xxx_targetedID to
* eduPersonTargetedID, or there will be no way to see its origin any more. * eduPersonTargetedID, or there will be no way to see its origin any more.
*
* @var array
*/ */
private $candidates = [ private $candidates = [
'eduPersonTargetedID', 'eduPersonTargetedID',
...@@ -24,29 +26,36 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter ...@@ -24,29 +26,36 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter
]; ];
/** /**
* The name of the generated ID attribute. * @var string The name of the generated ID attribute.
*/ */
private $id_attribute = 'smart_id'; private $id_attribute = 'smart_id';
/** /**
* Whether to append the AuthenticatingAuthority, separated by '!' * Whether to append the AuthenticatingAuthority, separated by '!'
* This only works when SSP is used as a gateway. * This only works when SSP is used as a gateway.
* @var bool
*/ */
private $add_authority = true; private $add_authority = true;
/** /**
* Whether to prepend the CandidateID, separated by ':' * Whether to prepend the CandidateID, separated by ':'
* @var bool
*/ */
private $add_candidate = true; private $add_candidate = true;
/** /**
* Attributes which should be added/appended. * Attributes which should be added/appended.
* *
* Associative array of arrays. * @var array Associative array of arrays.
*/ */
private $attributes = []; private $attributes = [];
/**
* @param array $config
* @param mixed $reserved
* @throws \Exception
*/
public function __construct($config, $reserved) public function __construct($config, $reserved)
{ {
parent::__construct($config, $reserved); parent::__construct($config, $reserved);
...@@ -82,6 +91,13 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter ...@@ -82,6 +91,13 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter
} }
} }
/**
* @param array $attributes
* @param array $request
* @return string
* @throws \SimpleSAML\Error\Exception
*/
private function addID($attributes, $request) private function addID($attributes, $request)
{ {
$state = $request['saml:sp:State']; $state = $request['saml:sp:State'];
...@@ -104,12 +120,14 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter ...@@ -104,12 +120,14 @@ class SmartID extends \SimpleSAML\Auth\ProcessingFilter
them, or try using another identity provider.'); them, or try using another identity provider.');
} }
/** /**
* Apply filter to add or replace attributes. * Apply filter to add or replace attributes.
* *
* Add or replace existing attributes with the configured values. * Add or replace existing attributes with the configured values.
* *
* @param array &$request The current request * @param array &$request The current request
* @return void
*/ */
public function process(&$request) public function process(&$request)
{ {
......
...@@ -8,17 +8,20 @@ namespace SimpleSAML\Module\smartattributes\Auth\Process; ...@@ -8,17 +8,20 @@ namespace SimpleSAML\Module\smartattributes\Auth\Process;
* @author Andreas Åkre Solberg, UNINETT AS. * @author Andreas Åkre Solberg, UNINETT AS.
* @package SimpleSAMLphp * @package SimpleSAMLphp
*/ */
class SmartName extends \SimpleSAML\Auth\ProcessingFilter class SmartName extends \SimpleSAML\Auth\ProcessingFilter
{ {
/** /**
* Attributes which should be added/appended. * Attributes which should be added/appended.
* *
* Assiciative array of arrays. * @var array Associative array of arrays.
*/ */
private $attributes = []; private $attributes = [];
/**
* @param array $attributes
* @return string|null
*/
private function getFullName($attributes) private function getFullName($attributes)
{ {
if (isset($attributes['displayName'])) { if (isset($attributes['displayName'])) {
...@@ -57,6 +60,11 @@ class SmartName extends \SimpleSAML\Auth\ProcessingFilter ...@@ -57,6 +60,11 @@ class SmartName extends \SimpleSAML\Auth\ProcessingFilter
return null; return null;
} }
/**
* @param string $userid
* @return string|null
*/
private function getLocalUser($userid) private function getLocalUser($userid)
{ {
if (strpos($userid, '@') === false) { if (strpos($userid, '@') === false) {
...@@ -69,12 +77,14 @@ class SmartName extends \SimpleSAML\Auth\ProcessingFilter ...@@ -69,12 +77,14 @@ class SmartName extends \SimpleSAML\Auth\ProcessingFilter
return null; return null;
} }
/** /**
* Apply filter to add or replace attributes. * Apply filter to add or replace attributes.
* *
* Add or replace existing attributes with the configured values. * Add or replace existing attributes with the configured values.
* *
* @param array &$request The current request * @param array &$request The current request
* @return void
*/ */
public function process(&$request) public function process(&$request)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment