我在Google的应用集成支持论坛上提出了这个问题,但是没有得到任何回复。也许这里有人可以帮助我找到正确的方向。
我正在尝试将Perl应用程序与Google应用集成,并且在OpenID身份验证方面遇到了一些问题。由于我找不到Perl示例,因此一直在使用Google的PHP教程作为参考。
我的初始文件index.cgi(由manifest.xml引用,并且是OpenID事务的起点)如下:
我正在尝试将Perl应用程序与Google应用集成,并且在OpenID身份验证方面遇到了一些问题。由于我找不到Perl示例,因此一直在使用Google的PHP教程作为参考。
我的初始文件index.cgi(由manifest.xml引用,并且是OpenID事务的起点)如下:
use Net::OpenID::Consumer;
use CGI;
# ...
my $q = CGI->new();
my $domain = $q->param('domain');
if (!$domain) {
print $q->header(), 'Provide domain please.';
exit 0;
}
# my website
my $root = 'http://www.example.com/';
my $csr = Net::OpenID::Consumer->new(
# The user agent which sends the openid off to the server
ua => LWP::UserAgent->new,
# Who we are
required_root => $root,
# Consumer Key Secret from Google Apps Marketplace
consumer_secret => 'Zzzzzz9zzAAAAA....'
);
my $claimed_id = $csr->claimed_identity(
'https://www.google.com/accounts/o8/site-xrds?hd=' . $domain);
if ($claimed_id) {
my $check_url = $claimed_id->check_url(
# Upon validation, the user will be returned here, and real
# work may begin
return_to => $root . '/return.cgi',
trust_root => $root
);
print $q->redirect($check_url);
}
else {
print $q->header(), "Error";
}
这部分似乎是有效的。也就是说,我被重定向到带有一堆openid.*
参数的return.cgi。然而,在此时我收到以下错误信息:
no_identity_server 提供的URL未声明其OpenID身份验证服务器
我正在使用Net::OpenID::Consumer模块的最新版本。
以下是return.cgi的重要部分:
my $q = CGI->new();
my $csr = Net::OpenID::Consumer->new(
ua => LWP::UserAgent->new,
# The root of our URL
required_root => 'http://www.example.com/',
# Our password.
consumer_secret => 'Zzzzzz9zzAAAAA....',
# Where to get the information from.
args => $q
);
print $q->header();
$csr->handle_server_response(
not_openid => sub {
print "That's not an OpenID message. Did you just type in the URL?";
},
setup_required => sub {
my $setup_url = shift;
print 'You need to do something <a href="#">here</a>.';
},
cancelled => sub {
print 'You cancelled your login.';
},
verified => sub {
my $vident = shift;
my $url = $vident->url;
print "You are verified as '$url'. ** FIN **";
},
error => sub { die "Can't figure it out: ", @_; }
);
你可以想象,我希望verified
子程序能够运行,但是出现了错误。我有没有漏掉什么明显的问题?任何帮助都将不胜感激。