Catalyst-Authentication-Store-CouchDB

 view release on metacpan or  search on metacpan

lib/Catalyst/Authentication/Store/CouchDB.pm  view on Meta::CPAN

L<Catalyst::Authentication::Store::CouchDB::User> to create the user object.

A suitable view map function is

        function(doc) {
            if (doc.username) {
                emit(doc.username, null);
            }
        }

=head1 METHODS

There are no publicly exported routines in the CouchDB authentication
store (or indeed in most authentication stores). However, below is a
description of the routines required by L<Catalyst::Plugin::Authentication>
for all authentication stores.  Please see the documentation for
L<Catalyst::Plugin::Authentication::Internals> for more information.

=head2 new ( $config, $app )

Constructs a new store object.

=head2 find_user ( $authinfo, $c )

Finds a user using the information provided in the $authinfo hashref and
returns the user, or undef on failure. This is usually called from the
Credential. This translates directly to a call to the User object's
load() method.

=head2 for_session ( $c, $user )

Prepares a user to be stored in the session.  This is delegated to
the User obect for_session method.

=head2 from_session ( $c, $frozenuser)

Revives a user from the session based on the info provided in $frozenuser.
This is delegated to the User object from_session method.

=head2 user_supports

Provides information about what the user object supports.

=head1 NOTES

This module is heavily based on L<Catalyst::Authentication::Store::DBIx::Class>.

The test scripts use clear text passwords. B<DO NOT DO THIS IN PRODUCTION.>
Use configuation as shown in the synopsis to use something stronger, such as
salted hash passwords.

The test scripts do not connect to a CouchDB instance as standard - they 
mock the responses that CouchDB would send.  To connect to a CouchDB instance,
set the C<CATALYST_COUCHDB_LIVE> environment variable before running the test suite.
The test suite assumes that a C<demouser> database exists, with a design document
called C<user> that contains a C<user> view, and that a document listing a test
user with username C<test> and password C<test> exists.  To configure this,
run the C<setup_database.pl> script in the C<t/script> directory on the distribution.
B<This script will remove any existing demouser database.>

=head1 BUGS AND LIMITATIONS

There are bound to be bugs - please email the author if you find any.

=head1 SEE ALSO

L<Catalyst::Authentication::Store::DBIx::Class>.
L<Catalyst::Plugin::Authentication>,
L<Catalyst::Plugin::Authentication::Internals>,
and L<Catalyst::Plugin::Authorization::Roles>

=head1 AUTHOR

Colin Bradford <cjbradford@gmail.com>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Colin Bradford.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut


__END__

__END__



( run in 2.428 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )