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
eb6e017c
Unverified
Commit
eb6e017c
authored
7 years ago
by
Tim van Dijen
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Code quality
parent
9bd7ff61
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/core/lib/Auth/Process/AttributeAlter.php
+31
-31
31 additions, 31 deletions
modules/core/lib/Auth/Process/AttributeAlter.php
with
31 additions
and
31 deletions
modules/core/lib/Auth/Process/AttributeAlter.php
+
31
−
31
View file @
eb6e017c
...
@@ -7,17 +7,17 @@
...
@@ -7,17 +7,17 @@
* @author Jacob Christiansen, WAYF
* @author Jacob Christiansen, WAYF
* @package SimpleSAMLphp
* @package SimpleSAMLphp
*/
*/
class
sspmod_core_Auth_Process_AttributeAlter
extends
SimpleSAML_Auth_ProcessingFilter
{
class
sspmod_core_Auth_Process_AttributeAlter
extends
SimpleSAML_Auth_ProcessingFilter
{
/**
/**
* Should the pattern found be replaced?
* Should the pattern found be replaced?
*/
*/
private
$replace
=
FALSE
;
private
$replace
=
false
;
/**
/**
* Should the value found be removed?
* Should the value found be removed?
*/
*/
private
$remove
=
FALSE
;
private
$remove
=
false
;
/**
/**
* Pattern to search for.
* Pattern to search for.
...
@@ -27,7 +27,7 @@ class sspmod_core_Auth_Process_AttributeAlter extends SimpleSAML_Auth_Processing
...
@@ -27,7 +27,7 @@ class sspmod_core_Auth_Process_AttributeAlter extends SimpleSAML_Auth_Processing
/**
/**
* String to replace the pattern found with.
* String to replace the pattern found with.
*/
*/
private
$replacement
=
FALSE
;
private
$replacement
=
false
;
/**
/**
* Attribute to search in
* Attribute to search in
...
@@ -46,7 +46,8 @@ class sspmod_core_Auth_Process_AttributeAlter extends SimpleSAML_Auth_Processing
...
@@ -46,7 +46,8 @@ class sspmod_core_Auth_Process_AttributeAlter extends SimpleSAML_Auth_Processing
* @param mixed $reserved For future use.
* @param mixed $reserved For future use.
* @throws SimpleSAML_Error_Exception In case of invalid configuration.
* @throws SimpleSAML_Error_Exception In case of invalid configuration.
*/
*/
public
function
__construct
(
$config
,
$reserved
)
{
public
function
__construct
(
$config
,
$reserved
)
{
parent
::
__construct
(
$config
,
$reserved
);
parent
::
__construct
(
$config
,
$reserved
);
assert
(
is_array
(
$config
));
assert
(
is_array
(
$config
));
...
@@ -55,33 +56,25 @@ class sspmod_core_Auth_Process_AttributeAlter extends SimpleSAML_Auth_Processing
...
@@ -55,33 +56,25 @@ class sspmod_core_Auth_Process_AttributeAlter extends SimpleSAML_Auth_Processing
foreach
(
$config
as
$name
=>
$value
)
{
foreach
(
$config
as
$name
=>
$value
)
{
if
(
is_int
(
$name
))
{
if
(
is_int
(
$name
))
{
// check if this is an option
// check if this is an option
if
(
$value
===
'%replace'
)
{
if
(
$value
===
'%replace'
)
{
$this
->
replace
=
TRUE
;
$this
->
replace
=
true
;
}
elseif
(
$value
===
'%remove'
)
{
}
elseif
(
$value
===
'%remove'
)
{
$this
->
remove
=
TRUE
;
$this
->
remove
=
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
;
}
}
elseif
(
$name
===
'pattern'
)
{
// Set pattern
// Set pattern
if
(
$name
===
'pattern'
)
{
$this
->
pattern
=
$value
;
$this
->
pattern
=
$value
;
}
}
elseif
(
$name
===
'replacement'
)
{
// Set replacement
// Set replacement
if
(
$name
===
'replacement'
)
{
$this
->
replacement
=
$value
;
$this
->
replacement
=
$value
;
}
}
elseif
(
$name
===
'subject'
)
{
// Set subject
// Set subject
if
(
$name
===
'subject'
)
{
$this
->
subject
=
$value
;
$this
->
subject
=
$value
;
}
}
elseif
(
$name
===
'target'
)
{
// Set target
// Set target
if
(
$name
===
'target'
)
{
$this
->
target
=
$value
;
$this
->
target
=
$value
;
}
}
}
}
...
@@ -166,12 +159,19 @@ class sspmod_core_Auth_Process_AttributeAlter extends SimpleSAML_Auth_Processing
...
@@ -166,12 +159,19 @@ class sspmod_core_Auth_Process_AttributeAlter extends SimpleSAML_Auth_Processing
}
}
}
else
{
// replace only the part that matches
}
else
{
// replace only the part that matches
if
(
$this
->
subject
===
$this
->
target
)
{
if
(
$this
->
subject
===
$this
->
target
)
{
$attributes
[
$this
->
target
]
=
preg_replace
(
$this
->
pattern
,
$this
->
replacement
,
$attributes
[
$this
->
target
]
=
preg_replace
(
$attributes
[
$this
->
subject
]);
$this
->
pattern
,
$this
->
replacement
,
$attributes
[
$this
->
subject
]
);
}
else
{
}
else
{
$attributes
[
$this
->
target
]
=
array_diff
(
preg_replace
(
$this
->
pattern
,
$this
->
replacement
,
$attributes
[
$this
->
target
]
=
array_diff
(
$attributes
[
$this
->
subject
]),
preg_replace
(
$attributes
[
$this
->
subject
]);
$this
->
pattern
,
$this
->
replacement
,
$attributes
[
$this
->
subject
]
),
$attributes
[
$this
->
subject
]
);
}
}
}
}
}
}
...
...
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