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
411993d3
Commit
411993d3
authored
8 years ago
by
Thijs Kinkhorst
Browse files
Options
Downloads
Patches
Plain Diff
Formatting: tabs to spaces. No functional changes.
parent
078b1e23
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/AttributeRealm.php
+40
-42
40 additions, 42 deletions
modules/core/lib/Auth/Process/AttributeRealm.php
with
40 additions
and
42 deletions
modules/core/lib/Auth/Process/AttributeRealm.php
+
40
−
42
View file @
411993d3
...
...
@@ -9,46 +9,44 @@
*/
class
sspmod_core_Auth_Process_AttributeRealm
extends
SimpleSAML_Auth_ProcessingFilter
{
private
$attributename
=
'realm'
;
/**
* Initialize this filter.
*
* @param array $config Configuration information about this filter.
* @param mixed $reserved For future use.
*/
public
function
__construct
(
$config
,
$reserved
)
{
parent
::
__construct
(
$config
,
$reserved
);
assert
(
'is_array($config)'
);
if
(
array_key_exists
(
'attributename'
,
$config
))
$this
->
attributename
=
$config
[
'attributename'
];
}
/**
* Apply filter to add or replace attributes.
*
* Add or replace existing attributes with the configured values.
*
* @param array &$request The current request
*/
public
function
process
(
&
$request
)
{
assert
(
'is_array($request)'
);
assert
(
'array_key_exists("Attributes", $request)'
);
$attributes
=&
$request
[
'Attributes'
];
if
(
!
array_key_exists
(
'UserID'
,
$request
))
{
throw
new
Exception
(
'core:AttributeRealm: Missing UserID for this user. Please'
.
' check the \'userid.attribute\' option in the metadata against the'
.
' attributes provided by the authentication source.'
);
}
$userID
=
$request
[
'UserID'
];
$decomposed
=
explode
(
'@'
,
$userID
);
if
(
count
(
$decomposed
)
!==
2
)
return
;
$request
[
'Attributes'
][
$this
->
attributename
]
=
array
(
$decomposed
[
1
]);
}
private
$attributename
=
'realm'
;
/**
* Initialize this filter.
*
* @param array $config Configuration information about this filter.
* @param mixed $reserved For future use.
*/
public
function
__construct
(
$config
,
$reserved
)
{
parent
::
__construct
(
$config
,
$reserved
);
assert
(
'is_array($config)'
);
if
(
array_key_exists
(
'attributename'
,
$config
))
$this
->
attributename
=
$config
[
'attributename'
];
}
/**
* Apply filter to add or replace attributes.
*
* Add or replace existing attributes with the configured values.
*
* @param array &$request The current request
*/
public
function
process
(
&
$request
)
{
assert
(
'is_array($request)'
);
assert
(
'array_key_exists("Attributes", $request)'
);
$attributes
=&
$request
[
'Attributes'
];
if
(
!
array_key_exists
(
'UserID'
,
$request
))
{
throw
new
Exception
(
'core:AttributeRealm: Missing UserID for this user. Please'
.
' check the \'userid.attribute\' option in the metadata against the'
.
' attributes provided by the authentication source.'
);
}
$userID
=
$request
[
'UserID'
];
$decomposed
=
explode
(
'@'
,
$userID
);
if
(
count
(
$decomposed
)
!==
2
)
return
;
$request
[
'Attributes'
][
$this
->
attributename
]
=
array
(
$decomposed
[
1
]);
}
}
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