laravel-azure-ad-oauth
laravel-azure-ad-oauth copied to clipboard
Accessing user role
Unsure how to access the appRoles that were specified in the app Manifest. I would like to access this role if specified/assigned to a user to define what they can/cannot access.
hi @mickyvx where you able to set this up please?
How to get access to role property with this cool module for laravel?
I too would love to know the answer to this. I found the callback for when a user is created which i want to mirror the UserRole that i have configured on the AD, however the "new_user" object only contains the basic info, nothing about role information etc..
The value in the field idToken
is a base64 encoded string which contains a json object with the roles. You can add a new table column for it and add it to the user_map of your azure-oath.php
config file.
'user_map' => [
...
'idToken' => 'your_azure_id_token_column',
]
Although the AzureUser
model in this package has this functionality but doesn't seem to be called anywhere, you can replicate the code on your own User model:
https://github.com/metrogistics/laravel-azure-ad-oauth/blob/master/src/AzureUser.php#L24-L41