链接到私密主题时,是否可通过 SSO 触发自动认证?

我们使用自己的应用程序作为 Discourse 的 SSO 提供商,但在从我们的应用程序将用户链接到 Discourse 论坛中的私密主题时遇到了问题:只有在点击“登录”按钮时才会触发身份验证。

  • 我们使用自己的系统作为 Discourse 的 SSO 提供商。
  • 我们的 Discourse 论坛中混合了公开页面和私密页面,因此未设置 login_required。
  • 如果用户在系统中完成身份验证,并被链接到 Discourse 的根 URL,他们可以看到公开分类,但并未登录。
  • 如果用户在系统中完成身份验证,并被链接到 Discourse 的 /login 路径,他们可以正常登录,并被重定向到 Discourse 根 URL。
  • 如果用户在系统中完成身份验证,并被链接到 Discourse 中私密分类或主题的 URL,系统会显示一个要求登录的页面。如果他们点击“登录”,则会自动完成登录并显示该分类或主题。

最后一种情况是问题所在。我认为以下任一方案都是可行的:

谢谢!

(我之前曾在 此处 发布过该问题,抱歉重复发帖,但我认为创建一个新主题可能会获得更多回应。)

You can create an login link on your SSO provider site with a return_path parameter in the URL. After authentication, Discourse will redirect the user to the value set for the return_path. The link should be in this form:

<a href="https://forum.example.com/session/sso?return_path=https://forum.example.com/your-discourse-endpoint">Link Text</a>
5 个赞

Can’t they also have the SSO do something similar so that when they log in to the SSO they are also logged in to Discourse?

The only ways I know of auto logging in users to Discourse when the login to the SSO provider site seem a little hacky. With the use of SSO login links in the form I gave above and the sync_sso route for updating users without requiring them to login, I can’t see where it would be required.

1 个赞

Thank you - this has worked perfectly.

I’m not sure if we are doing this - what would be the way to check?

EDIT: should have searched first… details here: Sync DiscourseConnect user data with the sync_sso route

3 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.