laravel-azure-ad-oauth icon indicating copy to clipboard operation
laravel-azure-ad-oauth copied to clipboard

Accessing user role

Open mickyvx opened this issue 6 years ago • 4 comments

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.

mickyvx avatar Jul 03 '18 04:07 mickyvx

hi @mickyvx where you able to set this up please?

edifalco avatar Dec 10 '18 11:12 edifalco

How to get access to role property with this cool module for laravel?

zaitompro avatar Apr 13 '19 07:04 zaitompro

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..

dgrafix avatar May 02 '19 10:05 dgrafix

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

yuters avatar Jun 02 '20 15:06 yuters