'oidc.dump_user_details' => false,
'oidc.additional_scopes' => '',
'oidc.user_to_groups' => false,
- 'oidc.group_attribute' => 'group',
+ 'oidc.groups_claim' => 'group',
'oidc.remove_from_groups' => false,
]);
}
$this->assertTrue(auth()->check());
}
+ public function test_auth_login_with_autodiscovery_with_keys_that_do_not_have_use_property()
+ {
+ // Based on reading the OIDC discovery spec:
+ // > This contains the signing key(s) the RP uses to validate signatures from the OP. The JWK Set MAY also
+ // > contain the Server's encryption key(s), which are used by RPs to encrypt requests to the Server. When
+ // > both signing and encryption keys are made available, a use (Key Use) parameter value is REQUIRED for all
+ // > keys in the referenced JWK Set to indicate each key's intended usage.
+ // We can assume that keys without use are intended for signing.
+ $this->withAutodiscovery();
+
+ $keyArray = OidcJwtHelper::publicJwkKeyArray();
+ unset($keyArray['use']);
+
+ $this->mockHttpClient([
+ $this->getAutoDiscoveryResponse(),
+ new Response(200, [
+ 'Content-Type' => 'application/json',
+ 'Cache-Control' => 'no-cache, no-store',
+ 'Pragma' => 'no-cache',
+ ], json_encode([
+ 'keys' => [
+ $keyArray,
+ ],
+ ])),
+ ]);
+
+ $this->assertFalse(auth()->check());
+ $this->runLogin();
+ $this->assertTrue(auth()->check());
+ }
+
public function test_login_group_sync()
{
config()->set([
'oidc.user_to_groups' => true,
- 'oidc.group_attribute' => 'groups',
+ 'oidc.groups_claim' => 'groups',
'oidc.remove_from_groups' => false,
]);
$roleA = Role::factory()->create(['display_name' => 'Wizards']);
$resp = $this->runLogin([
'sub' => 'benny1010101',
- 'groups' => ['Wizards', 'Zookeepers']
+ 'groups' => ['Wizards', 'Zookeepers'],
]);
$resp->assertRedirect('/');
{
config()->set([
'oidc.user_to_groups' => true,
- 'oidc.group_attribute' => 'my.custom.groups.attr',
+ 'oidc.groups_claim' => 'my.custom.groups.attr',
'oidc.remove_from_groups' => false,
]);
$roleA = Role::factory()->create(['display_name' => 'Wizards']);
$resp = $this->runLogin([
'sub' => 'benny1010101',
- 'my' => [
+ 'my' => [
'custom' => [
'groups' => [
- 'attr' => ['Wizards']
- ]
- ]
- ]
+ 'attr' => ['Wizards'],
+ ],
+ ],
+ ],
]);
$resp->assertRedirect('/');