annotate Lib/IMPL/Web/Application/Session.pm @ 59:0f3e369553bd

Rewritten property implementation (probably become slower but more flexible) Configuration infrastructure in progress (in the aspect of the lazy activation) Initial concept for the code generator
author wizard
date Tue, 09 Mar 2010 02:50:45 +0300
parents bf59ee1cd506
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
57
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
1 package IMPL::Web::Application::Session;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
2 use strict;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
3
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
4 use base qw(IMPL::Object);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
5
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
6 use IMPL::Security::Auth qw(GenSSID);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
7
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
8 use IMPL::Class::Property;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
9
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
10 BEGIN {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
11 public property id => prop_get | owner_set;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
12 public property principal => prop_get | owner_set;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
13 public property authSession => prop_get | owner_set;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
14 public property roles => prop_get | owner_set | prop_list;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
15 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
16
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
17 sub CTOR {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
18 my ($this,%args) = @_;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
19
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
20 $this->principal($args{principal}) or die new IMPL::InvalidArgumentException("A principal is required");
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
21 $this->authSession($args{auth}) or die new IMPL::InvalidArgumentException("An auth session is required");
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
22 $this->roles($args{roles}) if $args{roles};
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
23
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
24 $this->id(GenSSID());
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
25 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
26
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
27 sub DoAuth {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
28 my ($this,$secData) = @_;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
29
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
30 return $this->authSession->DoAuth($secData);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
31 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
32
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
33 sub ValidateSession {
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
34 my ($this,$secData) = @_;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
35
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
36 return $this->authSession->ValidateSession($secData);
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
37 }
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
38
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
39 1;
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
40
bf59ee1cd506 Web application main class functionality
wizard
parents:
diff changeset
41 __END__