Skip to content
Snippets Groups Projects
Commit 929edf0d authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Move also the new AttributeValueMap filter to namespaces.

parent f405aa06
No related branches found
No related tags found
No related merge requests found
<?php <?php
namespace SimpleSAML\Module\core\Auth\Process;
/** /**
* Filter to create target attribute based on value(s) in source attribute * Filter to create target attribute based on value(s) in source attribute
* *
* @author Martin van Es, m7 * @author Martin van Es, m7
* @package SimpleSAMLphp * @package SimpleSAMLphp
*/ */
class sspmod_core_Auth_Process_AttributeValueMap extends SimpleSAML_Auth_ProcessingFilter class AttributeValueMap extends \SimpleSAML_Auth_ProcessingFilter
{ {
/** /**
...@@ -39,7 +41,7 @@ class sspmod_core_Auth_Process_AttributeValueMap extends SimpleSAML_Auth_Process ...@@ -39,7 +41,7 @@ class sspmod_core_Auth_Process_AttributeValueMap extends SimpleSAML_Auth_Process
* *
* @param array $config Configuration information about this filter. * @param array $config Configuration information about this filter.
* @param mixed $reserved For future use. * @param mixed $reserved For future use.
* @throws SimpleSAML_Error_Exception If the configuration is not valid. * @throws \SimpleSAML_Error_Exception If the configuration is not valid.
*/ */
public function __construct($config, $reserved) public function __construct($config, $reserved)
{ {
...@@ -56,7 +58,7 @@ class sspmod_core_Auth_Process_AttributeValueMap extends SimpleSAML_Auth_Process ...@@ -56,7 +58,7 @@ class sspmod_core_Auth_Process_AttributeValueMap extends SimpleSAML_Auth_Process
} elseif ($value === '%keep') { } elseif ($value === '%keep') {
$this->keep = true; $this->keep = true;
} else { } else {
throw new SimpleSAML_Error_Exception('Unknown flag : ' . var_export($value, true)); throw new \SimpleSAML_Error_Exception('Unknown flag : ' . var_export($value, true));
} }
continue; continue;
} }
...@@ -86,7 +88,7 @@ class sspmod_core_Auth_Process_AttributeValueMap extends SimpleSAML_Auth_Process ...@@ -86,7 +88,7 @@ class sspmod_core_Auth_Process_AttributeValueMap extends SimpleSAML_Auth_Process
*/ */
public function process(&$request) public function process(&$request)
{ {
SimpleSAML_Logger::debug('AttributeValueMap - process'); \SimpleSAML_Logger::debug('AttributeValueMap - process');
assert('is_array($request)'); assert('is_array($request)');
assert('array_key_exists("Attributes", $request)'); assert('array_key_exists("Attributes", $request)');
...@@ -103,7 +105,7 @@ class sspmod_core_Auth_Process_AttributeValueMap extends SimpleSAML_Auth_Process ...@@ -103,7 +105,7 @@ class sspmod_core_Auth_Process_AttributeValueMap extends SimpleSAML_Auth_Process
if (is_array($sourceattribute)) { if (is_array($sourceattribute)) {
foreach ($this->values as $value => $require) { foreach ($this->values as $value => $require) {
if (count(array_intersect($require, $sourceattribute)) > 0) { if (count(array_intersect($require, $sourceattribute)) > 0) {
SimpleSAML_Logger::debug('AttributeValueMap - intersect match for ' . $value); \SimpleSAML_Logger::debug('AttributeValueMap - intersect match for ' . $value);
$targetvalues[] = $value; $targetvalues[] = $value;
} }
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace SimpleSAML\Test\Module\core\Auth\Process; namespace SimpleSAML\Test\Module\core\Auth\Process;
use SimpleSAML\Module\core\Auth\Process\AttributeValueMap;
/** /**
* Test for the core:AttributeValueMap filter. * Test for the core:AttributeValueMap filter.
...@@ -18,7 +19,7 @@ class AttributeValueMapTest extends \PHPUnit_Framework_TestCase ...@@ -18,7 +19,7 @@ class AttributeValueMapTest extends \PHPUnit_Framework_TestCase
*/ */
private static function processFilter(array $config, array $request) private static function processFilter(array $config, array $request)
{ {
$filter = new \sspmod_core_Auth_Process_AttributeValueMap($config, null); $filter = new AttributeValueMap($config, null);
$filter->process($request); $filter->process($request);
return $request; return $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