AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
CRM
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 04.05.2018, 00:23   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
crmtipoftheday: Tip #1112: Impersonate Azure AD users
Источник: https://crmtipoftheday.com/1112/impe...zure-ad-users/
==============

Developers are familiar with the concept of impersonating Dynamics 365 users. It’s easy – all you need to do is to add MSCRMCallerID header to your Web API request, and you’re done (assuming that you have prvActOnBehalfOfAnotherUser privilege).

One of the typical scenarios where you’d want to use the impersonation when you have a web site that connects to your Dynamics 365 instance using either non-interactive user or, better, S2S authentication and then you need to impersonate a currently logged on Azure AD user. The typical flow is: look for a UPN claim, then use that value to find the user in systemuser entity filtered by domainname attribute.

The problem is that UPN claim does not seem to be available when you’re using B2B guest users. In both scenarios a different oid claim is available that returns Azure AD object ID. That value can be used to query systemuser entity using azureactivedirectoryobjectid attribute. Then it’s business as usual, plonk systemuserid value into MSCRMCallerID header and you’re done.

Shortcut

The following approach is undocumented (hopefully not for long!). The usual Tîpp Jäår’s disclaimer applies: not [currently] supported, use at your own risk, contains small children between the flags, not to be consumed with alcohol while driving.

Instead of using Azure AD object ID to lookup the user, pass that id as MSCRMCallerObjectID header.

POST [Organization URI]/api/data/v9.0/accounts HTTP/1.1MSCRMCallerObjectID: 00000000-0000-0000-000000000002Accept: application/jsonContent-Type: application/json; charset=utf-8OData-MaxVersion: 4.0OData-Version: 4.0Saves you the need to lookup systemuser and splitting the logic depending on the user type.

Facebook and twitter cover photo by Greg Ortega on Unsplash.



Источник: https://crmtipoftheday.com/1112/impe...zure-ad-users/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
crmtipoftheday: Tip #1107: Do not extend system users Blog bot Dynamics CRM: Blogs 0 19.04.2018 08:12
crmtipoftheday: Tip #1087: Hierarchical Security and Disabled Users Blog bot Dynamics CRM: Blogs 0 16.03.2018 13:13
crmtipoftheday: Tip #1085: Using Voice of the Customer to survey users Blog bot Dynamics CRM: Blogs 0 12.03.2018 15:11
crmtipoftheday: Tip #1066: Discover Azure AD tenant ID with Occam’s razor Blog bot Dynamics CRM: Blogs 0 02.02.2018 04:34
crmtipoftheday: Tip #1022: Finding your least active Dynamics 365 users Blog bot Dynamics CRM: Blogs 0 14.11.2017 23:12
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 02:01.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.