Skip to content

Commit

Permalink
Fixes #28 support https urls for metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
timlegge committed Jul 25, 2021
1 parent 95a2311 commit 5921d12
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ my %WriteMakefileArgs = (
"HTTP::Request::Common" => 0,
"IO::Compress::RawDeflate" => 0,
"IO::Uncompress::RawInflate" => 0,
"LWP::Protocol::https" => 0,
"LWP::UserAgent" => 0,
"List::Util" => 0,
"MIME::Base64" => 0,
Expand Down Expand Up @@ -96,6 +97,7 @@ my %FallbackPrereqs = (
"IO::Compress::RawDeflate" => 0,
"IO::Uncompress::RawInflate" => 0,
"Import::Into" => 0,
"LWP::Protocol::https" => 0,
"LWP::UserAgent" => 0,
"List::Util" => 0,
"MIME::Base64" => 0,
Expand Down
1 change: 1 addition & 0 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ requires "File::Slurp" => "0";
requires "HTTP::Request::Common" => "0";
requires "IO::Compress::RawDeflate" => "0";
requires "IO::Uncompress::RawInflate" => "0";
requires "LWP::Protocol::https" => "0";
requires "LWP::UserAgent" => "0";
requires "List::Util" => "0";
requires "MIME::Base64" => "0";
Expand Down
11 changes: 10 additions & 1 deletion lib/Net/SAML2/IdP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,17 @@ sub new_from_url {
my $req = GET $args{url};
my $ua = LWP::UserAgent->new;

if ( defined $args{ssl_opts} ) {
require LWP::Protocol::https;
$ua->ssl_opts( %{$args{ssl_opts}} );
}

my $res = $ua->request($req);
die "no metadata" unless $res->is_success;
if (! $res->is_success ) {
my $msg = "no metadata: " . $res->code . ": " . $res->message . "\n";
die $msg;
}

my $xml = $res->content;

return $class->new_from_xml(xml => $xml, cacert => $args{cacert});
Expand Down

0 comments on commit 5921d12

Please sign in to comment.