跨多个域的单点登录 [英] Single Sign On across multiple domains

查看:55
本文介绍了跨多个域的单点登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们公司设置了多个域,并在每个域上托管了一个网站.此时,每个域都有自己的身份验证,这是通过 cookie 完成的.

Our company has multiple domains set up with one website hosted on each of the domains. At this time, each domain has its own authentication which is done via cookies.

当登录到一个域的人需要访问另一个域的任何内容时,用户需要使用位于另一个域的另一个网站上的不同凭据再次登录.

When someone logged on to one domain needs to access anything from the other, the user needs to log in again using different credentials on the other website, located on the other domain.

我正在考虑转向单点登录 (SSO),以便消除这种麻烦.我很感激有关如何实现这一目标的任何想法,因为我在这方面没有任何经验.

I was thinking of moving towards single sign on (SSO), so that this hassle can be eliminated. I would appreciate any ideas on how this could be achieved, as I do not have any experience in this regard.

谢谢.

这些网站混合了 Internet(外部)和 Intranet(公司内部使用)站点.

The websites are mix of internet (external) and intranet (internal-used within the company) sites.

推荐答案

我在这里实施的 SSO 解决方案的工作原理如下:

The SSO solution that I've implemented here works as follows:

  1. 有一个主域 login.mydomain.com,其中包含管理登录的脚本 master_login.php.
  2. 每个客户端域都有脚本 client_login.php
  3. 所有域都有一个共享的用户会话数据库.
  4. 当客户端域要求用户登录时,它会重定向到主域 (login.mydomain.com/master_login.php).如果用户尚未登录到主服务器,它会请求用户进行身份验证(即显示登录页面).用户通过身份验证后,它会在数据库中创建一个会话.如果用户已经通过身份验证,它会在数据库中查找他们的会话 ID.
  5. 主域通过会话 ID 返回到客户端域 (client.mydomain.com/client_login.php).
  6. 客户端域创建一个 cookie,存储来自主服务器的会话 ID.客户端可以通过使用 session id 查询共享数据库来找到登录的用户.

注意事项:

  • 会话 ID 是使用 RFC 4122 算法生成的唯一全局标识符
  • master_login.php 只会重定向到其白名单中的域
  • 主服务器和客户端可以位于不同的顶级域中.例如.client1.abc.com、client2.xyz.com、login.mydomain.com

这篇关于跨多个域的单点登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆