Mercurial > pub > Impl
comparison Lib/IMPL/Security/Auth/Simple.pm @ 72:eac47fa4f262
docs
| author | wizard |
|---|---|
| date | Fri, 26 Mar 2010 16:26:31 +0300 |
| parents | d92d5ddaf524 |
| children | 2f31ecabe9ea |
comparison
equal
deleted
inserted
replaced
| 71:d92d5ddaf524 | 72:eac47fa4f262 |
|---|---|
| 19 | 19 |
| 20 sub DoAuth { | 20 sub DoAuth { |
| 21 my ($this,$challenge) = @_; | 21 my ($this,$challenge) = @_; |
| 22 | 22 |
| 23 if (Digest::MD5::md5_hex($challenge) eq $this->_passwordImage) { | 23 if (Digest::MD5::md5_hex($challenge) eq $this->_passwordImage) { |
| 24 return (SUCCESS,$this->_sessionCookie($this->GenSSID)); | 24 return (AUTH_SUCCESS,$this->_sessionCookie($this->GenSSID)); |
| 25 } elsee { | 25 } elsee { |
| 26 return (FAIL,undef); | 26 return (AUTH_FAIL,undef); |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 sub ValidateSession { | 30 sub ValidateSession { |
| 31 my ($this,$cookie) = @_; | 31 my ($this,$cookie) = @_; |
| 32 | 32 |
| 33 if ($cookie eq $this->_sessionCookie) { | 33 if ($cookie eq $this->_sessionCookie) { |
| 34 return (SUCCESS,undef); | 34 return (AUTH_SUCCESS,undef); |
| 35 } else { | 35 } else { |
| 36 return (FAIL,undef); | 36 return (AUTH_FAIL,undef); |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 sub CreateSecData { | 40 sub CreateSecData { |
| 41 my ($self,%args) = @_; | 41 my ($self,%args) = @_; |
| 44 | 44 |
| 45 return md5_hex($args{password}); | 45 return md5_hex($args{password}); |
| 46 } | 46 } |
| 47 | 47 |
| 48 sub SecDataArgs { | 48 sub SecDataArgs { |
| 49 | 49 password => 'SCALAR' |
| 50 | |
| 51 } | 50 } |
| 52 | 51 |
| 53 1; | 52 1; |
| 54 | 53 |
| 55 __END__ | 54 __END__ |
| 60 | 59 |
| 61 C<IMPL::Security::Auth::Simple> Модуль простой авторизации. | 60 C<IMPL::Security::Auth::Simple> Модуль простой авторизации. |
| 62 | 61 |
| 63 =head1 DESCRIPTION | 62 =head1 DESCRIPTION |
| 64 | 63 |
| 64 Использует алгоритм MD5 для хранения образа пароля. | |
| 65 | 65 |
| 66 =head1 MEMBERS | |
| 66 | 67 |
| 68 =over | |
| 69 | |
| 70 =item C<DoAuth($challenge)> | |
| 71 | |
| 72 Аутентифицирует пользователя. Используется один этап. C<$challenge> | |
| 73 открытый пароль пользователя. | |
| 74 | |
| 75 Возвращает C<($status,$challenge)> | |
| 76 | |
| 77 =over | |
| 78 | |
| 79 =item C<$status> | |
| 80 | |
| 81 Результат либо C<AUTH_SUCCESS>, либо C<AUTH_FAIL> | |
| 82 | |
| 83 =item | |
| 84 | |
| 85 =back | |
| 86 | |
| 87 =back | |
| 67 | 88 |
| 68 =cut | 89 =cut |
