Hi there monks,
I've got a Dancer2 app logging in to azure using the Dancer2::plugin::auth::oauth. Works like a dream. Gives me a session with all sorts of information about the user. In YAML for now, so I can inspect what I have.
Among all that information are the roles the user has. Something you can configure in the app registration on Azure. Works! I can see the information in Vim. Looks something like this in the YAML file:
oauth: azuread: login_info: roles: - Medewerkers - etm
The file is a lot longer offcourse, deleted all that.
As far as I know session->read() loads in the session (from whatever format) into a hash. When I do:
my $session_data = session->read('oauth'); say "Roles:"; print Dumper $$session_data{azuread}{login_info}{roles};
I get on the console:
Roles: $VAR1 = [ 'Medewerkers', 'etm' ];
To me it looks like I'm dumping an array reference. So the session hash contains arrays?
But no matter what I do (and I'm sure I did not do enough) I cannot access the individual values of that array. I kinda expected that something like print $$session_data{azuread}{login_info}{roles}[0] would work. Tried it in all sorts of variations. It confuses me to the bone.
What am I doing wrong? What is the way to read those individual values?
Peter
In reply to Reading session data by PeterKaagman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |