I asked about this in the Google support forums for application integration, but received no answer. Maybe someone here can help me steer me in the right direction.
I am trying to integrate a Perl application with Google Apps and am having problems with OpenID authentication. I used this PHP tutorial from Google as a kind of link since there are no Perl examples I can find.
My initial index.cgi file (indicated by manifest.xml and the starting point of the OpenID transaction) is as follows:
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 $root = 'http://www.example.com/';
my $csr = Net::OpenID::Consumer->new(
ua => LWP::UserAgent->new,
required_root => $root,
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(
return_to => $root . '/return.cgi',
trust_root => $root
);
print $q->redirect($check_url);
}
else {
print $q->header(), "Error";
}
, , . , return.cgi openid.*. :
no_identity_server URL OpenID
Net:: OpenID:: Consumer.
return.cgi:
my $q = CGI->new();
my $csr = Net::OpenID::Consumer->new(
ua => LWP::UserAgent->new,
required_root => 'http://www.example.com/',
consumer_secret => 'Zzzzzz9zzAAAAA....',
args => $q
);
print $q->header();
$csr->handle_server_response(
not_openid => sub {
print "That 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: ", @_; }
);
, , sub verified , . - , ? .