首页 > 解决方案 > 在 iFrame 中嵌入 Microsoft 登录?

问题描述

集成:在 iFrame 内的 InContact 中加载 SPA。

我们在 Microsoft Azure 上设置了 ADFS。我们有一个 SPA,它从后端使用 Azure 启动 ADFS 的 SSO 流。如何:负责为 SPA 呈现 index.html 的后端首先重定向到 IDP metadata_url,一旦成功重定向到我们在 url 中使用令牌的登录。

我试过的: - 删除 X-Frame-Options 标头,这样我们的 SPA 就可以加载到 InContact iFrame 中。- 这使我能够将我们的 SPA 加载到 iFrame 中 - 我尝试了将 X-Frame-Options 标头设置为使用 allow-from 的肮脏方法(是的,它已被弃用),但是 PowerShell 存在问题。使用命令:

正如这里提到的

它的回应是:

PS /home/dhruv> Set-AdfsResponseHeaders -SetHeaderName "X-Frame-Options" -SetHeaderValue "allow-from https://*.mpulsemobile.com"
Set-AdfsResponseHeaders: The term 'Set-AdfsResponseHeaders' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

所以我的问题是:是否有另一种简单的方法来设置 IDP url (login.microsoftonline.com//) 的标头 X-Frame-Options 以允许 iFrame 嵌入或更好的方法来解决这个问题?

标签: iframeazure-active-directorysingle-sign-onsingle-page-application

解决方案


ADFS 不推荐使用X-Frame-Options,并且可以按照所述使用“在某些极少数情况下,您可能会信任需要支持 iFrame 的交互式 AD FS 登录页面的特定应用程序。‘X-Frame-Options’标头用于这个目的”。

确保从 AD FS 服务器运行 cmdlet,如果 2016 年已应用KB4493473KB4507459 。最后,ADFS 模块已加载:

(Get-Module ADFS) -ne $null (should output True)

如果不手动加载:

Import-Module ADFS (should not throw an errorr)

如果失败,请确保文件可用并让我们知道:

Test-Path C:\Windows\system32\WindowsPowerShell\v1.0\Modules\adfs\adfs.psd1 (should return True)

推荐阅读