Fix all the ->config invocations in docs to be more correct
[catagits/Catalyst-Plugin-Authentication.git] / lib / Catalyst / Authentication / Store / Null.pm
CommitLineData
5c5af345 1package Catalyst::Authentication::Store::Null;
f05e1d28 2
3use strict;
4use warnings;
5
5c5af345 6use Catalyst::Authentication::User::Hash;
f05e1d28 7
8use base qw( Class::Accessor::Fast );
9
10BEGIN {
106913db 11 __PACKAGE__->mk_accessors( qw( _config ) );
f05e1d28 12}
13
14sub new {
5afc0dde 15 my ( $class, $config, $app, $realm ) = @_;
106913db 16 bless { _config => $config }, $class;
f05e1d28 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 ) = @_;
5c5af345 31 return bless $userinfo, 'Catalyst::Authentication::User::Hash';
f05e1d28 32}
33
34sub user_supports {
35 my $self = shift;
5c5af345 36 Catalyst::Authentication::User::Hash->supports(@_);
f05e1d28 37}
38
391;
55fa99fd 40
41__END__
42
43=pod
44
45=head1 NAME
46
5c5af345 47Catalyst::Authentication::Store::Null - Null authentication store
55fa99fd 48
49=head1 SYNOPSIS
50
51 use Catalyst qw(
52 Authentication
53 );
54
c83ea211 55 __PACKAGE__->config( 'Plugin::Authentication' => {
55fa99fd 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 }
c83ea211 68 });
55fa99fd 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
5c5af345 94the user info bless as a L<Catalyst::Authentication::User::Hash>
55fa99fd 95object.
96
97=head2 user_supports( )
98
5c5af345 99Delegates to L<Catalyst::Authentication::User::Hash>.
55fa99fd 100
101=cut