Kill off Class::Accessor::Fast
[catagits/Catalyst-Plugin-Authentication.git] / lib / Catalyst / Authentication / Store / Null.pm
CommitLineData
5c5af345 1package Catalyst::Authentication::Store::Null;
202af0af 2use Moose;
3use namespace::autoclean;
f05e1d28 4
202af0af 5with 'MooseX::Emulate::Class::Accessor::Fast';
f05e1d28 6
5c5af345 7use Catalyst::Authentication::User::Hash;
f05e1d28 8
202af0af 9__PACKAGE__->mk_accessors( qw( _config ) );
f05e1d28 10
11sub new {
5afc0dde 12 my ( $class, $config, $app, $realm ) = @_;
106913db 13 bless { _config => $config }, $class;
f05e1d28 14}
15
16sub for_session {
675fe850 17 my ( $self, $c, $user ) = @_;
f05e1d28 18 return $user;
19}
20
21sub from_session {
675fe850 22 my ( $self, $c, $user ) = @_;
f05e1d28 23 return $user;
24}
25
26sub find_user {
27 my ( $self, $userinfo, $c ) = @_;
5c5af345 28 return bless $userinfo, 'Catalyst::Authentication::User::Hash';
f05e1d28 29}
30
31sub user_supports {
32 my $self = shift;
5c5af345 33 Catalyst::Authentication::User::Hash->supports(@_);
f05e1d28 34}
35
361;
55fa99fd 37
38__END__
39
40=pod
41
42=head1 NAME
43
5c5af345 44Catalyst::Authentication::Store::Null - Null authentication store
55fa99fd 45
46=head1 SYNOPSIS
47
48 use Catalyst qw(
49 Authentication
50 );
51
c83ea211 52 __PACKAGE__->config( 'Plugin::Authentication' => {
55fa99fd 53 default_realm => 'remote',
54 realms => {
55 remote => {
56 credential => {
57 class => 'TypeKey',
58 key_url => 'http://example.com/regkeys.txt',
59 },
60 store => {
61 class => 'Null',
62 }
63 }
675fe850 64 }
c83ea211 65 });
55fa99fd 66
67=head1 DESCRIPTION
68
69The Null store is a transparent store where any supplied user data is
70accepted. This is mainly useful for remotely authenticating credentials
71(e.g. TypeKey, OpenID) which may not be tied to any local storage. It also
72helps facilitate integration with the Session plugin.
73
74=head1 METHODS
75
76=head2 new( )
77
78Creates a new instance of the store.
79
80=head2 for_session( )
81
82Returns the user object passed to the method.
83
84=head2 from_session( )
85
86Returns the user object passed to the method.
87
88=head2 find_user( )
89
90Since this store isn't tied to any real set of users, this method just returns
5c5af345 91the user info bless as a L<Catalyst::Authentication::User::Hash>
55fa99fd 92object.
93
94=head2 user_supports( )
95
5c5af345 96Delegates to L<Catalyst::Authentication::User::Hash>.
55fa99fd 97
98=cut