Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy can't I connect to my CAS server with Perl's AuthCAS?
    primarykey
    data
    text
    <p>I'm attempting to use an existing CAS server to authenticate login for a Perl CGI web script and am using the <a href="http://search.cpan.org/dist/AuthCAS" rel="nofollow noreferrer">AuthCAS</a> Perl module (v 1.3.1). I can connect to the CAS server to get the service ticket but when I try to connect to validate the ticket my script returns with the following error from the <a href="http://search.cpan.org/dist/IO-Socket-SSL" rel="nofollow noreferrer">IO::Socket::SSL</a> module:</p> <pre><code> 500 Can't connect to [CAS Server]:443 (Bad hostname '[CAS Server]') ([CAS Server] substituted for real server name) </code></pre> <p>Symptoms/Tests:</p> <ol> <li>If I type the generated URL for the authentication into the web browser's location bar it returns just fine with the expected XML snippet. So it is not a bad host name.</li> <li>If I generate a script without using the AuthCAS module but using the IO::Socket::SSL module directly to query the CAS server for validation on the generated service ticket the Perl script will run fine from the command line but not in the browser.</li> <li>If I add the AuthCAS module into the script in item 2, the script no longer works on the command line and still doesn't work in the browser.</li> </ol> <p>Here is the bare-bones script that produces the error:</p> <pre><code>#!/usr/bin/perl use strict; use warnings; use CGI; use AuthCAS; use CGI::Carp qw( fatalsToBrowser ); my $id = $ENV{QUERY_STRING}; my $q = new CGI; my $target = "http://localhost/cgi-bin/testCAS.cgi"; my $cas = new AuthCAS(casUrl =&gt; 'https://cas_server/cas'); if ($id eq ""){ my $login_url = $cas-&gt;getServerLoginURL($target); printf "Location: $login_url\n\n"; exit 0; } else { print $q-&gt;header(); print "CAS TEST&lt;br&gt;\n"; ## When coming back from the CAS server a ticket is provided in the QUERY_STRING print "QUERY_STRING = " . $id . "&lt;/br&gt;\n"; ## $ST should contain the received Service Ticket my $ST = $q-&gt;param('ticket'); my $user = $cas-&gt;validateST($target, $ST); #### This is what fails printf "Error: %s\n", &amp;AuthCAS::get_errors() unless (defined $user); } </code></pre> <p>Any ideas on where the conflict might be?</p> <hr> <p>The error is coming from the line directly above the snippet Cebjyre quoted namely</p> <pre><code>$ssl_socket = new IO::Socket::SSL(%ssl_options); </code></pre> <p>namely the socket creation. All of the input parameters are correct. I had edited the module to put in debug statements and print out all the parameters just before that call and they are all fine. Looks like I'm going to have to dive deeper into the IO::Socket::SSL module.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload