使用 perl cgi-application 进行 Google 身份验证

发布于 2024-10-06 04:11:54 字数 428 浏览 6 评论 0原文

我已经构建了一个当前在本地主机上运行的 CGI::Application 并使用了 2 种身份验证方法 -
1. 在 http://www.perlmonks.org/?node_id=622071 中通过存储进行描述数据库中的用户密码和
2. 使用 LDAP 凭据。

我一直在寻找一种简单的方法来进行谷歌身份验证,但尚未找到一种简单的方法。有人能指出我正确的方向吗?

我看了
1. Authen-GoogleAccount 和
2. net-Google-FederatedLogin

但没有足够的文档来说明其中任何一个。我从哪里开始?即使您有一些在 cgi::application 之外执行此操作的指示,也请告诉我

I have built a CGI::Application currently running on local host and have used 2 authentication methods -
1. descried in http://www.perlmonks.org/?node_id=622071 by storing user password in database and
2. using LDAP credentials.

I was looking for a simple way to do google authentication but haven't found an easy way yet. Can someone point me in the right direction.

I looked at
1. Authen-GoogleAccount and
2. net-Google-FederatedLogin

but not enough documentation for either of these. Where do i start? Please let me know even if you have some pointer to doing this outside of cgi::application

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

泪痕残 2024-10-13 04:11:54

这是我能找到的最接近的解决方案。我不是安全专家,但我不认为认真对待它的网站会使用这种方法。它使用 WWW::Mechanize 使用 google 电子邮件/密码进行身份验证,然后提取安全内容。

http://gregjessup.com/login-to-google-using-perl/

if $mech->get($url);返回错误,认证失败。

This is the closest solution I could find. I am not a security expert, but I don't think websites serious about it would use this method. It uses WWW::Mechanize to authenticate using google email/password and then pull secure content out.

http://gregjessup.com/login-to-google-using-perl/

if $mech->get($url); returns error, authentication failed.

笛声青案梦长安 2024-10-13 04:11:54

以下是我在 Android 开发者市场 (market.android.com/publish) 中使用的代码:

use WWW::Mechanize;
use HTTP::Cookies;

my $url = 'https://www.google.com/accounts/ServiceLogin';
my $username = '[email protected]';                                                          
my $password = "PASSWORD";
my $mech = WWW::Mechanize->new();
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get($url);
$mech->form_number(1);
$mech->field(Email => $username);
$mech->field(Passwd => $password);
$mech->click();
# Go to the next link, now that we are logged in.                                                                                   
$url = 'https://market.android.com/publish/Home';
$mech->get($url);
print $mech->content();

这是对 Prateek 发布的链接的一个小编辑/清理:http://gregjessup.com/login-to-google-using-perl
我认为它应该能够用于大多数需要登录的 Google 服务。

Here's the code I used for the Android Market for Developers (market.android.com/publish):

use WWW::Mechanize;
use HTTP::Cookies;

my $url = 'https://www.google.com/accounts/ServiceLogin';
my $username = '[email protected]';                                                          
my $password = "PASSWORD";
my $mech = WWW::Mechanize->new();
$mech->cookie_jar(HTTP::Cookies->new());
$mech->get($url);
$mech->form_number(1);
$mech->field(Email => $username);
$mech->field(Passwd => $password);
$mech->click();
# Go to the next link, now that we are logged in.                                                                                   
$url = 'https://market.android.com/publish/Home';
$mech->get($url);
print $mech->content();

It's a small edit/cleanup of the link Prateek posted: http://gregjessup.com/login-to-google-using-perl.
I think it should be able to be used for most of Google's services that require you to be logged in.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文