annotate Lib/IMPL/Security/Auth/Simple.pm @ 68:739f1288ca84

Auth in progress
author wizard
date Tue, 23 Mar 2010 16:55:25 +0300
parents 15d720913562
children d92d5ddaf524
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
1 package IMPL::Security::Auth::Simple;
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
2
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
3 use base qw(IMPL::Security::Auth);
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
4 use Digest::MD5;
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
5
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
6 use IMPL::Class::Property;
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
7
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
8 BEGIN {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
9 private property _passwordImage => prop_all;
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
10 private property _sessionCookie => prop_all;
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
11 }
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
12
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
13 sub CTOR {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
14 my ($this,$secData) = @_;
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
15
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
16 $this->_passwordImage($secData);
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
17 }
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
18
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
19 sub DoAuth {
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
20 my ($this,$challenge) = @_;
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
21
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
22 if (Digest::MD5::md5_hex($challenge) eq $this->_passwordImage) {
68
739f1288ca84 Auth in progress
wizard
parents: 52
diff changeset
23 return (SUCCESS,$this->_sessionCookie($this->GenSSID));
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
24 } elsee {
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
25 return (FAIL,undef);
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
26 }
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
27 }
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
28
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
29 sub ValidateSession {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
30 my ($this,$cookie) = @_;
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
31
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
32 if ($cookie eq $this->_sessionCookie) {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
33 return (SUCCESS,undef);
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
34 } else {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
35 return (FAIL,undef);
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
36 }
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
37 }
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
38
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
39 1;
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
40
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
41 __END__
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
42
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
43 =pod
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
44
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
45 =head1 DESCRIPTION
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
46
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
47 Модуль простой авторизации
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
48
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
49 =cut