lightopenID 用于大学 Google 托管的电子邮件


lightopenID for university Google-hosted email

我目前正在尝试为大学的一个小型网站实现openID。我对此很陌生,并跟进了相关文章。我已经下载了lightopenId并将文件夹上传到我的网络服务器。 我的学校有谷歌托管他们的电子邮件服务,所以典型的电子邮件地址是:像这个studentlastname@myuniversity.edu。我们可以通过mail.google.com或谷歌专门为我们的登录mail.google.com/a/oakland.edu/设计的自定义网页登录

与其将用户重定向到常规$openid->identity = 'https://www.google.com/accounts/o8/id';我可以将用户定向到自定义大学 google 托管页面进行身份验证吗?

给我错误:

http://mail.google.com/a/oakland.edu/accounts/o8/id找不到 OpenID 服务器

OpenID.php:

<? 
    <?php
    require 'openid.php';
    try {
        # Change 'localhost' to your domain name.
        $openid = new LightOpenID('http://webprolearner.ueuo.com');
        if(!$openid->mode) {
            if(isset($_GET['login'])) {
                $openid->identity = 'mail.google.com/a/oakland.edu/accounts/o8/id';
                header('Location: ' . $openid->authUrl());
            }
    ?>
    <form action="?login" method="post">
        <button>Login with Google</button>
    </form>
    <?php
        } elseif($openid->mode == 'cancel') {
            echo 'User has canceled authentication!';
        } else {
            echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.';
        }
    } catch(ErrorException $e) {
        echo $e->getMessage();
    }

据我所知,在您的情况下,正确的身份是:

https://www.google.com/accounts/o8/site-xrds?hd=oakland.edu

此网址返回有效的XRDS(因此LightOpenID将找到服务器)。

请注意,如果服务器配置不正确,则在调用 validate() 时可能会收到类似的错误。