annotate Lib/IMPL/Security/Auth.pm @ 70:2dfb0b0ad12f

More docs
author wizard
date Wed, 24 Mar 2010 17:42:04 +0300
parents 8c7b88bdb663
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;
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
2
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
3 use Digest::MD5 qw(md5_hex);
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
4
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
5 use constant {
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
6 AUTH_SUCCESS => 1,
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
7 AUTH_INCOMPLETE => 2,
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
8 AUT_FAIL => 3
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
9 };
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
10
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
11 use base qw(Exporter);
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
12
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
13 our @EXPORT_OK = qw(&AUTH_SUCCESS &AUTH_INCOMPLETE &AUTH_FAIL &GenSSID);
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
14 our %EXPORT_TAGS = (Const => [qw(&AUTH_SUCCESS &AUTH_INCOMPLETE &AUTH_FAIL)]);
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 {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
17 my $i = 0;
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
18 sub GenSSID() {
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
19 return md5_hex(time,rand,$i++);
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
20 }
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
21 }
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
22
69
8c7b88bdb663 Cookie Simple auth support
wizard
parents: 68
diff changeset
23 sub DoAuth {
8c7b88bdb663 Cookie Simple auth support
wizard
parents: 68
diff changeset
24 die new IMPL::NotImplementedException;
8c7b88bdb663 Cookie Simple auth support
wizard
parents: 68
diff changeset
25 }
8c7b88bdb663 Cookie Simple auth support
wizard
parents: 68
diff changeset
26
8c7b88bdb663 Cookie Simple auth support
wizard
parents: 68
diff changeset
27 sub ValidateSession {
8c7b88bdb663 Cookie Simple auth support
wizard
parents: 68
diff changeset
28 die new IMPL::NotImplementedException;
8c7b88bdb663 Cookie Simple auth support
wizard
parents: 68
diff changeset
29 }
8c7b88bdb663 Cookie Simple auth support
wizard
parents: 68
diff changeset
30
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
31 1;
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
32
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
33 __END__
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
34
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
35 =pod
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
36
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
37 =head1 DESCRIPTION
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
38
68
739f1288ca84 Auth in progress
wizard
parents: 52
diff changeset
39 Базовыйы объект для авторизации.
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
40
70
2dfb0b0ad12f More docs
wizard
parents: 69
diff changeset
41 Аутентификация носит итеративный характер, для чего создается объект аутентификации который
2dfb0b0ad12f More docs
wizard
parents: 69
diff changeset
42 сохраняет состояние между итерациями.
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
43
70
2dfb0b0ad12f More docs
wizard
parents: 69
diff changeset
44 Результатом аутентификации является сессия, состояние этой сессии также хранит объект
2dfb0b0ad12f More docs
wizard
parents: 69
diff changeset
45 аутентификации.
2dfb0b0ad12f More docs
wizard
parents: 69
diff changeset
46
2dfb0b0ad12f More docs
wizard
parents: 69
diff changeset
47 В процессе авторизации клиент и сервер обмениеваются данными безопасности C<$challenge>.
2dfb0b0ad12f More docs
wizard
parents: 69
diff changeset
48 И результатом каждой итерации является либо упех (C<AUTH_SUCCESS>), либо запрос на продолжение
2dfb0b0ad12f More docs
wizard
parents: 69
diff changeset
49 (C<AUTH_INCOMPLETE>), либо неудача (C<AUTH_FAIL>). Количество итераций может быть разным,
2dfb0b0ad12f More docs
wizard
parents: 69
diff changeset
50 зависит от пакета аутентификации.
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
51
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
52 =over
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
53
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
54 =item C<CTOR($SecData)>
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
55
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
56 Создает пакет для авторизации на основе данных безопасности для пользователя
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
57
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
58 =item C<< $obj->DoAuth($Challenge) >>
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
59
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
60 Производит аутентификацию пользователя и инициализацию сессии, возвращает результат аутентификации, в виде массива ($status,$challenge).
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
61
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
62 =item C<< $obj->ValidateSession($Challenge) >>
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
63
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
64 Производит аутентификацию сессии, возвращает результат аутентификации, в виде массива ($status,$challenge).
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
65
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
66 =cut