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
0
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
552f93f6
Unverified
Commit
552f93f6
authored
6 years ago
by
Thijs Kinkhorst
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #858 from mschwager/master
Fix #828, infinite loop in AttributeMap behavior
parents
31442318
fa4d12bb
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/AttributeMap.php
+12
-8
12 additions, 8 deletions
modules/core/lib/Auth/Process/AttributeMap.php
tests/modules/core/lib/Auth/Process/AttributeMapTest.php
+45
-0
45 additions, 0 deletions
tests/modules/core/lib/Auth/Process/AttributeMapTest.php
with
57 additions
and
8 deletions
modules/core/lib/Auth/Process/AttributeMap.php
+
12
−
8
View file @
552f93f6
...
@@ -115,24 +115,28 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi
...
@@ -115,24 +115,28 @@ class sspmod_core_Auth_Process_AttributeMap extends SimpleSAML_Auth_ProcessingFi
assert
(
is_array
(
$request
));
assert
(
is_array
(
$request
));
assert
(
array_key_exists
(
'Attributes'
,
$request
));
assert
(
array_key_exists
(
'Attributes'
,
$request
));
$attributes
=
&
$request
[
'Attributes'
]
;
$
mapped_
attributes
=
array
()
;
foreach
(
$
a
ttributes
as
$name
=>
$values
)
{
foreach
(
$
request
[
'A
ttributes
'
]
as
$name
=>
$values
)
{
if
(
array_key_exists
(
$name
,
$this
->
map
))
{
if
(
array_key_exists
(
$name
,
$this
->
map
))
{
if
(
!
is_array
(
$this
->
map
[
$name
]))
{
if
(
!
is_array
(
$this
->
map
[
$name
]))
{
if
(
!
$this
->
duplicate
)
{
if
(
$this
->
duplicate
)
{
unset
(
$
attributes
[
$name
]
)
;
$mapped_
attributes
[
$name
]
=
$values
;
}
}
$attributes
[
$this
->
map
[
$name
]]
=
$values
;
$
mapped_
attributes
[
$this
->
map
[
$name
]]
=
$values
;
}
else
{
}
else
{
foreach
(
$this
->
map
[
$name
]
as
$to_map
)
{
foreach
(
$this
->
map
[
$name
]
as
$to_map
)
{
$attributes
[
$to_map
]
=
$values
;
$
mapped_
attributes
[
$to_map
]
=
$values
;
}
}
if
(
!
$this
->
duplicate
&&
!
in_array
(
$name
,
$this
->
map
[
$name
],
true
))
{
if
(
$this
->
duplicate
&&
!
in_array
(
$name
,
$this
->
map
[
$name
],
true
))
{
unset
(
$
attributes
[
$name
]
)
;
$mapped_
attributes
[
$name
]
=
$values
;
}
}
}
}
}
else
{
$mapped_attributes
[
$name
]
=
$values
;
}
}
}
}
$request
[
'Attributes'
]
=
$mapped_attributes
;
}
}
}
}
This diff is collapsed.
Click to expand it.
tests/modules/core/lib/Auth/Process/AttributeMapTest.php
+
45
−
0
View file @
552f93f6
...
@@ -108,6 +108,51 @@ class Test_Core_Auth_Process_AttributeMap extends TestCase
...
@@ -108,6 +108,51 @@ class Test_Core_Auth_Process_AttributeMap extends TestCase
$this
->
assertEquals
(
$expected
,
$result
);
$this
->
assertEquals
(
$expected
,
$result
);
}
}
public
function
testCircular
()
{
$config
=
[
'attribute1'
=>
'attribute1'
,
'attribute2'
=>
'attribute2'
,
];
$request
=
[
'Attributes'
=>
[
'attribute1'
=>
[
'value'
],
'attribute2'
=>
[
'value'
],
],
];
$processed
=
self
::
processFilter
(
$config
,
$request
);
$result
=
$processed
[
'Attributes'
];
$expected
=
[
'attribute1'
=>
[
'value'
],
'attribute2'
=>
[
'value'
],
];
$this
->
assertEquals
(
$expected
,
$result
);
}
public
function
testMissingMap
()
{
$config
=
[
'attribute1'
=>
'attribute3'
,
];
$request
=
[
'Attributes'
=>
[
'attribute1'
=>
[
'value'
],
'attribute2'
=>
[
'value'
],
],
];
$processed
=
self
::
processFilter
(
$config
,
$request
);
$result
=
$processed
[
'Attributes'
];
$expected
=
[
'attribute2'
=>
[
'value'
],
'attribute3'
=>
[
'value'
],
];
$this
->
assertEquals
(
$expected
,
$result
);
}
public
function
testInvalidOriginalAttributeType
()
public
function
testInvalidOriginalAttributeType
()
{
{
$config
=
[
$config
=
[
...
...
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