Test and doc for #2725
This commit is contained in:
parent
6ed0e9c1b4
commit
d39d65f92e
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue