changeset 116:1722ca51537c

minor changes. Auth no more throws an exception when fails
author wizard
date Mon, 31 May 2010 08:30:39 +0400
parents 5edc2ac5231c
children 0475eb382085
files Lib/IMPL/DOM/Node.pm Lib/IMPL/Web/QueryHandler/PageFormat.pm Lib/IMPL/Web/Security.pm
diffstat 3 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/DOM/Node.pm	Wed May 26 02:32:22 2010 +0400
+++ b/Lib/IMPL/DOM/Node.pm	Mon May 31 08:30:39 2010 +0400
@@ -19,6 +19,8 @@
     public _direct property childNodes => { get => \&_getChildNodes }; # prop_list
     public _direct property parentNode => prop_get ;
     private _direct property _propertyMap => prop_all ;
+    
+    __PACKAGE__->class_data(property_bind => {});
 }
 
 our %Axes = (
--- a/Lib/IMPL/Web/QueryHandler/PageFormat.pm	Wed May 26 02:32:22 2010 +0400
+++ b/Lib/IMPL/Web/QueryHandler/PageFormat.pm	Mon May 31 08:30:39 2010 +0400
@@ -13,6 +13,7 @@
 	public property templatesCharset => prop_all;
 	public property templatesBase => prop_all;
 	public property defaultTarget => prop_all;
+	public property pathinfoPrefix => prop_all;
 }
 
 sub CTOR {
@@ -31,17 +32,22 @@
 		$this->templatesBase($ENV{DOCUMENT_ROOT}) unless $this->templatesBase;
 		
 		my $pathInfo = $ENV{PATH_INFO};
-		local $ENV{PATH_INFO} = $pathInfo || $this->defaultTarget; 
+		my $prefixRoot = "";
+		if (my $rx = $this->pathinfoPrefix) {
+			$pathInfo =~ s/($rx)//;
+			$prefixRoot = $1 if $1;
+		}
+		local $ENV{PATH_INFO} = $pathInfo || $this->defaultTarget;
 		
 		my @path = split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("PATH_INFO is empty and no defaultTarget specified" );
 		
 		$doc->LoadFile ( File::Spec->catfile($this->templatesBase,@path), $this->templatesCharset );
 		$doc->AddVar( result => $nextHandler->() );
-		$doc->AddVar( absoluteUrl => sub { "/$_[0]" } );
+		$doc->AddVar( absoluteUrl => sub { "$prefixRoot/$_[0]" } );
 		{
 			local $@;
-			$doc->AddVar( user => eval { IMPL::Security::Context->current->principal; } );
-			$doc->AddVar( session => eval { IMPL::Security::Context->current; } );
+			$doc->AddVar( user => IMPL::Security::Context->current->principal );
+			$doc->AddVar( session => IMPL::Security::Context->current );
 			warn $@ if $@;
 		}
 		
--- a/Lib/IMPL/Web/Security.pm	Wed May 26 02:32:22 2010 +0400
+++ b/Lib/IMPL/Web/Security.pm	Mon May 31 08:30:39 2010 +0400
@@ -35,10 +35,6 @@
 	
 	my ($status,$answer) = $auth->DoAuth($challenge);
 	
-	if ($status == AUTH_FAIL) {
-		die new IMPL::SecurityException("Authentication failed","DoAuth failed");
-	}
-	
 	return {
 		status => $status,
 		answer => $answer,