Skip to content

Commit

Permalink
Issue #1389: Add optional logging of id tokens.
Browse files Browse the repository at this point in the history
  • Loading branch information
svenoe committed Nov 18, 2021
1 parent f4d8051 commit c7f9e65
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Kernel/Config/Defaults.pm
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@ sub LoadDefaults {
# given_name => 'UserFirstname',
# family_name => 'UserLastname',
# };
# For debugging purposes and to help with building the RoleMap e.g. you can dump all IDTokens received to the log
# $Self->{'AuthModule::OpenIDConnect::Debug'}->{'LogIDToken'} = 1;



Expand Down
11 changes: 11 additions & 0 deletions Kernel/System/Auth/OpenIDConnect.pm
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,17 @@ sub Auth {
return if !$Return->{Success};

my $TokenData = $Return->{TokenData};

my $Debug = $ConfigObject->Get('AuthModule::OpenIDConnect::Debug');
if ( $Debug && $Debug->{LogIDToken} ) {
my $TokenString = $Kernel::OM->Get('Kernel::System::Main')->Dump($TokenData);

$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'debug',
Message => "Received Token: $TokenString",
);
}

my $Identifier = $ConfigObject->Get('AuthModule::OpenIDConnect::UID');
my $UserLogin = $TokenData->{ $Identifier };
if ( !$UserLogin ) {
Expand Down
2 changes: 1 addition & 1 deletion Kernel/System/OpenIDConnect.pm
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ sub _ProviderDataGet {
# set cache for 30 minutes or configured time
$Kernel::OM->Get('Kernel::System::Cache')->Set(
Type => 'OpenIDConnect',
Key => 'ProviderData' . $Param{ProviderSettings}{Name} // '',
Key => 'ProviderData' . ( $Param{ProviderSettings}{Name} // '' ),
Value => $Return,
TTL => $Param{ProviderSettings}{Name} // 1800,
);
Expand Down

0 comments on commit c7f9e65

Please sign in to comment.