Showing posts with label Perl. Show all posts
Showing posts with label Perl. Show all posts

Friday, November 29, 2013

OpenID Connect with Perl

Screenshot of Google consent screen
OpenID Connect is a new federated authentication and authorization protocol based on OAuth 2.0. The specification hasn't been finalized yet, but is expected soon.

Perl support is available through the OIDC::Lite module written by Ryo Ito. You can fetch it through CPAN or directly from Ryo's github repository.

The OIDC::Lite::Demo::Client package provides example code for a bunch of providers (as of this writing, there's support for Google, Facebook, Microsoft, Yahoo Japan, and the Japanese social networking site Mixi).

Wednesday, July 22, 2009

Patch: Perl Module HTTP::Proxy 0.23 Hop-By-Hop Test Failure

HTTP::Proxy 0.23 is failing test t/50hopbyhop:

t/50hopbyhop........1/28
# Failed test 'Hop-by-hop Foo'
# at t/50hopbyhop.t line 38.
# got: undef
# expected: 'foofoo'

# Failed test 'Hop-by-hop Bar'
# at t/50hopbyhop.t line 39.
# got: undef
# expected: 'barbar'

# Failed test 'Connection header removed'
# at t/50hopbyhop.t line 45.
# got: 'foofoo'
# expected: undef

# Failed test 'Connection header removed'
# at t/50hopbyhop.t line 46.
# got: 'barbar'
# expected: undef
I've submitted a patch that's been accepted by the author; it should be in the next release.

Update: the patch is included as of version 0.24.

Saturday, July 18, 2009

Perl: Using LWP with a SOCKS Proxy

For this example, we'll use LWP to connect through a SOCKS proxy to the Tor anonymizing network. Under Ubuntu/Debian, installation of Tor is as simple as:
sudo apt-get install tor
Next, install the LWP::Protocol::socks Perl module to add support for the "socks" scheme. Installing from CPAN:
sudo cpan LWP::Protocol::socks
You should now be able to use LWP with Tor:

#!/usr/bin/perl
use strict;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new(
agent => q{Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; YPC 3.2.0; .NET
CLR 1.1.4322)},
);
$ua->proxy([qw/ http https /] => 'socks://localhost:9050'); # Tor proxy
$ua->cookie_jar({});
my $rsp = $ua->get('http://www.yahoo.com/');
print $rsp->content;