NTLM authentication against a Sharepoint Server

L

Laurence

Hey guys,

I've been trying without success to have a perl script authenticate
against our Sharepoint Portal Server using NTLM.

Here's what I have:

#!/usr/bin/perl

use LWP::UserAgent;
use HTTP::Request;
use MIME::Base64;
use LWP::Debug qw(+);

sub getItemsFromSharepoint {
# use GetListItems webservice on sharepoint

my $url = 'http://portal01/';
my $ua = new LWP::UserAgent(keep_alive=>1);
$ua->credentials('portal01:80','',"domain\\username", 'password');

$request = HTTP::Request->new(GET=>$url);
print "--Performing request now...-----------\n";
$response = $ua->request($request);
print "--Done with request-------------------\n"; if
($response->is_success) {print "It worked!->" . $response->code . "\n"}
else {print "It didn't work!->" . $response->code . " " .
$response->content . "\n"}

}

LWP::UserAgent::new: ()
--Performing request now...-----------
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET http://portal01/
LWP::UserAgent::_need_proxy: Not proxied
LWP::protocol::http::request: ()
LWP::protocol::collect: read 792 bytes
LWP::protocol::collect: read 864 bytes
LWP::protocol::http::request: Keep the http connection to portal01:80
LWP::UserAgent::request: Simple response: Unauthorized
LWP::Authen::Ntlm::authenticate: authenticate() has been called
LWP::Authen::Ntlm::authenticate: In first phase of NTLM authentication
LWP::Authen::Ntlm::authenticate: Returning response object with auth
header:
Authorization NTLM TlRM<REMOVE>
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: GET http://portal01/
LWP::UserAgent::_need_proxy: Not proxied
LWP::protocol::http::request: ()
LWP::protocol::collect: read 607 bytes
LWP::protocol::collect: read 302 bytes
LWP::protocol::collect: read 630 bytes
LWP::protocol::http::request: Keep the http connection to portal01:80
LWP::UserAgent::request: Simple response: Unauthorized
LWP::Authen::Ntlm::authenticate: authenticate() has been called
LWP::Authen::Ntlm::authenticate: In second phase of NTLM authentication
LWP::Authen::Ntlm::authenticate: Returning response object with auth
header:
Authorization NTLM TlRMTVN<REMOVED>

Now, I've removed the encoded NTLM just for security sake... I've
compared it to the encoding generated by Mozilla when accessing the
same page and they are no where near alike... Any ideas why they are so
different? Anything that you guys can see wrong? It loops through this
three times and then fails.

Thanks,
Laurence
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top