Commit | Line | Data |
5c5af345 |
1 | package Catalyst::Authentication::Store::Null; |
202af0af |
2 | use Moose; |
3 | use namespace::autoclean; |
f05e1d28 |
4 | |
202af0af |
5 | with 'MooseX::Emulate::Class::Accessor::Fast'; |
f05e1d28 |
6 | |
5c5af345 |
7 | use Catalyst::Authentication::User::Hash; |
f05e1d28 |
8 | |
202af0af |
9 | __PACKAGE__->mk_accessors( qw( _config ) ); |
f05e1d28 |
10 | |
11 | sub new { |
5afc0dde |
12 | my ( $class, $config, $app, $realm ) = @_; |
106913db |
13 | bless { _config => $config }, $class; |
f05e1d28 |
14 | } |
15 | |
16 | sub for_session { |
675fe850 |
17 | my ( $self, $c, $user ) = @_; |
f05e1d28 |
18 | return $user; |
19 | } |
20 | |
21 | sub from_session { |
675fe850 |
22 | my ( $self, $c, $user ) = @_; |
f05e1d28 |
23 | return $user; |
24 | } |
25 | |
26 | sub find_user { |
27 | my ( $self, $userinfo, $c ) = @_; |
5c5af345 |
28 | return bless $userinfo, 'Catalyst::Authentication::User::Hash'; |
f05e1d28 |
29 | } |
30 | |
31 | sub user_supports { |
32 | my $self = shift; |
5c5af345 |
33 | Catalyst::Authentication::User::Hash->supports(@_); |
f05e1d28 |
34 | } |
35 | |
36 | 1; |
55fa99fd |
37 | |
38 | __END__ |
39 | |
40 | =pod |
41 | |
42 | =head1 NAME |
43 | |
5c5af345 |
44 | Catalyst::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 | |
69 | The Null store is a transparent store where any supplied user data is |
70 | accepted. This is mainly useful for remotely authenticating credentials |
71 | (e.g. TypeKey, OpenID) which may not be tied to any local storage. It also |
72 | helps facilitate integration with the Session plugin. |
73 | |
74 | =head1 METHODS |
75 | |
76 | =head2 new( ) |
77 | |
78 | Creates a new instance of the store. |
79 | |
80 | =head2 for_session( ) |
81 | |
82 | Returns the user object passed to the method. |
83 | |
84 | =head2 from_session( ) |
85 | |
86 | Returns the user object passed to the method. |
87 | |
88 | =head2 find_user( ) |
89 | |
90 | Since this store isn't tied to any real set of users, this method just returns |
5c5af345 |
91 | the user info bless as a L<Catalyst::Authentication::User::Hash> |
55fa99fd |
92 | object. |
93 | |
94 | =head2 user_supports( ) |
95 | |
5c5af345 |
96 | Delegates to L<Catalyst::Authentication::User::Hash>. |
55fa99fd |
97 | |
98 | =cut |