
Mango::Catalyst::Plugin::Authentication - Custom Catalyst Authentication Plugin

use Catalyst qw/
-Debug
ConfigLoader
+Mango::Catalyst::Plugin::Authentication
Static::Simple
/;

Mango::Catalyst::Plugin::Authentication is a subclass of Catalyst::Plugin::Authentication that attempts to present authenticated and anonymous user information in the same way:
# anonymous user
$c->user->username; # anonymous
$c->user->profile->first_name # Anonymous
$c->user->cart->count;
# authenticated user
$c->user->username; # claco
$c->user->profile->first_name # Christopher
$c->user->cart->count;
When authenticating users, the mango realm will be used, which in turn uses Mango::Catalyst::Plugin::Authentication::Store to authenticate users.

The following configuration is considered the default when loading Mango::Catalyst::Plugin::Authentication:
authentication:
default_realm: mango
realms:
mango:
credential:
class: Password
password_field: password
password_type: clear
store:
class: +Mango::Catalyst::Plugin::Authentication::Store
cart_model: Carts
profile_model: Profiles
role_model: Roles
user_model: Users
If the default_realm is not mango or no realm named mango is configured, all calls to "user" simply return what the normal authentication process would return. For now, this means that any piece of code relying on the Mango specific helpers (c->user->cart, etc) will crash and burn. This may be fixed in later release with some elfin magic.
See Mango::Catalyst::Plugin::Authentication::Store for further information about what the available configuration options mean.

Returns a Mango authentication user object for the current web user. If the current user isn't authenticated, an AnonymousUser object will be returned. If the user has just been authenticated, a User object will be returned. If the current user has already been authenticated, a CachedUser will be returned.
## AnonymousUser pre auth
my $user = $c->user;
## User from auth
my $user = $c->authenticate(...);
## CachedUser after auth
my $user = $c->user;
See the User, CachedUser and AnonymousUser for more information about the difference between the different user classes.

Catalyst::Plugin::Authentication, Mango::Catalyst::Plugin::Authentication::Store Mango::Catalyst::Plugin::Authentication::User Mango::Catalyst::Plugin::Authentication::CachedUser Mango::Catalyst::Plugin::Authentication::AnonymousUser

Christopher H. Laco
CPAN ID: CLACO
claco@chrislaco.com
http://today.icantfocus.com/blog/