51
|
1 package IMPL::Security::Auth::Simple;
|
|
2
|
|
3 use base qw(IMPL::Security::Auth);
|
|
4 use Digest::MD5;
|
52
|
5
|
|
6 use IMPL::Class::Property;
|
|
7
|
|
8 BEGIN {
|
|
9 private property _passwordImage => prop_all;
|
|
10 private property _sessionCookie => prop_all;
|
|
11 }
|
|
12
|
|
13 sub CTOR {
|
|
14 my ($this,$secData) = @_;
|
|
15
|
|
16 $this->_passwordImage($secData);
|
|
17 }
|
51
|
18
|
|
19 sub DoAuth {
|
52
|
20 my ($this,$challenge) = @_;
|
51
|
21
|
52
|
22 if (Digest::MD5::md5_hex($challenge) eq $this->_passwordImage) {
|
68
|
23 return (SUCCESS,$this->_sessionCookie($this->GenSSID));
|
51
|
24 } elsee {
|
52
|
25 return (FAIL,undef);
|
|
26 }
|
|
27 }
|
|
28
|
|
29 sub ValidateSession {
|
|
30 my ($this,$cookie) = @_;
|
|
31
|
|
32 if ($cookie eq $this->_sessionCookie) {
|
|
33 return (SUCCESS,undef);
|
|
34 } else {
|
|
35 return (FAIL,undef);
|
51
|
36 }
|
|
37 }
|
|
38
|
|
39 1;
|
|
40
|
|
41 __END__
|
|
42
|
|
43 =pod
|
|
44
|
|
45 =head1 DESCRIPTION
|
|
46
|
|
47 Модуль простой авторизации
|
|
48
|
|
49 =cut |