Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 411020d

Browse files
Merge pull request #98 from vyskocilpavel/entitlements
Entitlements
2 parents 2819d69 + 235116c commit 411020d

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
5+
#### Changed
6+
- Releasing forwardedEduPersonEntitlement is now optional (forwardedEduPersonEntitlement are released by default)
57

68
## [v3.7.4]
79
#### Added

config-templates/processFilterConfigurations-example.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ Example how to enable filter IdPAttribute:
3838
'OrganizationName:en' => 'idp_organizationName' means that the $IdPMetadata['Organization']['en'] will be save into
3939
$request['Attributes']['idp_organizationName']
4040

41+
## PerunEntitlement
42+
43+
Example how to enable/configure filter PerunEntitlement:
44+
45+
```php
46+
33 => array(
47+
'class' => 'perun:PerunEntitlement',
48+
'interface' => 'ldap',
49+
'eduPersonEntitlement' => 'eduPersonEntitlement',
50+
# forwarded entitlement are released by default
51+
#'releaseForwardedEntitlement' => false, OPTIONAL
52+
'forwardedEduPersonEntitlement' => 'eduPersonEntitlement',
53+
),
54+
```
55+
4156
## ForceAup
4257

4358
1.Create these attributes in Perun:

lib/Auth/Process/PerunEntitlement.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,21 @@
1414
* This filter joins eduPersonEntitlement, forwardedEduPersonEntitlement and resource capabilities
1515
*
1616
* @author Dominik Baránek <[email protected]>
17+
* @author Pavel Vyskočil <[email protected]>
1718
*/
1819
class PerunEntitlement extends ProcessingFilter
1920
{
2021
const CONFIG_FILE_NAME = 'module_perun.php';
2122
const EDU_PERSON_ENTITLEMENT = 'eduPersonEntitlement';
23+
const RELEASE_FORWARDED_ENTITLEMENT = 'releaseForwardedEntitlement';
2224
const FORWARDED_EDU_PERSON_ENTITLEMENT = 'forwardedEduPersonEntitlement';
2325
const ENTITLEMENTPREFIX_ATTR = 'entitlementPrefix';
2426
const ENTITLEMENTAUTHORITY_ATTR = 'entitlementAuthority';
2527
const GROUPNAMEAARC_ATTR = 'groupNameAARC';
2628
const INTERFACE_PROPNAME = 'interface';
2729

2830
private $eduPersonEntitlement;
31+
private $releaseForwardedEntitlement;
2932
private $forwardedEduPersonEntitlement;
3033
private $entitlementPrefix;
3134
private $entitlementAuthority;
@@ -45,8 +48,12 @@ public function __construct($config, $reserved)
4548
self::EDU_PERSON_ENTITLEMENT . '.'
4649
);
4750
}
51+
$configuration = Configuration::loadFromArray($config);
52+
4853
$this->eduPersonEntitlement = $config[self::EDU_PERSON_ENTITLEMENT];
4954

55+
$this->releaseForwardedEntitlement = $configuration->getBoolean(self::RELEASE_FORWARDED_ENTITLEMENT, true);
56+
5057
if (!isset($config[self::FORWARDED_EDU_PERSON_ENTITLEMENT])) {
5158
throw new Exception(
5259
'perun:PerunEntitlement: missing mandatory configuration option ' .
@@ -77,7 +84,10 @@ public function __construct($config, $reserved)
7784
public function process(&$request)
7885
{
7986
$eduPersonEntitlement = $this->getEduPersonEntitlement($request);
80-
$forwardedEduPersonEntitlement = $this->getForwardedEduPersonEntitlement($request);
87+
$forwardedEduPersonEntitlement = [];
88+
if ($this->releaseForwardedEntitlement) {
89+
$forwardedEduPersonEntitlement = $this->getForwardedEduPersonEntitlement($request);
90+
}
8191
$resourceCapabilities = $this->getResourceCapabilities($request);
8292

8393
$request['Attributes'][$this->eduPersonEntitlement] = array_unique(array_merge(

0 commit comments

Comments
 (0)