我如何单独处理多域站点的身份验证?

How could I handle authentication separately for multidomain sites?

我需要一些关于多域身份验证的说明。我有一个网站,例如www.example.com, which uses sys_folder id = 25 which has own users and groups. And now I created another domain using site configuration, www.example.com/mycompany, which uses another sys_folder id = 50. Both have felogin with different storage folders. It is correctly working in login failures. But when I logged in my main website, say www.example.com. It automatically logged-in on other domain www.example.com/mycompany,其中显示了我的 fe_users 详细信息。我如何针对域单独处理身份验证? TYPO3 支持吗?

这是一个普遍问题,与 TYPO3 没有真正关系:当您登录 www.example.com 时,cookie 路径将为 /。它不能是其他任何东西,因为它将被限制在该路径上。

因此,当您输入 sub-site,如 www.example.com/mycompany 时,www.example.com 的 cookie 将被发送,因为 /mycompany/ 路径覆盖。有关详细信息,请参阅 Set-Cookie: Wildcard "Path"

这里正确的解决方案只能是使用子域来分隔站点,例如mycompany.example.comwww.example.com。然后每个站点都会将其域存储在 cookie 中,以确保每个站点只使用正确的 cookie。

请注意,在这种情况下,主站点 必须 类似于 www.example.com 而不仅仅是 example.com,否则将出现相同的问题:在 example.com 上创建的登录 cookie 将发送给 mycompany.example.com 和所有其他子域。