I have seen the examples of Net::OpenID::Consumer开发者_StackOverflow中文版::Lite on CPAN but I was hoping to get a single script that uses POST method. If nobody has this than I will post my solution back here once I get it working.
This seems to be the only applicable test in the manifest and it doesn't seem too useful
http://cpansearch.perl.org/src/TOKUHIROM/Net-OpenID-Consumer-Lite-0.02/xt/001_mixi.t Apache2::AuthMixi
also uses it a bit
This module simply delegates to LWP::UserAgent
. I don't like it, it should subclass LWP::UserAgent instead of delegating. You can find the docs for LWP::UserAgent
on cpan, and access the base copy through the hidden method _ua
(though, by convention, the preceding underscore tells you it isn't supported and it is supposed to be kept secret)
my $csr = Net::OpenID::Consumer::Lite->new();
$csr->_ua->post(); # same as LWP::UserAgent::post()
It seems as if you're supposed to use only handle_server_response()
which calls _check_authentication()
which calls _get()
which delegates to ->_ua->get()
.
check_authentication() wants an HashRef jump-table with 5 events for not_openid
, setup_required
, cancelled
, verified
, and error
. In addition I believe it wants a bunch of key (openid.
) prefixed stuff, and values.
Per the code, for a request to be sent $request->{'openid.mode'}
must exist in the $request
and be set (preferably to) check_authentication
, and not set to 'cancel'. The openid.user_setup_url
key must logically not be set or it will just call the respective callback. It must also have an op_endpoint.endpoint
key set, which is where the request is destined to go.
This code isn't hard to read, I'd suggesting taking a look The author also seems to have a bunch of modules which is a good sign. I don't like jump-tables with data like that, it seems kind of weird from a UI perspective.
精彩评论