annotate Lib/IMPL/Security/Auth.pm @ 54:f4e045e47770

commit
author wizard@linux-odin.local
date Tue, 02 Mar 2010 20:15:57 +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;
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
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
23 1;
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
24
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
25 __END__
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
26
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
27 =pod
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
28
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
29 =head1 DESCRIPTION
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
30
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
31 Базовыйы модуль для авторизации пользователей.
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
32
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
33 Процесс авторизации состоит зи следующих шагов
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
34
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
35 1. Клиент отправляет на сервер запрос для авторизации с начальными параметрами.
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
36 2. Сервер получает запрос, находит данные аутентификации для клиента,
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
37 производит аутентификацию
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
38 3. Модуль аутентификации возвращает результат, на основе которого
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
39 либо формируется контекст безопасности, либо продолжается процесс аутентификации
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
40
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
41 Полученный контекст безопасности содержит объект для доступа к сессии аутентификации,
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
42 в которм содержится уникальные свойства сессии, например идентификатор, сеансовые ключи
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
43 и т.д.
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
44
52
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
45 Пакет аутентификации должен иметь следующий интерфейс
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
46
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
47 =over
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
48
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
49 =item C<CTOR($SecData)>
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
50
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
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
53 =item C<< $obj->DoAuth($Challenge) >>
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
54
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
55 Производит аутентификацию пользователя и инициализацию сессии, возвращает результат аутентификации, в виде массива ($status,$challenge).
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 =item C<< $obj->ValidateSession($Challenge) >>
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
58
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
59 Производит аутентификацию сессии, возвращает результат аутентификации, в виде массива ($status,$challenge).
15d720913562 security in work
wizard@linux-odin.local
parents: 51
diff changeset
60
51
a1498298d3ee Security in progress
wizard@linux-odin.local
parents:
diff changeset
61 =cut