After a lot of cursing, tinkering, fixing, breaking, fixing, breaking and fixing, I’ve finally got most of the Auth/User bits converted to the new Catalyst Authentication API. when it’s working, it means that people can reference common user elements for both authenticated and anonymous users in the same way:
## current users cart pre/post authenticate()
$c->user->cart;
## 'anonymous' before authenticate()
$c->user->username;
## 'Anonymous' before authenticate()
$c->user->profile->first_name;
## 'claco' after authenticate()
$c->authenticate(...);
$c->user->username;
## 'Christopher' after authenticate()
$c->user->profile->first_name;
In addition to a common way to reference user information, the Mango store also takes care of caching that user information, including roles, in session after authentication so we’re no hitting the database every time we check roles, display profile information, etc.
The one thing I seem to be constantly fighting is that either Catalyst, or Authentication bits just eat errors in certain situations. Things like misnamed classes, classes not loading due to syntax errors, errors down in DBI just go into the ether. I’d say it’s some SIG{DIE}/Error/Exception stuff somewhere just being too greedy. I don’t think I’m alone either.