Catalyst::Plugin::Authentication - Infrastructure plugin for the Catalyst authentication framework.
use Catalyst qw/ Authentication Authentication::Store::Foo Authentication::Credential::Password /; # later on ... # ->login is provided by the Credential::Password module $c->login('myusername', 'mypassword'); my $age = $c->user->age; $c->logout;
The authentication plugin provides generic user support. It is the basis for both authentication (checking the user is who they claim to be), and authorization (allowing the user to do what the system authorises them to do).
Using authentication is split into two parts. A Store is used to actually store the user information, and can store any amount of data related to the user. Multiple stores can be accessed from within one application. Credentials are used to verify users, using the store, given data from the frontend.
To implement authentication in a catalyst application you need to add this module, plus at least one store and one credential module.
Authentication data can also be stored in a session, if the application is using the Catalyst::Plugin::Session module.
Returns the currently logged in user or undef if there is none.
Whether or not a user is logged in right now.
The reason this method exists is that <$c-user>> may needlessly load the user from the auth store.
<$c-
If you're just going to say
if ( $c->user_user ) { # foo } else { $c->forward("login"); }
it should be more efficient than <$c-user>> when a user is marked in the session but $c->user hasn't been called yet.
$c->user
Delete the currently logged in user from user and the session.
user
Fetch a particular users details, defined by the given ID, via the default store.
Whether or not to store the user's logged in state in the session, if the application is also using the Catalyst::Plugin::Session plugin. This value is set to true per default.
If multiple stores are being used, set the module you want as default here.
If multiple stores are being used, you need to provide a name for each store here, as a hash, the keys are the names you wish to use, and the values are the the names of the plugins.
# example __PACKAGE__->config( authentication => { store => 'Catalyst::Plugin::Authentication::Store::HtPasswd', stores => { 'dbic' => 'Catalyst::Plugin::Authentication::Store::DBIC' } });
Return the store whose name is 'default'.
This is set to $c->config->{authentication}{store} if that value exists, or by using a Store plugin:
$c->config->{authentication}{store}
use Catalyst qw/Authentication Authentication::Store::Minimal/;
Sets the default store to Catalyst::Plugin::Authentication::Store::Minimal::Backend.
Return the store whose name is $name.
Return the name of the store $store.
A hash keyed by name, with the stores registered in the app.
A ref-hash keyed by store, which contains the names of the stores.
Register stores into the application.
Marks a user as authenticated. Should be called from a Catalyst::Plugin::Authentication::Credential plugin after successful authentication.
Catalyst::Plugin::Authentication::Credential
This involves setting user and the internal data in session if Catalyst::Plugin::Session is loaded.
session
Used to restore a user from the session, by user only when it's actually needed.
Used to save the user in a session.
Revives a user from the session object if there is one.
Sets the default configuration parameters.
Catalyst::Plugin::Authentication::Credential::Password, Catalyst::Plugin::Authentication::Store::Minimal, Catalyst::Plugin::Authorization::ACL, Catalyst::Plugin::Authorization::Roles.
Yuval Kogman, nothingmuch@woobling.org
nothingmuch@woobling.org
Jess Robinson
David Kamholz
Copyright (c) 2005 the aforementioned authors. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Expected text after =item, not a bullet
To install Catalyst::Plugin::Authentication, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::Authentication
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::Authentication
For more information on module installation, please visit the detailed CPAN module installation guide.