Authen-CAS-UserAgent
view release on metacpan or search on metacpan
lib/Authen/CAS/UserAgent.pm view on Meta::CPAN
#create the request uri
my $ptUri = URI->new_abs('proxy', $h->{'casServer'});
$ptUri->query_form(
'pgt' => $h->{'pgt'},
'targetService' => $service,
);
# fetch proxy ticket and parse response xml
my $response = $ua->simple_request(HTTP::Request::Common::GET($ptUri));
my $doc = eval {XML::LibXML->new()->parse_string($response->decoded_content('charset' => 'none'))};
if($@ || !$doc) {
$h->{'error'} = ERROR_PROXY_INVALIDRESPONSE;
push @{$h->{'errors'}}, $h->{'error'};
return;
}
# process the response to extract the proxy ticket or any errors
my $xpc = XML::LibXML::XPathContext->new();
$xpc->registerNs('cas', XMLNS_CAS);
if($xpc->exists('/cas:serviceResponse/cas:proxyFailure', $doc)) {
( run in 0.797 second using v1.01-cache-2.11-cpan-4d50c553e7e )