[Catalyst] $c->user and session questions
Tomas Doran
bobtfish at bobtfish.net
Thu May 31 13:31:31 GMT 2012
On 31 May 2012, at 14:00, Kenneth S Mclane wrote:
> I have an LDAP server authenticating my users. The look up returns a ton of fields in a hash. My questions are as follows:
>
> 1. What happens to this data/information? Is it stored in the $c->user object?
Yes
> 2. If it is, how do I access it?
https://metacpan.org/module/Catalyst::Authentication::Store::LDAP::User
Like that. Specifically the ->ldap_entry method is probably what you're after.
> 3. Is there a simple way to look at what is stored in the user object?
Data::Dumper::Dumper($c->user) ?
> 4. I would like to store the users role in the session object so it can be accessed for authorization purposes. The docs only have an example of storing stuff in a shopping cart, which is a bit more than I need, but there isn't enough there for me to figure out how to store just one thing, and retrieve it, of course. Can someone show me how to do this?
>
You need to override the user class, and implement the for_session and from_session methods to get additionally stuff serialized.
Cheers
t0m
More information about the Catalyst
mailing list