Apache-Wyrd
view release on metacpan or search on metacpan
Wyrd/Services/Auth.pm view on Meta::CPAN
#require an SSL login server if this is an insecure port (currently always).
#in future, 1 will be replaced with a test for SSL encryption.
if (($ENV{'HTTPS'} ne 'on') or $force_login_server) {
#Get an encryption key and a ticket number
my ($key, $ticket) = $self->generate_ticket;
#Send that pair to the Login Server
$key_url = 'https://' . $req->hostname . $key_url unless ($key_url =~ /^https?:\/\//i);
if ($key_url =~ /^https:\/\//i) {
eval('use IO::Socket::SSL');
die "LWP::UserAgent needs to support SSL to use a login server over https. Install IO::Socket::SSL and make sure it works."
if ($@);
}
my $ua = LWP::UserAgent->new;
$ua->timeout(60);
my $response = $ua->request(POST $key_url,
[
key => $key,
ticket => $ticket
]
);
my $status = $response->status_line;
#If the key can't be saved on the login server, send regrets and close
if ($status !~ /200|OK/) {
if ($status =~ /Invalid argument/i) {
$debug && warn ("You may need to Update IO::Socket::SSL");
} else {
$debug && warn ("Login Server status was $status");
}
my $failed_url = $req->dir_config('LSDownURL');
$failed_url = $scheme . '://' . $req->hostname . $port . $failed_url unless ($failed_url =~ /^http/i);
if ($failed_url) {
$req->custom_response(REDIRECT, $failed_url);
return REDIRECT;
} else {
return HTTP_SERVICE_UNAVAILABLE;
Wyrd/Services/PreAuth.pm view on Meta::CPAN
$port = ':' . $req->server->port unless ($req->server->port == 80);
#Get an encryption key and a ticket number
my ($key, $ticket) = $self->generate_ticket;
#Send that pair to the Login Server
my $key_url = $req->dir_config('LSKeyURL') || $apr->param('url')
|| die "Either provide the url param or define the LSKeyURL directory configuration";
$key_url = 'https://' . $req->hostname . $key_url unless ($key_url =~ /^https?:\/\//i);
if ($key_url =~ /^https:\/\//i) {
eval('use IO::Socket::SSL');
die "LWP::UserAgent needs to support SSL to use a login server over https. Install IO::Socket::SSL and make sure it works."
if ($@);
}
my $ua = LWP::UserAgent->new;
$ua->timeout(60);
my $response = $ua->request(POST $key_url,
[
key => $key,
ticket => $ticket
]
);
( run in 0.579 second using v1.01-cache-2.11-cpan-4d50c553e7e )