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
1a9369d8
Commit
1a9369d8
authored
7 years ago
by
Jaime Pérez Crespo
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #680 from tvdijen/adfs-attribute-namespace
Flexible namespace
parents
06784bae
49adfcca
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/SimpleSAML/Utils/Attributes.php
+25
-0
25 additions, 0 deletions
lib/SimpleSAML/Utils/Attributes.php
modules/adfs/lib/IdP/ADFS.php
+3
-2
3 additions, 2 deletions
modules/adfs/lib/IdP/ADFS.php
with
28 additions
and
2 deletions
lib/SimpleSAML/Utils/Attributes.php
+
25
−
0
View file @
1a9369d8
...
...
@@ -106,4 +106,29 @@ class Attributes
return
$newAttrs
;
}
/**
* Extract an attribute's namespace, or revert to default.
*
* This function takes in a namespaced attribute name at splits it in a namespace/attribute name tuple.
* When no namespace is found in the attribute name, it will be namespaced with the default namespace.
* This default namespace can be overriden by supplying a second parameter to this function.
*
* @param string $name The namespaced attribute name.
* @param string $namespace The default namespace that should be used when no namespace is found (optional).
*
* @return array The attribute name, split to the namespace and the actual attribute name.
*/
public
static
function
getAttributeNamespace
(
$name
,
$namespace
=
'http://schemas.xmlsoap.org/claims'
)
{
$slash
=
strrpos
(
$name
,
'/'
);
if
(
$slash
!==
false
)
{
$namespace
=
substr
(
$name
,
0
,
$slash
);
$name
=
substr
(
$name
,
$slash
+
1
);
}
$name
=
htmlspecialchars
(
$name
);
$namespace
=
htmlspecialchars
(
$namespace
);
return
array
(
$namespace
,
$name
);
}
}
This diff is collapsed.
Click to expand it.
modules/adfs/lib/IdP/ADFS.php
+
3
−
2
View file @
1a9369d8
...
...
@@ -61,7 +61,8 @@ MSG;
if
((
!
is_array
(
$values
))
||
(
count
(
$values
)
==
0
))
{
continue
;
}
$name
=
htmlspecialchars
(
$name
);
list
(
$namespace
,
$name
)
=
SimpleSAML\Utils\Attributes
::
getAttributeNamespace
(
$name
,
'http://schemas.xmlsoap.org/claims'
);
foreach
(
$values
as
$value
)
{
if
((
!
isset
(
$value
))
||
(
$value
===
''
))
{
continue
;
...
...
@@ -69,7 +70,7 @@ MSG;
$value
=
htmlspecialchars
(
$value
);
$result
.
=
<<<MSG
<saml:Attribute AttributeNamespace="
http://schemas.xmlsoap.org/claims
" AttributeName="$name">
<saml:Attribute AttributeNamespace="
$namespace
" AttributeName="$name">
<saml:AttributeValue>$value</saml:AttributeValue>
</saml:Attribute>
MSG;
...
...
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