X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FAuthentication%2FCredential%2FTypeKey.pm;h=4e6ecd2267b6f36cb20bc8148f951039d5c4ca36;hb=97676d77bae8c376a2189468209e29735656cda6;hp=4d9df06f0807e9556653eac1e68a8eb0f38ca7e1;hpb=e0a35f10bc9cf9d138afe1de9aa5a7ba3e4b158c;p=catagits%2FCatalyst-Authentication-Credential-HTTP-Proxy.git diff --git a/lib/Catalyst/Plugin/Authentication/Credential/TypeKey.pm b/lib/Catalyst/Plugin/Authentication/Credential/TypeKey.pm index 4d9df06..4e6ecd2 100644 --- a/lib/Catalyst/Plugin/Authentication/Credential/TypeKey.pm +++ b/lib/Catalyst/Plugin/Authentication/Credential/TypeKey.pm @@ -18,8 +18,8 @@ sub setup { my $config = $c->config->{authentication}{typekey} ||= {}; $config->{typekey_object} ||= do { - $config->{user_class} ||= - "Catalyst::Plugin::Authentication::User::Hash"; + ( $config->{user_class} ||= + "Catalyst::Plugin::Authentication::User::Hash" )->require; $config->{key_cache} ||= File::Spec->catfile( Catalyst::Utils::class2tempdir( $c, 1 ), @@ -58,9 +58,9 @@ sub authenticate_typekey { $store = $c->get_auth_store($store) unless ref $store; $user = $store->get_user( $p, $res ); } - else { + + if ( !$user ) { my $user_class = $config->{user_class}; - $user_class->require or die $@; $user = $user_class->new( $res ); } @@ -198,10 +198,14 @@ Where C<$parameters> is a the hash reference passed to L, and C<$result_of_verify> is the value returned by L. +If this is unset, L will +be used instead. + =item user_class -If C is not set it will use this class to instantiate an object, -calling C on the class with the same C<$parameters> hash ref. +If C or the default store returns nothing from get_user, this class +will be used to instantiate an object by calling C on the class with the +return value from L. =back