annotate Lib/IMPL/Security/Auth/Simple.pm @ 56:117b6956d5a5

Web application in progress
author wizard
date Thu, 04 Mar 2010 15:46:17 +0300
parents 15d720913562
children 739f1288ca84
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 import IMPL::Security::Auth qw(:Const GenSSID);
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
6
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
7 use IMPL::Class::Property;
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
8
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
9 BEGIN {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
10 private property _passwordImage => prop_all;
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
11 private property _sessionCookie => prop_all;
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
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
14 sub CTOR {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
15 my ($this,$secData) = @_;
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
16
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
17 $this->_passwordImage($secData);
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
18 }
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
19
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
20 sub DoAuth {
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
21 my ($this,$challenge) = @_;
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
22
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
23 if (Digest::MD5::md5_hex($challenge) eq $this->_passwordImage) {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
24 return (SUCCESS,$this->_sessionCookie(GenSSID));
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
25 } elsee {
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
26 return (FAIL,undef);
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
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
30 sub ValidateSession {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
31 my ($this,$cookie) = @_;
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
32
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
33 if ($cookie eq $this->_sessionCookie) {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
34 return (SUCCESS,undef);
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
35 } else {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
36 return (FAIL,undef);
51
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
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
40 1;
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
41
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
42 __END__
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
43
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
44 =pod
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
45
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
46 =head1 DESCRIPTION
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
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
50 =cut