diff --git a/action.php b/action.php index 1271827..0d99d97 100644 --- a/action.php +++ b/action.php @@ -45,6 +45,10 @@ public function getUser() $data['mail'] = $result['email']; $data['grps'] = array_merge($result['groups'] ?? [], $result['roles'] ?? []); + if ($this->getConf('stripdomain')) { + $data['user'] = explode('@', $data['user'], 2)[0]; + } + if ($this->getConf('fetchgroups')) { $usergroups = $oauth->request(Azure::GRAPH_MEMBEROF); $usergroups = json_decode($usergroups, true); diff --git a/conf/default.php b/conf/default.php index f3fa463..5e0552f 100644 --- a/conf/default.php +++ b/conf/default.php @@ -8,3 +8,4 @@ $conf['secret'] = ''; $conf['tenant'] = ''; $conf['fetchgroups'] = 0; +$conf['stripdomain'] = 0; diff --git a/conf/metadata.php b/conf/metadata.php index fbacb20..8a93082 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -8,3 +8,4 @@ $meta['secret'] = array('password'); $meta['tenant'] = array('string'); $meta['fetchgroups'] = array('onoff'); +$meta['stripdomain'] = array('onoff'); diff --git a/lang/en/settings.php b/lang/en/settings.php index 5abf9a9..780dd58 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -8,3 +8,4 @@ $lang['secret'] = 'Cient Secret'; $lang['openidurl'] = 'Your tenant name or ID'; $lang['fetchgroups'] = 'By default only roles from the JWT are used as user groups. Enabling this option fetches group data.'; +$lang['stripdomain'] = 'Strip @domain from preferred_username';