简体   繁体   English

以编程方式检查用户是否已通过Office 365 / CRM Online进行身份验证

[英]Programmatically Check if User Authenticated to Office 365/CRM Online

I have an ASP.NET page hosted on an external web server that is embedded in an iFrame within the Contact Form in CRM Online. 我有一个托管在外部Web服务器上的ASP.NET页面,该服务器嵌入在CRM Online中的联系表单中的iFrame中。 As of right now, the page shown in the iFrame is accessible to the entire web, but I would like to restrict access to just users that are authenticated to CRM Online / Office 365. Is there a way for me to programmatically check to see if a user is authenticated to CRM Online/Office 365 from my external application? 截至目前,iFrame中显示的页面可供整个网站访问,但我想限制只对通过CRM Online / Office 365进行身份验证的用户的访问权限。有没有办法让我以编程方式检查以查看是否用户是否通过我的外部应用程序对CRM Online / Office 365进行了身份验证? I'm not interested in implementing/authenticating users within my iFrame itself, but rather I'd just like to see if they have a valid login session and if so, display the page, and if not, hide it. 我对在我的iFrame中实现/验证用户不感兴趣,而是我只想看看他们是否有有效的登录会话,如果是,则显示页面,如果没有,则隐藏它。 Any feedback or direction would be much appreciated. 任何反馈或方向将非常感激。

In this case its probably easiest to do the following: 在这种情况下,它可能最容易做到以下几点:

  1. Setup your web page to capture user authentication details - you will need to do this recognise who the user is. 设置您的网页以捕获用户身份验证详细信息 - 您需要这样做才能识别用户是谁。 This will largely depend on what authentication method you are using. 这在很大程度上取决于您使用的身份验证方法。 For example, with Windows Authentication you could get the user domain name, ie MyDomain\\james.wood . 例如,使用Windows身份验证,您可以获取用户域名,即MyDomain\\james.wood

  2. Then query CRM via web services to check if that user (based on domain name for example) has an system user with security roles, or specific privileges. 然后通过Web服务查询CRM以检查该用户(例如,基于域名)是否具有具有安全角色或特定权限的系统用户。

This way you don't have to worry about seeing if they are actually logged into CRM. 这样您就不必担心看到它们是否实际登录到CRM。 You just check if the user has access to data in CRM. 您只需检查用户是否可以访问CRM中的数据。 You could look into adding additional checks so that if the web page is opened outside of a CRM iframe, you don't show the web page content. 您可以考虑添加其他检查,以便在CRM iframe外部打开网页时,您不会显示网页内容。 Additionally you could go even further and impersonate the user in any web service calls to CRM. 此外,您可以进一步模拟用户对CRM的任何Web服务调用。

You may find the following useful. 您可能会发现以下内容很有用。


Edit 编辑

Alternatively you could look to implement single sign on. 或者,您可以查看实施单点登录。

Implement single sign-on from an ASPX webpage or IFRAME . 从ASPX网页或IFRAME实施单点登录

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何以编程方式检查用户是否在Office 365中联合? - How to programmatically check if user is federated in Office 365? 以编程方式为Office 365 / Exchange Online创建约会 - Create appointment for Office 365/Exchange Online programmatically 使用Office 365 / ADFS SingleSignOn时,使用用户名和密码从C#连接到CRM Online - Connecting to CRM Online from C# using username and password when using Office 365/ADFS SingleSignOn 在线授权Office 365 / Sharepoint - Authorization to Office 365/Sharepoint online 如何在使用 AAD 进行身份验证的 ASP.NET MVC 站点中以登录用户身份查询 Dynamics 365 CRM? - How can I query Dynamics 365 CRM as the logged in user in an ASP.NET MVC site authenticated with AAD? 在Office 365上以编程方式编写Excel - Programmatically write Excel on Office 365 在CRM Online中以编程方式创建销售线索 - Creating a lead programmatically in CRM Online 无法在 Dynamics CRM 365 online 中创建系统用户 - Unable to Create a systemuser in Dynamics CRM 365 online MS Dynamics 365 CRM 在线 - 转储实体 - MS Dynamics 365 CRM online - dump entity CRM 365(Web API):如何检查用户是否具有对某个 CRM 记录的读取权限? - CRM 365 (Web API): How to check if a user has read access to a certain CRM-record?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM