Mercurial > pub > Impl
changeset 87:6d3bca490556
small fixes in the security moodules
author | wizard |
---|---|
date | Mon, 19 Apr 2010 23:20:46 +0400 |
parents | 52eeec77504b |
children | 0d2337e203c0 |
files | Lib/IMPL/Security/Auth.pm Lib/IMPL/Security/Auth/Simple.pm Lib/IMPL/Web/Security.pm |
diffstat | 3 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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<CreateSecData(%args)>. + =item C<[static] SecDataArgs()> Возвращает хеш с описанием параметров для функции C<CreateSecData>. Ключами являются
--- 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 {
--- 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) ) {