Skip to content

Commit

Permalink
Added support for two factor auth token parameter to generic interface.
Browse files Browse the repository at this point in the history
* [GenericInterface] 2FA was added

* Added optional usage of HTTP header

As recommended in the pull request

#502
---------

Co-authored-by: Denny Korsukéwitz <dennykorsukewitz@gmail.com>
  • Loading branch information
CallMeFlanby and dennykorsukewitz authored Apr 19, 2024
1 parent bac431e commit 77eedd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Kernel/GenericInterface/Operation/Session/Common.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ sub CreateSessionID {
my $User;
my %UserData;
my $UserType;

# get params
my $PostPw = $Param{Data}->{Password} || '';
my $PostTwoFactorToken = $Param{Data}->{TwoFactorToken} || '';

if ( defined $Param{Data}->{UserLogin} && $Param{Data}->{UserLogin} ) {

Expand All @@ -59,6 +60,7 @@ sub CreateSessionID {
$User = $Kernel::OM->Get('Kernel::System::Auth')->Auth(
User => $PostUser,
Pw => $PostPw,
TwoFactorToken => $PostTwoFactorToken,
);
%UserData = $Kernel::OM->Get('Kernel::System::User')->GetUserData(
User => $User,
Expand All @@ -75,6 +77,7 @@ sub CreateSessionID {
$User = $Kernel::OM->Get('Kernel::System::CustomerAuth')->Auth(
User => $PostUser,
Pw => $PostPw,
TwoFactorToken => $PostTwoFactorToken,
);
%UserData = $Kernel::OM->Get('Kernel::System::CustomerUser')->CustomerUserDataGet(
User => $PostUser,
Expand Down
1 change: 1 addition & 0 deletions Kernel/GenericInterface/Transport/HTTP/REST.pm
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ sub ProviderProcessRequest {
HTTP_X_OTRS_HEADER_SESSIONID => 'SessionID',
HTTP_X_OTRS_HEADER_PASSWORD => 'Password',
HTTP_X_OTRS_HEADER_IMPERSONATEASUSER => 'ImpersonateAsUser',
HTTP_X_OTRS_HEADER_TWOFACTORTOKEN => 'TwoFactorToken',
);

HEADER:
Expand Down

0 comments on commit 77eedd2

Please sign in to comment.