Skip to content

Commit 112a360

Browse files
authored
Update LoggedUser.php
1 parent ee36236 commit 112a360

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

modules/go5auth/lib/Auth/Source/LoggedUser.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ public function authenticate(&$state)
2727
exit;
2828
}
2929

30+
$metadataSP = $state['SPMetadata'];
31+
$metadataIDP = $state['IdPMetadata'];
32+
33+
if (!$metadataSP['enabled'] || !$metadataIDP['enabled'] || $metadataSP['platformId'] != $metadataIDP['platformId']) {
34+
header('HTTP/1.1 401 Unauthorized');
35+
echo 'go5auth | error: invalid platform idp';
36+
exit;
37+
}
38+
3039
$accessToken = isset($_REQUEST['access_token'])
3140
? $_REQUEST['access_token']
3241
: trim(substr($_SERVER['HTTP_AUTHORIZATION'], 7));
@@ -42,7 +51,7 @@ public function authenticate(&$state)
4251

4352
$userAttributes = [];
4453
$userInfoAttributes = $userInfo->data->attributes;
45-
$userAttributesMapping = $state['SPMetadata']['UserAttributesMapping'];
54+
$userAttributesMapping = $metadataSP['UserAttributesMapping'];
4655

4756
if (is_array($userAttributesMapping) && !empty($userAttributesMapping)) {
4857
foreach ($userAttributesMapping as $mappedAttributeKey => $mappedAttributeValue) {

0 commit comments

Comments
 (0)