Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

print saml/xml

by philosophia (Sexton)
on May 27, 2009 at 16:03 UTC ( #766460=perlquestion: print w/replies, xml ) Need Help??

philosophia has asked for the wisdom of the Perl Monks concerning the following question:

I have a cgi script that performs a GET operation on a URL

#!/usr/bin/perl use LWP::Simple; my $document = get("http://http://www.perlmonks.org/"); print "Content-type: text/html\n\n"; print $document; exit;


I need to change the URL to http://localhost/Shibboleth.sso/GetAssertion?key=_8283db5f841dcf3914f777be6c3dc71b&ID=_229c80c9f6d300b607f0512a141f9882 - when you perform GET on this URL, the URL should respond with a SAML assertion with a MIME type of "application/samlassertion+xml". So my cgi script now looks like

#!/usr/bin/perl use LWP::Simple; my $document = get("http://localhost/Shibboleth.sso/GetAssertion?key=_ +8283db5f841dcf3914f777be6c3dc71b&ID=_229c80c9f6d300b607f0512a141f9882 +"); print "Content-type: application/samlassertion+xml\n\n"; print $document; exit;


this doesn't seem to be working, when I navigate to my cgi script in a browser I'm presented with a dialog to save the document - when I open the document it's empty, no SAML xml. I'm trying to debug whether the http://localhost/Shibboleth.sso/GetAssertion? URL is not generating SAML correctly, or if my cgi is missing something. Should this work?

Replies are listed 'Best First'.
Re: print saml/xml
by Anonymous Monk on May 28, 2009 at 01:35 UTC
    #!/usr/bin/perl -- use strict; use warnings; use CGI 2.69 qw' header '; use LWP::Simple; my $uri = "http://localhost/Shibboleth.ssoGetAssertion?key=_8283db5f841dcf3914f7 +77be6c3dc71b&ID=_229c80c9f6d300b607f0512a141f9882"; binmode STDOUT; print header(qw! -type application/samlassertion+xml !); my $rc = getprint($uri); if ( not is_success($rc) ) { print qq!<?xml version="1.0" encoding="UTF-8"?><ERROR>$rc</ERROR>! +; } exit;
      if( is_error( $rc ) ) { ....
Re: print saml/xml
by arc_of_descent (Hermit) on May 27, 2009 at 16:29 UTC

    Does the assertion URL work when directly fetched from your browser?


    --
    Rohan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://766460]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2022-05-20 08:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (73 votes). Check out past polls.

    Notices?