annotate Lib/Security.pm @ 24:7f00786f8210

Первая рабочая реазизация схемы и навигаторов
author Sergey
date Mon, 05 Oct 2009 00:48:49 +0400
parents 03e58a454b20
children 1c3c3e63a314
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
1 use strict;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
2 package Security;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
3
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
4 use constant {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
5 AUTH_FAILED => 0,
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
6 AUTH_SUCCESS => 1,
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
7 AUTH_INCOMPLETE => 2,
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
8 AUTH_NOAUTH => 3
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
9 };
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
10
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
11 my $CurrentSession;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
12
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
13 sub CurrentSession {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
14 my ($class,$newSession) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
15
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
16 $CurrentSession = $newSession if @_>=2;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
17 return $CurrentSession;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
18 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
19
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
20 package Security::AuthResult;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
21 use Common;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
22 our @ISA = qw(Object);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
23
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
24 BEGIN {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
25 DeclareProperty State => ACCESS_READ;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
26 DeclareProperty Session => ACCESS_READ;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
27 DeclareProperty ClientSecData => ACCESS_READ;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
28 DeclareProperty AuthMod => ACCESS_READ;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
29 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
30
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
31 sub isSuccess {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
32 my ($this) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
33 return $this->{$State} == Security::AUTH_SUCCESS;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
34 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
35
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
36
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
37 1;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
38