r34155@cain (orig r5598): jayk | 2006-11-27 08:21:47 +0000
[catagits/Catalyst-Plugin-Authentication.git] / lib / Catalyst / Plugin / Authentication / User.pm
index 5961220..f77fdd2 100644 (file)
@@ -16,19 +16,24 @@ sub auth_realm {
 }
 
 
-
+## this relies on 'supported_features' being implemented by the subclass.. 
+## but it is not an error if it is not.  it just means you support nothing.  
+## nihilist user objects are welcome here.
 sub supports {
     my ( $self, @spec ) = @_;
 
-    my $cursor = $self->supported_features;
+    my $cursor = undef;
+    if ($self->can('supported_features')) {
+        $cursor = $self->supported_features;
 
-    # traverse the feature list,
-    for (@spec) {
-        #die "bad feature spec: @spec" if ref($cursor) ne "HASH";
-        return if ref($cursor) ne "HASH";
+        # traverse the feature list,
+        for (@spec) {
+            #die "bad feature spec: @spec" if ref($cursor) ne "HASH";
+            return if ref($cursor) ne "HASH";
 
-        $cursor = $cursor->{$_};
-    }
+            $cursor = $cursor->{$_};
+        }
+    } 
 
     return $cursor;
 }