运行我自己的 OpenID 身份服务器/服务 (php)
我需要为我的域上的用户提供 openid 服务。他们都有独特的子域,例如:abc.example.com,我希望他们使用 abc.example.com 作为他们的 openid 身份...
我读到了这个 - https://www.myopenid.com/help#own%5Fdomain - 但它看起来像是 (a) 一个用户和 (b) 我需要拥有现有的 myopenid/类似帐户...
phpmyid 看起来很不错,但似乎只适用于单个用户...我如何调整它以使其为具有子域的每个人运行?或者我还能做什么?
i need to provide openid service to users on my domain. They all have unique subdomains such as: abc.example.com and i want them to use abc.example.com as their openid identity...
I read this - https://www.myopenid.com/help#own%5Fdomain - but it looks like its for (a) ONE user and (b) I need to have an existing myopenid/similar account...
phpmyid looks rad, but seems only to work for single users... how i can tweak it to make it run for everyone with a subdomain? Or what else can I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
子域是最简单的部分。为此,您需要“通配符 DNS”,它实际上会创建此 DNS 记录:
*.domain.com IN A 10.10.0.1
分别用您的域名和 IP 替换域名和 IP。接下来,您需要设置要在通配符域中读取的任何网络服务器(这通常在 apache 中工作,如下所示:ServerAlias *.domain.com
但取决于不同的网络服务器。继续到最后一部分.phpMyID - 它仅适用于一个人的身份。不幸的是,这篇文章太小,无法详细介绍如何做到这一点。这些是
您可能需要首先 实现的一些片段和更高层次的想法。文件中的任何硬编码信息并将其移动到数据库(用户名、密码等),以便您可以更轻松地跟踪用户,您还将被迫仅使用
[A-Za-z0 来跟踪用户名。 -9_]
作为&,%,$,#,@,!, ,etc
都会破坏 DNS,用户将无法再访问提供者。了解当前正在访问的主机名是什么:
现在您有了一个用户,您可以构建数据库调用来选择该用户信息 - 然后使用动态用户数据更新“一个用户 phpMyID”的一次硬编码值从数据库中读取,脚本应该继续以愉快的方式进行。自从我查看 phpMyID 以来已经有一段时间了,但我认为这就是它背后的主要想法。
The subdomain is the easy part. For that you'll need "Wildcard DNS" Which essentially creates this DNS record:
*.domain.com IN A 10.10.0.1
replacing the domain and IP with yours respectively. Next you'll need to setup whatever webserver to read in wild card domains (this typically works in apache like so:ServerAlias *.domain.com
but will depend from webserver to webserver.On to the last part. phpMyID - it's only for one person's identity. And unfortunately this post is way too small to go into exactly how to do this. These are some snipits and higher level ideas that would probably need to be implemented.
First you'll need to take whatever hard-coded information in the file and move it to a database (username, password, etc) so you can more easily track users. You'll also be forced to track users names using only
[A-Za-z0-9_]
as&,%,$,#,@,!, ,etc
will all break the DNS and the user can't access the Provider anymore.You will also need to know what the current hostname that is being accessed is:
So now that you have a user you can structure the database call to select that users information - then update the once hard coded values of the "one user phpMyID" with the dynamic user data from the database and the script should continue on it's merry way. It's been awhile since I've looked at phpMyID but I assume that's the majority of the idea behind it.