Skip to content

Commit

Permalink
Merge pull request #2 from glensc/strip-domain
Browse files Browse the repository at this point in the history
Feature: Strip domain if stripdomain config is enabled
  • Loading branch information
splitbrain committed Jun 12, 2023
2 parents d77c3be + 33c0163 commit 0a2b545
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions action.php
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions conf/default.php
Expand Up @@ -8,3 +8,4 @@
$conf['secret'] = '';
$conf['tenant'] = '';
$conf['fetchgroups'] = 0;
$conf['stripdomain'] = 0;
1 change: 1 addition & 0 deletions conf/metadata.php
Expand Up @@ -8,3 +8,4 @@
$meta['secret'] = array('password');
$meta['tenant'] = array('string');
$meta['fetchgroups'] = array('onoff');
$meta['stripdomain'] = array('onoff');
1 change: 1 addition & 0 deletions lang/en/settings.php
Expand Up @@ -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';

0 comments on commit 0a2b545

Please sign in to comment.