# HG changeset patch # User wizard # Date 1271704846 -14400 # Node ID 6d3bca4905560e8e15cccbe9dd4564c0f6e707c6 # Parent 52eeec77504b2e2398ffe3367007c022d692934a small fixes in the security moodules diff -r 52eeec77504b -r 6d3bca490556 Lib/IMPL/Security/Auth.pm --- a/Lib/IMPL/Security/Auth.pm Mon Apr 19 02:38:18 2010 +0400 +++ b/Lib/IMPL/Security/Auth.pm Mon Apr 19 23:20:46 2010 +0400 @@ -5,7 +5,7 @@ use constant { AUTH_SUCCESS => 1, AUTH_INCOMPLETE => 2, - AUT_FAIL => 3 + AUTH_FAIL => 3 }; use base qw(Exporter); @@ -32,6 +32,12 @@ 0; } +sub Create { + my ($self,%args) = @_; + + return $self->new($self->CreateSecData(%args)); +} + 1; __END__ @@ -113,6 +119,11 @@ Создает данные безопасности, на основе параметров. Параметры зависят от пакета аутентификации. +=item C<[static] Create(%args)> + +Создает объект аутентификации, на основе параметров. Параметры зависят от пакета аутентификации. +Внутри вызывает метод C. + =item C<[static] SecDataArgs()> Возвращает хеш с описанием параметров для функции C. Ключами являются diff -r 52eeec77504b -r 6d3bca490556 Lib/IMPL/Security/Auth/Simple.pm --- a/Lib/IMPL/Security/Auth/Simple.pm Mon Apr 19 02:38:18 2010 +0400 +++ b/Lib/IMPL/Security/Auth/Simple.pm Mon Apr 19 23:20:46 2010 +0400 @@ -15,7 +15,7 @@ sub CTOR { my ($this,$secData) = @_; - my ($passImg,$cookie) = split /|/,$secData; + my ($passImg,$cookie) = split /\|/,$secData; $this->_passwordImage($passImg); $this->_sessionCookie($cookie); @@ -64,7 +64,7 @@ die new IMPL::InvalidArgumentException("The parameter is required",'password') unless $args{password}; - return md5_hex($args{password}); + return Digest::MD5::md5_hex($args{password}); } sub SecDataArgs { diff -r 52eeec77504b -r 6d3bca490556 Lib/IMPL/Web/Security.pm --- a/Lib/IMPL/Web/Security.pm Mon Apr 19 02:38:18 2010 +0400 +++ b/Lib/IMPL/Web/Security.pm Mon Apr 19 23:20:46 2010 +0400 @@ -17,7 +17,7 @@ sub AuthUser { my ($this,$name,$package,$challenge) = @_; - my $user = $this->sourceUser->search({name => $name}); + my $user = $this->sourceUser->find({name => $name}); my $auth; if ( my $secData = $user->secData($package) ) {