51
|
1 package IMPL::Security::Auth;
|
|
2
|
52
|
3 use Digest::MD5 qw(md5_hex);
|
|
4
|
51
|
5 use constant {
|
52
|
6 AUTH_SUCCESS => 1,
|
|
7 AUTH_INCOMPLETE => 2,
|
87
|
8 AUTH_FAIL => 3
|
51
|
9 };
|
|
10
|
166
|
11 use parent qw(Exporter);
|
51
|
12
|
52
|
13 our @EXPORT_OK = qw(&AUTH_SUCCESS &AUTH_INCOMPLETE &AUTH_FAIL &GenSSID);
|
|
14 our %EXPORT_TAGS = (Const => [qw(&AUTH_SUCCESS &AUTH_INCOMPLETE &AUTH_FAIL)]);
|
|
15
|
|
16 {
|
|
17 my $i = 0;
|
|
18 sub GenSSID() {
|
|
19 return md5_hex(time,rand,$i++);
|
|
20 }
|
|
21 }
|
51
|
22
|
69
|
23 sub DoAuth {
|
|
24 die new IMPL::NotImplementedException;
|
|
25 }
|
|
26
|
|
27 sub ValidateSession {
|
|
28 die new IMPL::NotImplementedException;
|
|
29 }
|
|
30
|
73
|
31 sub isTrusted {
|
|
32 0;
|
|
33 }
|
|
34
|
87
|
35 sub Create {
|
|
36 my ($self,%args) = @_;
|
|
37
|
|
38 return $self->new($self->CreateSecData(%args));
|
|
39 }
|
|
40
|
51
|
41 1;
|
|
42
|
|
43 __END__
|
|
44
|
|
45 =pod
|
|
46
|
71
|
47 =head1 NAME
|
51
|
48
|
71
|
49 C<IMPL::Security::Auth> .
|
|
50
|
|
51 =head1 DESCRIPTION
|
51
|
52
|
81
|
53 C<[Abstract]>
|
|
54
|
70
|
55 ,
|
|
56 .
|
51
|
57
|
70
|
58 ,
|
|
59 .
|
|
60
|
|
61 C<$challenge>.
|
|
62 (C<AUTH_SUCCESS>),
|
|
63 (C<AUTH_INCOMPLETE>), (C<AUTH_FAIL>). ,
|
|
64 .
|
52
|
65
|
71
|
66 =head1 EXPORT
|
|
67
|
|
68 =over
|
|
69
|
|
70 =item C<:Const>
|
|
71
|
|
72
|
|
73
|
|
74 =over
|
|
75
|
|
76 =item C<AUTH_SUCCESS>
|
|
77
|
|
78
|
|
79
|
|
80 =item C<AUTH_INCOMPLETE>
|
|
81
|
|
82
|
|
83
|
72
|
84 =item C<AUTH_FAIL>
|
71
|
85
|
|
86 .
|
|
87
|
|
88 =back
|
|
89
|
|
90 =back
|
|
91
|
|
92 =head1 MEMBERS
|
|
93
|
52
|
94 =over
|
|
95
|
|
96 =item C<CTOR($SecData)>
|
|
97
|
71
|
98 .
|
|
99 C<$SecData> - .
|
|
100
|
73
|
101 =item C<[get] isTrusted>
|
|
102
|
|
103 , .
|
|
104
|
81
|
105 =item C<DoAuth($challenge)>
|
52
|
106
|
71
|
107 ,
|
|
108 , ($status,$challenge).
|
|
109
|
81
|
110 C<$challenge>
|
|
111 .
|
|
112
|
|
113 =item C<ValidateSession($challenge)>
|
52
|
114
|
71
|
115 , ,
|
|
116 ($status,$challenge).
|
|
117
|
|
118 =item C<[static] CreateSecData(%args)>
|
52
|
119
|
71
|
120 , . .
|
52
|
121
|
87
|
122 =item C<[static] Create(%args)>
|
|
123
|
|
124 , . .
|
|
125 C<CreateSecData(%args)>.
|
|
126
|
71
|
127 =item C<[static] SecDataArgs()>
|
|
128
|
|
129 C<CreateSecData>.
|
73
|
130 , - .
|
|
131
|
|
132 =back
|
52
|
133
|
51
|
134 =cut |