问题描述
我需要使用 cookie 在两个不同的域之间共享 SSO 信息,这可以在 PHP 中实现吗?如何实现?
I need to share SSO information between two different domains with a cookie, can this be done in PHP and how?
推荐答案
在两个域上,放置从另一个域中提取的图像或其他 Web 元素.使用 URL 通知其他域用户 X 在域 A 上,并让域 B 将该用户 ID 与其系统上的该用户相关联.
On both domains, place an image or other web element that is pulled from the other domain. Use the URL to notify the other domain that user X is on domain A, and let domain B associate that user ID with that user on their system.
正确执行有点复杂,但如果你仔细考虑它会很有效.
It's a little complex to carry out correctly, but if you think it through it'll work out very well.
Vinko 在评论中指出(谢谢!)我不应该认为您了解所涉及的安全风险是理所当然的.如果此信息对任何人都有价值,那么您应该确保使用适当的加密、身份验证等,以避免发布敏感信息并避免各种攻击(重播、中间人等).这应该不会太麻烦,因为您可以控制两个网站,并且可以为这两个网站选择一个安全的密钥,因为通信仅通过这个特殊的 URL 在两个服务器之间进行.不过请记住.
Vinko points out in a comment (thanks!) that I shouldn't take it for granted that you understand the security risks involved. If this information is of any value to anyone, then you should make sure you use proper encryption, authentication, etc to avoid releasing sensitive information and to avoid various attacks (replay, man in the middle, etc). This shouldn't be too onerous since you control both websites and you can select a secure secret key for both, since the communication is only going between the two servers via this special URL. Keep it in mind though.
-亚当
这篇关于如何在两个不同的域中使用 cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)