forked from BookStackApp/BookStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added option to change the OIDC claim regarded as the ID
Defined via a OIDC_EXTERNAL_ID_CLAIM env option. For BookStackApp#3914
- Loading branch information
1 parent
3202f96
commit 811be3a
Showing
4 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ protected function setUp(): void | |
'oidc.user_to_groups' => false, | ||
'oidc.groups_claim' => 'group', | ||
'oidc.remove_from_groups' => false, | ||
'oidc.external_id_claim' => 'sub', | ||
]); | ||
} | ||
|
||
|
@@ -391,6 +392,25 @@ public function test_auth_login_with_autodiscovery_with_keys_that_do_not_have_us | |
$this->assertTrue(auth()->check()); | ||
} | ||
|
||
public function test_auth_uses_configured_external_id_claim_option() | ||
{ | ||
config()->set([ | ||
'oidc.external_id_claim' => 'super_awesome_id', | ||
]); | ||
$roleA = Role::factory()->create(['display_name' => 'Wizards']); | ||
|
||
$resp = $this->runLogin([ | ||
'email' => '[email protected]', | ||
'sub' => 'benny1010101', | ||
'super_awesome_id' => 'xXBennyTheGeezXx', | ||
]); | ||
$resp->assertRedirect('/'); | ||
|
||
/** @var User $user */ | ||
$user = User::query()->where('email', '=', '[email protected]')->first(); | ||
$this->assertEquals('xXBennyTheGeezXx', $user->external_auth_id); | ||
} | ||
|
||
public function test_login_group_sync() | ||
{ | ||
config()->set([ | ||
|