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