diff options
author | Jozef Kutej <jozef@kutej.net> | 2008-12-01 23:38:13 +0100 |
---|---|---|
committer | Jozef Kutej <jozef@kutej.net> | 2008-12-01 23:38:13 +0100 |
commit | df3923706db0a920e652f8f16b00372a225e7f35 (patch) | |
tree | fb3d64b634e86a5c5bde1b28695f26b5ea0a97a0 /lib/PAUSE/OpenID/Controller/Root.pm | |
parent | added hostname config and local_config (diff) | |
download | Simple-OpenID-df3923706db0a920e652f8f16b00372a225e7f35.tar.gz Simple-OpenID-df3923706db0a920e652f8f16b00372a225e7f35.tar.bz2 Simple-OpenID-df3923706db0a920e652f8f16b00372a225e7f35.zip |
server certificate validation
Diffstat (limited to 'lib/PAUSE/OpenID/Controller/Root.pm')
-rw-r--r-- | lib/PAUSE/OpenID/Controller/Root.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/PAUSE/OpenID/Controller/Root.pm b/lib/PAUSE/OpenID/Controller/Root.pm index 566a0a1..275bff8 100644 --- a/lib/PAUSE/OpenID/Controller/Root.pm +++ b/lib/PAUSE/OpenID/Controller/Root.pm @@ -71,8 +71,14 @@ sub login :Local { $c->log->debug('username "'.$username.'" login attempt'); my $ua = LWP::UserAgent->new; + my $req = HTTP::Request->new(GET => 'https://pause.perl.org/pause/authenquery'); + $req->header('If-SSL-Cert-Subject' => '/CN=pause.perl.org'); + local $ENV{HTTPS_CA_DIR} = $c->config->{'ssl'}->{'ca_dir'}; $ua->credentials('pause.perl.org:443', 'PAUSE', $username, $password); - my $res = $ua->get('https://pause.perl.org/pause/authenquery'); + my $res = $ua->request($req); + + die 'pause server certificate validation failed' + if exists $res->headers->{'client-ssl-warning'}; if ($res->code == 200) { $c->log->info('login pass'); @@ -80,6 +86,9 @@ sub login :Local { } else { $c->log->warn('login failed'); + use Data::Dumper; + die Dumper($res); + $c->res->redirect($c->uri_for('/login_failed')); } } |