Include extra keys in oidcGenerateUserInfoResponse (#2725)

This commit is contained in:
Maxime Besson 2022-07-18 17:58:41 +02:00
parent 569f38fc92
commit 6e7fd58113
4 changed files with 4 additions and 1 deletions

View File

@ -100,6 +100,7 @@ Sample code::
sub addClaimToUserInfo {
my ( $self, $req, $userinfo, $rp, $session_data) = @_;
my $scope = $session_data->{_scope};
$userinfo->{"userinfo_hook"} = 1;
return PE_OK;
}

View File

@ -1832,7 +1832,7 @@ sub buildUserInfoResponseFromData {
}
my $h = $self->p->processHook( $req, 'oidcGenerateUserInfoResponse',
$userinfo_response, $rp, $session_data );
$userinfo_response, $rp, $data );
return {} if ( $h != PE_OK );
return $userinfo_response;

View File

@ -135,6 +135,7 @@ $res = $op->_post(
$json = expectJSON($res);
is( $json->{userinfo_hook}, 1, "Found hooked claim in Userinfo token" );
is( $json->{_auth}, "Demo", "Found session variable in Userinfo token" );
like( $json->{_scope}, qr/\bopenid\b/, "Scopes are visible in hook" );
expectJWT( $token, access_token_hook => 1 );

View File

@ -33,6 +33,7 @@ sub addClaimToUserInfo {
my ( $self, $req, $userinfo, $rp, $session_data ) = @_;
$userinfo->{"userinfo_hook"} = 1;
$userinfo->{"_auth"} = $session_data->{_auth};
$userinfo->{"_scope"} = $session_data->{_scope};
return PE_OK;
}