--
TWiki:Main/KitLueder
- 23 Mar 2010
Does anyone please have a working Perl code example of calling the twiki URL, using https/ssl, with support for the twiki's username/password prompt?
Hi. I am trying to invoke a module 'viewfile" from my perl program. The twiki is configured to use https (SSL), so I have to use the "LWP::UserAgent" rather than the simpler "HTTP::Request". Regardless of how I set the credentials, it has no effect. I don't get past the username/password prompt.
I tried to add this to the end of the request URL, but it had no effect: ;authorization='base64EncodingOfUsernamePassword'
(I am using the latest
ActivePerl, version 1007, which corresponds to Perl version 5.10.1.
I am running on a pc with Windows NT.)
Here is the Perl code I am using (sanitized):
use LWP::UserAgent;
use LWP 5.66;
my $browser = LWP::UserAgent->new;
# this doesn't have any effect:
$browser->credentials(
'hostname.com:443',
'MyRealm',
'KitLueder' => 'password'
);
my $url = "https://hostname.com/twiki/bin/EtcEtcEtc";
my $response = $browser->get($url);
die "Error at $url\n ", $response->status_line, "\n Aborting"
unless $response->is_success;
print "Whee, it worked! I got that ",
$response->content_type, " document!\n";
# I then want to use this to download the resulting file, but it just obtains the username/password prompt screen:
my $datafile = "Filename.doc";
use HTTP::Request::Common;
$response = $browser->request( GET($url), $datafile );
exit;
By the way, the twiki "LocalSite.cfg" file had a strange configuration for
AuthRealm, a value of the following: 'Enter your
LoginName. (Typically First name and last name, no space, no dots, capitalized, e.g. JohnSmith, unless you chose otherwise). Visit
TWikiRegistration if you do not have one.'
To summarize the questions:
1. Request for code example to access twiki using https/ssl, to get past the username/password prompt.
2. Recommendations for how to do the basic authentication credentials, given that we are accessing via ssl.
3. Suggestions of changes
4. How do I query what the host domain and realm are?
5. Does twiki ignore that
AuthRealm setting?
Thanks
Kit Lueder
cell 703-577-2463
clueder@aagNOSPAM.dese.com
--
TWiki:Main.KitLueder
- 23 Mar 2010
This is best handled as a support question at
TWiki:Support/WebHome
.
--
TWiki:Main.PeterThoeny
- 23 Mar 2010