@@ -28,6 +28,7 @@ class PerunEntitlement extends ProcessingFilter
2828 const ENTITLEMENTAUTHORITY_ATTR = 'entitlementAuthority ' ;
2929 const GROUPNAMEAARC_ATTR = 'groupNameAARC ' ;
3030 const INTERFACE_PROPNAME = 'interface ' ;
31+ const ENTITY_ID = 'entityID ' ;
3132
3233 private $ eduPersonEntitlement ;
3334 private $ releaseForwardedEntitlement ;
@@ -36,6 +37,7 @@ class PerunEntitlement extends ProcessingFilter
3637 private $ entitlementAuthority ;
3738 private $ groupNameAARC ;
3839 private $ adapter ;
40+ private $ entityId ;
3941
4042 public function __construct ($ config , $ reserved )
4143 {
@@ -62,6 +64,8 @@ public function __construct($config, $reserved)
6264 $ this ->groupNameAARC ? Configuration::REQUIRED_OPTION : ''
6365 );
6466
67+ $ this ->entityId = $ modulePerunConfiguration ->getString (self ::ENTITY_ID , null );
68+
6569 $ interface = $ configuration ->getValueValidate (
6670 self ::INTERFACE_PROPNAME ,
6771 [Adapter::RPC , Adapter::LDAP ],
@@ -76,13 +80,18 @@ public function process(&$request)
7680 $ capabilities = [];
7781 $ forwardedEduPersonEntitlement = [];
7882
83+ if ($ this ->entityId === null ) {
84+ $ this ->entityId = EntitlementUtils::getSpEntityId ($ request );
85+ }
86+
7987 if (isset ($ request ['perun ' ]['groups ' ])) {
8088 $ eduPersonEntitlement = $ this ->getEduPersonEntitlement ($ request );
8189 $ capabilities = EntitlementUtils::getCapabilities (
8290 $ request ,
8391 $ this ->adapter ,
8492 $ this ->entitlementPrefix ,
85- $ this ->entitlementAuthority
93+ $ this ->entitlementAuthority ,
94+ $ this ->entityId
8695 );
8796 } else {
8897 Logger::debug (
@@ -156,19 +165,19 @@ protected function mapGroupName($request, $groupName)
156165 isset ($ request ['SPMetadata ' ]['groupMapping ' ][$ groupName ])) {
157166 Logger::debug (
158167 'Mapping ' . $ groupName . ' to ' . $ request ['SPMetadata ' ]['groupMapping ' ][$ groupName ] .
159- ' for SP ' . $ request [ ' SPMetadata ' ][ ' entityid ' ]
168+ ' for SP ' . $ this -> entityId
160169 );
161170 return $ request ['SPMetadata ' ]['groupMapping ' ][$ groupName ];
162171 } elseif (isset ($ request ['SPMetadata ' ][self ::ENTITLEMENTPREFIX_ATTR ])) {
163172 Logger::debug (
164- 'EntitlementPrefix overridden by a SP ' . $ request [ ' SPMetadata ' ][ ' entityid ' ] .
173+ 'EntitlementPrefix overridden by a SP ' . $ this -> entityId .
165174 ' to ' . $ request ['SPMetadata ' ][self ::ENTITLEMENTPREFIX_ATTR ]
166175 );
167176 return $ request ['SPMetadata ' ][self ::ENTITLEMENTPREFIX_ATTR ] . $ groupName ;
168177 } else {
169178 # No mapping defined, so just put groupNamePrefix in front of the group
170179 Logger::debug (
171- 'No mapping found for group ' . $ groupName . ' for SP ' . $ request [ ' SPMetadata ' ][ ' entityid ' ]
180+ 'No mapping found for group ' . $ groupName . ' for SP ' . $ this -> entityId
172181 );
173182 return $ this ->entitlementPrefix . 'group: ' . $ groupName ;
174183 }
0 commit comments