Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp-module-perun
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
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp-module-perun
Merge requests
!60
Created filter JoinGroupsAndEduPersonEntitlement
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Created filter JoinGroupsAndEduPersonEntitlement
github/fork/BaranekD/JoinGroupsAndEduPersonEntitlement
into
master
Overview
0
Commits
1
Pipelines
0
Changes
2
Merged
Pavel Břoušek
requested to merge
github/fork/BaranekD/JoinGroupsAndEduPersonEntitlement
into
master
5 years ago
Overview
0
Commits
1
Pipelines
0
Changes
2
Expand
Created by: BaranekD
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
53bd18a3
1 commit,
2 years ago
2 files
+
66
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
lib/Auth/Process/JoinGroupsAndEduPersonEntitlement.php
0 → 100644
+
63
−
0
Options
<?php
namespace
SimpleSAML\Module\perun\Auth\Process
;
use
SimpleSAML\Error\Exception
;
/**
* Class JoinGroupsAndEduPersonEntitlement
*
* This filter joins eduPersonEntitlement attribute from perun with groups from PerunGroups filter.
*
* @author Dominik Baránek <0Baranek.dominik0@gmail.com>
*/
class
JoinGroupsAndEduPersonEntitlement
extends
\SimpleSAML\Auth\ProcessingFilter
{
const
EDU_PERSON_ENTITLEMENT
=
'eduPersonEntitlement'
;
const
FORWARDED_EDU_PERSON_ENTITLEMENT
=
'forwardedEduPersonEntitlement'
;
private
$eduPersonEntitlement
;
private
$forwardedEduPersonEntitlement
;
public
function
__construct
(
$config
,
$reserved
)
{
parent
::
__construct
(
$config
,
$reserved
);
assert
(
'is_array($config)'
);
if
(
!
isset
(
$config
[
self
::
EDU_PERSON_ENTITLEMENT
]))
{
throw
new
Exception
(
"perun:JoinGroupsAndEduPersonEntitlement: missing mandatory configuration option "
.
self
::
EDU_PERSON_ENTITLEMENT
.
"."
);
}
$this
->
eduPersonEntitlement
=
$config
[
self
::
EDU_PERSON_ENTITLEMENT
];
if
(
!
isset
(
$config
[
self
::
FORWARDED_EDU_PERSON_ENTITLEMENT
]))
{
throw
new
Exception
(
"perun:JoinGroupsAndEduPersonEntitlement: missing mandatory configuration option "
.
self
::
FORWARDED_EDU_PERSON_ENTITLEMENT
.
"."
);
}
$this
->
forwardedEduPersonEntitlement
=
$config
[
self
::
FORWARDED_EDU_PERSON_ENTITLEMENT
];
}
public
function
process
(
&
$request
)
{
if
(
isset
(
$request
[
'Attributes'
][
$this
->
eduPersonEntitlement
])
&&
isset
(
$request
[
'Attributes'
][
$this
->
forwardedEduPersonEntitlement
]))
{
$request
[
'Attributes'
][
$this
->
eduPersonEntitlement
]
=
array_merge
(
$request
[
'Attributes'
][
$this
->
eduPersonEntitlement
],
$request
[
'Attributes'
][
$this
->
forwardedEduPersonEntitlement
]
);
}
else
{
throw
new
Exception
(
"perun:JoinGroupsAndEduPersonEntitlement: "
.
"missing at least one of mandatory fields ('Attributes."
.
$this
->
eduPersonEntitlement
.
"' or 'Attributes."
.
$this
->
forwardedEduPersonEntitlement
.
"' in request."
);
}
unset
(
$request
[
'Attributes'
][
$this
->
forwardedEduPersonEntitlement
]);
}
}
Loading