There are several agent autentification modules (DB, LDAP and HTTPBasicAuth) which comes with OTRS. It's also possible to develop your own autentification modules.
The agent authentification modules are located under Kernel/System/Auth/*.pm. To configure it see under chapter "User" -> "User Auth Backend".
A example of a simple agent auth module, save it under Kernel/System/Auth/Simple.pm. You just need 3 functions, new(), GetOption() and Auth(). If Auth() is true, the the autentification is valid:
# -- # Kernel/System/Auth/Simple.pm - provides the db authentification # Copyright (C) 2001-2004 Martin Edenhofer martin+code at otrs.org # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you # did not receive this file, see http://www.gnu.org/licenses/gpl.txt. # -- # Note: # available objects are: ConfigObject, LogObject and DBObject # -- package Kernel::System::Auth::Simple; use strict; # -- sub new { my $Type = shift; my %Param = @_; # allocate new hash for object my $Self = {}; bless ($Self, $Type); # check needed objects foreach (qw(LogObject ConfigObject DBObject)) { $Self->{$_} = $Param{$_} || die "No $_!"; } # Debug 0=off 1=on $Self->{Debug} = 0; return $Self; } # -- sub GetOption { my $Self = shift; my %Param = @_; # check needed stuff if (!$Param{What}) { $Self->{LogObject}->Log(Priority => 'error', Message => "Need What!"); return; } # module options my %Option = ( PreAuth => 0, ); # return option return $Option{$Param{What}}; } # -- sub Auth { my $Self = shift; my %Param = @_; # check needed stuff if (!$Param{User}) { $Self->{LogObject}->Log(Priority => 'error', Message => "Need User!"); return; } # get params my $User = $Param{User} || ''; my $Pw = $Param{Pw} || ''; my $RemoteAddr = $ENV{REMOTE_ADDR} || 'Got no REMOTE_ADDR env!'; my $UserID = ''; my $GetPw = ''; # sql query my $SQL = "SELECT pw, user ". " FROM ". " users ". " WHERE ". " user = '$User'"; $Self->{DBObject}->Prepare(SQL => $SQL); while (my @RowTmp = $Self->{DBObject}->FetchrowArray()) { $GetPw = $RowTmp[0]; $UserID = $RowTmp[1]; } my $Salt = $GetPw; $Salt =~ s/^(..).*/$1/; my $CryptedPw = crypt($Pw, $Salt); # just a note if (!$Pw) { $Self->{LogObject}->Log( Priority => 'notice', Message => "User: $User without Pw!!! (REMOTE_ADDR: $RemoteAddr)", ); return; } # login note elsif ((($GetPw)&&($User)&&($UserID)) && $CryptedPw eq $GetPw) { $Self->{LogObject}->Log( Priority => 'notice', Message => "User: $User logged in (REMOTE_ADDR: $RemoteAddr).", ); return $User; } # just a note elsif (($UserID) && ($GetPw)) { $Self->{LogObject}->Log( Priority => 'notice', Message => "User: $User with wrong Pw!!! (REMOTE_ADDR: $RemoteAddr)" ); return; } # just a note else { $Self->{LogObject}->Log( Priority => 'notice', Message => "User: $User doesn't exist or is invalid!!! (REMOTE_ADDR: $RemoteAddr)" ); return; } } # -- 1; |