Stop forcing $authinfo->{id} to be passed down to the store, instead using just confi...
Tomas Doran [Mon, 24 Aug 2009 13:30:51 +0000 (13:30 +0000)]
lib/Catalyst/Authentication/Credential/Remote.pm
t/lib/RemoteTestApp2.pm
t/live_app_remote2.t

index b4266c6..4bf8960 100644 (file)
@@ -35,7 +35,7 @@ sub new {
     }
     $self->source($config->{source} || 'REMOTE_USER');
     $self->realm($realm);
-    $self->username_field($config->{username_field} || 'username');
+    $self->username_field($config->{username_field} || 'id');
     return $self;
 }
 
@@ -104,9 +104,8 @@ sub authenticate {
             $usr = $1;
         }
     }
-    
-    $authinfo->{id} = $authinfo->{ $self->username_field } = $usr;
-    $authinfo->{remote_user} = $remuser; # just to keep the original value
+
+    $authinfo->{ $self->username_field } = $usr;
     my $user_obj = $realm->find_user( $authinfo, $c );
     return ref($user_obj) ? $user_obj : undef;
 }
index 5d4c697..6aa2675 100644 (file)
@@ -30,10 +30,10 @@ __PACKAGE__->config(
 sub default : Local {
     my ( $self, $c ) = @_;
     if ($c->authenticate()) {
-        $c->res->body( 'User:'
-              . $c->user->{id} . "\n"
-              . 'my_user_name:'
-              . $c->user->{my_user_name} );
+        $c->res->body( 
+              'my_user_name:'
+              . $c->user->{my_user_name}
+        );
     }
     else {
         $c->res->body('FAIL');
index a9f8c34..f59f4b4 100644 (file)
@@ -16,5 +16,5 @@ ok( request('/')->is_success, 'testing "source" option' );
 
 $RemoteTestEngine::SSL_CLIENT_S_DN = 'CN=namexyz/OU=Test/C=Company';
 ok( request('/')->is_success, 'testing "source" + "cutname" 1' );
-is( request('/')->content, "User:namexyz\nmy_user_name:namexyz",
+is( request('/')->content, "my_user_name:namexyz",
    'testing "source" + "cutname" 2' );