Author: spadkins
Date: Mon Jul 30 15:46:19 2007
New Revision: 9817
Added:
p5ee/trunk/App-Context/lib/App/Authentication/
Modified:
p5ee/trunk/App-Context/lib/App/Authentication.pm
p5ee/trunk/App-Context/lib/App/Context.pm
p5ee/trunk/App-Context/lib/App/Context/Server.pm
p5ee/trunk/App-Context/lib/App/Request.pm
p5ee/trunk/App-Context/lib/App/Request/CGI.pm
Log:
app-level authentication and web service dispatching
Modified: p5ee/trunk/App-Context/lib/App/Authentication.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Authentication.pm (original)
+++ p5ee/trunk/App-Context/lib/App/Authentication.pm Mon Jul 30 15:46:19 2007
@@ -129,10 +129,9 @@
=cut
-sub get_username {
- my ($self) = @_;
- my $username = $ENV{REMOTE_USER} || getlogin || (getpwuid($<))[0] ||
"guest";
- return($username);
+sub authenticate {
+ my ($self, $username, $password) = @_;
+ return(1);
}
#############################################################################
Modified: p5ee/trunk/App-Context/lib/App/Context.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context.pm (original)
+++ p5ee/trunk/App-Context/lib/App/Context.pm Mon Jul 30 15:46:19 2007
@@ -784,19 +784,19 @@
my ($exists, $session_object_type, $session_object_class);
$session_object_class =
-
$self->{session}{cache}{SessionObject}{$session_object_name}{session_object_class}
||
-
$self->{session}{store}{SessionObject}{$session_object_name}{session_object_class}
||
-
$self->{conf}{SessionObject}{$session_object_name}{session_object_class};
+ $self->{session}{cache}{SessionObject}{$session_object_name}{class} ||
+ $self->{session}{store}{SessionObject}{$session_object_name}{class} ||
+ $self->{conf}{SessionObject}{$session_object_name}{class};
if (!$session_object_class) {
$session_object_type =
-
$self->{session}{cache}{SessionObject}{$session_object_name}{session_object_type}
||
-
$self->{session}{store}{SessionObject}{$session_object_name}{session_object_type}
||
-
$self->{conf}{SessionObject}{$session_object_name}{session_object_type};
+ $self->{session}{cache}{SessionObject}{$session_object_name}{type}
||
+ $self->{session}{store}{SessionObject}{$session_object_name}{type}
||
+ $self->{conf}{SessionObject}{$session_object_name}{type};
if ($session_object_type) {
- $session_object_class =
$self->{conf}{SessionObjectType}{$session_object_type}{session_object_class};
+ $session_object_class =
$self->{conf}{SessionObjectType}{$session_object_type}{class};
}
}
Modified: p5ee/trunk/App-Context/lib/App/Context/Server.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context/Server.pm (original)
+++ p5ee/trunk/App-Context/lib/App/Context/Server.pm Mon Jul 30 15:46:19 2007
@@ -225,8 +225,8 @@
eval {
$time = time();
$events_occurred = 0;
- # Don't start dispatching these requests until a brief wait after
starting.
- # We want all of the nodes to get a chance to register themselves.
+ # Don't start dispatching these requests until a brief wait
after starting.
+ # We want all of the nodes to get a chance to register
themselves.
if (($time-$start_time >= 4) && $#{$self->{pending_async_events}}
> -1) {
$events_occurred += $self->dispatch_pending_async_events(1);
}
Modified: p5ee/trunk/App-Context/lib/App/Request.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Request.pm (original)
+++ p5ee/trunk/App-Context/lib/App/Request.pm Mon Jul 30 15:46:19 2007
@@ -178,6 +178,59 @@
}
#############################################################################
+# http_method()
+#############################################################################
+
+=head2 http_method()
+
+Returns the HTTP method used in this request (i.e. "GET" or "POST").
+
+ * Signature: $http_method = $request->http_method();
+ * Param: void
+ * Return: string
+ * Throws: <none>
+ * Since: 0.01
+
+ Sample Usage:
+
+ $http_method = $request->http_method();
+
+=cut
+
+sub http_method {
+ &App::sub_entry if ($App::trace);
+ &App::sub_exit(undef) if ($App::trace);
+ return(undef);
+}
+
+#############################################################################
+# content_type()
+#############################################################################
+
+=head2 content_type()
+
+Returns the content_type of data submitted in a POST, generally
"multipart/form-data"
+or "application/x-www-form-urlencoded".
+
+ * Signature: $content_type = $request->content_type();
+ * Param: void
+ * Return: string
+ * Throws: <none>
+ * Since: 0.01
+
+ Sample Usage:
+
+ $content_type = $request->content_type();
+
+=cut
+
+sub content_type {
+ &App::sub_entry if ($App::trace);
+ &App::sub_exit(undef) if ($App::trace);
+ return(undef);
+}
+
+#############################################################################
# get_session_id()
#############################################################################
Modified: p5ee/trunk/App-Context/lib/App/Request/CGI.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Request/CGI.pm (original)
+++ p5ee/trunk/App-Context/lib/App/Request/CGI.pm Mon Jul 30 15:46:19 2007
@@ -332,10 +332,10 @@
$init_args = $temp if ($temp);
my $content = "";
- if (!$method && $request_method eq "POST") {
- $content = $ENV{CONTENT};
- if ($content =~ /^\s*<([A-Za-z_]+)/s) {
- $method = $1;
+ if (!$method && $request_method eq "POST" && $cgi->{POSTDATA} &&
ref($cgi->{POSTDATA}) eq "ARRAY" && $#{$cgi->{POSTDATA}} > -1) {
+ $content = $cgi->{POSTDATA}[0];
+ if ($content =~ /^\s*(<\?xml[^<>]*\?>)?\s*<([A-Za-z_]+)/s) {
+ $method = $2;
$args = [ $content ];
}
}
@@ -434,7 +434,7 @@
if ($var =~ /[\[\]\{\}\.]/) {
$context->so_set($var, "", $value);
}
- elsif ($var eq "service" || $var eq "name" || $var eq "method"
||
+ elsif ($var eq "service" || $var eq "name" || $var eq
"init_args" || $var eq "method" ||
$var eq "args" || $var eq "returntype") {
# this has already been done
# $context->so_set("default", $var, $value);