Test and doc for #2725

This commit is contained in:
Maxime Besson 2022-03-11 12:07:41 +01:00
parent 6ed0e9c1b4
commit d39d65f92e
3 changed files with 7 additions and 2 deletions

View File

@ -89,6 +89,9 @@ This hook is triggered when LemonLDAP::NG is about to send a UserInfo response t
The hook's parameter is a hash containing all the claims that are about to be released.
.. versionchanged:: 2.0.15
Added the hash of current session data
Sample code::
use constant hook => {
@ -96,7 +99,7 @@ Sample code::
};
sub addClaimToUserInfo {
my ( $self, $req, $userinfo, $rp) = @_;
my ( $self, $req, $userinfo, $rp, $session_data) = @_;
$userinfo->{"userinfo_hook"} = 1;
return PE_OK;
}

View File

@ -130,6 +130,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" );
expectJWT( $token, access_token_hook => 1 );

View File

@ -24,8 +24,9 @@ sub addClaimToIDToken {
}
sub addClaimToUserInfo {
my ( $self, $req, $userinfo ) = @_;
my ( $self, $req, $userinfo, $rp, $session_data ) = @_;
$userinfo->{"userinfo_hook"} = 1;
$userinfo->{"_auth"} = $session_data->{_auth};
return PE_OK;
}