3 package Catalyst::Plugin::Authentication::User;
9 ## chances are you want to override this.
10 sub id { shift->get('id'); }
12 ## returns the realm the user came from - not a good idea to override this.
21 my ( $self, @spec ) = @_;
23 my $cursor = $self->supported_features;
25 # traverse the feature list,
27 #die "bad feature spec: @spec" if ref($cursor) ne "HASH";
28 return if ref($cursor) ne "HASH";
30 $cursor = $cursor->{$_};
37 ## get should return the value of the field specified as it's single argument from the underlying
38 ## user object. This is here to provide a simple, standard way of accessing individual elements of a user
39 ## object - ensuring no overlap between C::P::A::User methods and actual fieldnames.
40 ## this is not the most effecient method, since it uses introspection. If you have an underlying object
41 ## you most likely want to write this yourself.
43 my ($self, $field) = @_;
46 if ($object = $self->get_object && $object->can($field)) {
47 return $object->$field();
54 ## get_object should return the underlying user object. This is for when more advanced uses of the
55 ## user is required. Modifications to the existing user, etc. Changes in the object returned
56 ## by this routine may not be reflected in the C::P::A::User object - if this is required, re-authenticating
57 ## the user is probably the best route to take.
58 ## note that it is perfectly acceptable to return $self in cases where there is no underlying object.
63 ## this is an internal routine. I suggest you don't rely on it's presence.
64 ## sets the realm the user came from.
66 my ($self, $realmname) = @_;
67 $self->{'realm'} = $realmname;
70 ## Backwards Compatibility
71 ## you probably want auth_realm, in fact. but this does work for backwards compatibility.
74 return $self->auth_realm->{store};
85 Catalyst::Plugin::Authentication::User - Base class for user objects.
89 package MyStore::User;
90 use base qw/Catalyst::Plugin::Authentication::User/;
94 This is the base class for authenticated
102 A unique ID by which a user can be retrieved from the store.
106 Should return a class name that can be used to refetch the user using it's
111 An introspection method used to determine what features a user object has, to support credential and authorization plugins.