简体   繁体   English

DiscourseConnect 访问论坛时自动登录

[英]DiscourseConnect auto login when visiting forum

I've set up my first Discourse instance, wrote a custom endpoint on my ASP.NET 5 web app, and enabled DiscourseConnect.我已经设置了我的第一个 Discourse 实例,在我的 ASP.NET 5 Web 应用程序上编写了一个自定义端点,并启用了 DiscourseConnect。
Everything works fine - when the user clicks the Log In button he gets logged in (if he is logged in into my website)一切正常 - 当用户单击“ Log In按钮时,他会登录(如果他已登录到我的网站)
The forum will be available only to my website users, so I'd like to automatically log them in when they visit the forum (they are redirected to my login/register form via DiscourseConnect)该论坛仅对我的网站用户可用,因此我想在他们访问论坛时自动登录(他们通过 DiscourseConnect 重定向到我的登录/注册表单)

here is the website structure:这是网站结构:

  • main website: example.com主要网站:example.com
  • identity server: identity.example.com (used for SSO)身份服务器:identity.example.com(用于 SSO)
  • forum: forum.example.com论坛:forum.example.com

I couldn't find anything on the Discourse Meta, so I'm asking her:我在 Discourse Meta 上找不到任何东西,所以我问她:
How to do automatic login when the user visits forum.example.com.用户访问forum.example.com时如何进行自动登录。

I'm aware I can create a link on my website that redirects to sso ( https://example.com/session/sso ), but this will work if the user starts from my website (by clicking a link in the menu).我知道我可以在我的网站上创建一个重定向到 sso ( https://example.com/session/sso ) 的链接,但是如果用户从我的网站开始(通过单击菜单中的链接),这将起作用. If he bookmarks the forum and opens it via that bookmark (or directly by typing the address) that automatic login won't happen.如果他为论坛添加书签并通过该书签(或直接输入地址)打开它,则不会发生自动登录。

如果您只允许一种登录方式,只需启用login required站点设置,访问者将自动跳转到您的 ASP 应用程序。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM