Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
929edf0d
Commit
929edf0d
authored
9 years ago
by
Jaime Perez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Move also the new AttributeValueMap filter to namespaces.
parent
f405aa06
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/core/lib/Auth/Process/AttributeValueMap.php
+7
-5
7 additions, 5 deletions
modules/core/lib/Auth/Process/AttributeValueMap.php
tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php
+2
-1
2 additions, 1 deletion
...s/modules/core/lib/Auth/Process/AttributeValueMapTest.php
with
9 additions
and
6 deletions
modules/core/lib/Auth/Process/AttributeValueMap.php
+
7
−
5
View file @
929edf0d
<?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
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/modules/core/lib/Auth/Process/AttributeValueMapTest.php
+
2
−
1
View file @
929edf0d
...
@@ -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
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment