X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/72b340de2352eec7d3f99a00e2141a2df35f07f3..165a97b3d1d6190ae2a89a853bb62b58bf698308:/SL/Auth.pm diff --git a/SL/Auth.pm b/SL/Auth.pm index 784b185b4..415898061 100644 --- a/SL/Auth.pm +++ b/SL/Auth.pm @@ -11,6 +11,7 @@ use YAML; use SL::Auth::Constants qw(:all); use SL::Auth::DB; use SL::Auth::LDAP; +use SL::Auth::Password; use SL::SessionFile; use SL::User; @@ -136,12 +137,10 @@ sub _read_auth_config { sub authenticate_root { $main::lxdebug->enter_sub(); - my $self = shift; - my $password = shift; - my $is_crypted = shift; + my ($self, $password) = @_; - $password = crypt $password, 'ro' if (!$password || !$is_crypted); - my $admin_password = crypt "$self->{admin_password}", 'ro'; + $password = SL::Auth::Password->hash_if_unhashed(login => 'root', password => $password); + my $admin_password = SL::Auth::Password->hash_if_unhashed(login => 'root', password => $self->{admin_password}); $main::lxdebug->leave_sub(); @@ -163,6 +162,21 @@ sub authenticate { return $result; } +sub store_credentials_in_session { + my ($self, %params) = @_; + + $params{password} = SL::Auth::Password->hash_if_unhashed(login => $params{login}, password => $params{password}) + unless $self->{authenticator}->requires_cleartext_password; + + $self->set_session_value(login => $params{login}, password => $params{password}); +} + +sub store_root_credentials_in_session { + my ($self, $rpw) = @_; + + $self->set_session_value(rpw => SL::Auth::Password->hash_if_unhashed(login => 'root', password => $rpw)); +} + sub dbconnect { $main::lxdebug->enter_sub(2);