在本地主机上测试 Google SSO SAML

Test Google SSO SAML on Localhost

Google SSO SAML 设置中的 ACS url,其中 Google 是身份提供商,必须以 https 开头。因此,我无法使用本地主机 url。有没有办法在本地服务器上测试 Google SSO SAML?我需要输入什么 url(或其他详细信息)?

因此,Google SAML 应用程序(Google 是身份提供者)强制您输入以 https://* 开头的 ACS url。因此,我无法输入 http://localhost url. I used the django demo from the python3-saml 包以将 SAML SSO 集成到我的应用程序中。

为了让 https url 指向我的本地主机服务器,我使用了 ngrok, which gives you an https and http link for the url to your localhost. That https url can be entered in the ACS url and Entity url in Google Admin. Django 演示使用 url 参数将用户重定向到登录视图,但这没有用对我来说使用ngrok。因此,我决定在单独的 url /sso/logged-in/ 而不是 /sso/?acs 上呈现登录视图。

您是否尝试过以下测试身份提供者(dockerized): https://github.com/kristophjunge/docker-test-saml-idp

我有同样的问题,我 运行 我的应用程序在本地主机上使用 https 使用本地 iis 和自签名证书,它工作得很好。

这样可以轻松调试来自 google 的 saml 响应,而不是使用远程 url。

您需要任何 public 地址才能传递到那里 - 身份提供商需要重定向到您的网站。您可以:

  • 将应用程序部署到某个服务器
  • 使用隧道(当指向 https://example.localtunnel.me 时,您的请求将命中 localhost:8080 或您指定的任何内容)。

互联网上有很多隧道提供商。作为一款免费且简单的软件,您可以考虑免费且易于使用的 Localtunnel

只需输入:

> npm install -g localtunnel
> lt --port 8080

然后您的本地应用程序将 public 可见。

ngrok 用于通过一个简单的命令将本地主机上的应用程序公开到互联网。

./ngrok http 3000

当在终端中输入上述命令时,window 将在终端中打开,告诉 public url 您可以通过互联网访问以连接到应用程序托管在本地主机上的端口 3000 上。 欲了解更多信息,请查看 https://ngrok.com/

如果对您有帮助,请点个赞!!