mart1076 has asked for the wisdom of the Perl Monks concerning the following question:
Script: use LWP::Debug qw(+); use LWP::UserAgent; my $url = 'http:// xxxxx.xxx.xxx /'; # Set up the ntlm client and then the base64 encoded ntlm handshake me +ssage my $ua = new LWP::UserAgent(keep_alive=>1); $ua->credentials(xxxxx.xxx.xxx:80', '', 'xxx\xxxxxxxxxxxxx' => 'xxxxxx +xxxxxx'); #$request = GET $url; my $request = new HTTP::Request GET => $url; print "--Performing request now...-----------\n"; $response = $ua->request($request); print "--Done with request-------------------\n"; #my $content = $response->content; my $content = $response->as_string; print $content . "\n"; if ($response->is_success) {print "It worked!->" . $response->code . " + " . $response->message . "\n"} else {print "It didn't work!->" . $response->code . "\n"} Result with only Authen::NTLM installed: LWP::UserAgent::new: () --Performing request now...----------- LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http:// xxxxx.xxx.xxx LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 51 bytes LWP::Protocol::http::request: Keep the http connection to xxxxx.xxx.xx +x:80 LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Ntlm::authenticate: authenticate() has been called Use of uninitialized value in exists at /usr/lib/perl5/site_perl/5.8.3 +/LWP/UserAgent.pm line 566. Use of uninitialized value in hash element at /usr/lib/perl5/site_perl +/5.8.3/LWP/UserAgent.pm line 567. LWP::Authen::Ntlm::authenticate: In first phase of NTLM authentication LWP::Authen::Ntlm::authenticate: Returning response object with auth h +eader: Authorization NTLM TlRMTVNTUAABAAAAB7IAABQAFAAgAAAABgAGADQAAABpY3MtZW5 +nLW1vbi1vcGluaW9ubHN0Z2xkcw== LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http:// xxxxx.xxx.xxx LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 100 bytes LWP::UserAgent::request: Simple response: Internal Server Error --Done with request------------------- HTTP/1.1 500 Internal Server Error Connection: close Date: Thu, 16 Jul 2009 17:13:30 GMT Server: Microsoft-IIS/6.0 Content-Length: 100 Content-Type: text/html Client-Date: Thu, 16 Jul 2009 17:12:31 GMT Client-Peer: 10.96.114.26:80 Client-Response-Num: 2 Title: Error X-Powered-By: ASP.NET <html><head><title>Error</title></head><body>The function requested is + not supported </body></html> It didn't work!->500 Result with LWP::Authen::Negotiate installed: LWP::UserAgent::new: () --Performing request now...----------- LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http://xxxxx.xxx.xxx/ LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 51 bytes LWP::Protocol::http::request: Keep the http connection to xxxxx.xxx.xx +x/:80 LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Negotiate::authenticate: authenticate() version 0.06 call +ed LWP::Authen::Negotiate::authenticate: target hostname xxxxx.xxx.xxx LWP::Authen::Negotiate::authenticate: GSSAPI servicename HTTP@ xxxxx.x +xx.xxx LWP::Authen::Negotiate::authenticate: successfull $ctx->init() LWP::UserAgent::request: () LWP::UserAgent::send_request: GET http:// xxxxx.xxx.xxx / LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 51 bytes LWP::Protocol::http::request: Keep the http connection to xxxxx.xxx.xx +x:80 LWP::UserAgent::request: Simple response: Unauthorized LWP::Authen::Negotiate::authenticate: authenticate() version 0.06 call +ed LWP::Authen::Negotiate::authenticate: target hostname xxxxx.xxx.xxx LWP::Authen::Negotiate::authenticate: GSSAPI servicename HTTP@ xxxxx.x +xx.xxx LWP::Authen::Negotiate::authenticate: Invalid token was supplied LWP::Authen::Negotiate::authenticate: No error --Done with request------------------- HTTP/1.1 401 Unauthorized Date: Tue, 14 Jul 2009 15:35:29 GMT Server: Microsoft-IIS/6.0 WWW-Authenticate: Negotiate YIGWBgkqhkiG9xIBAgIDAH6BhjCBg6ADAgEFoQMCAR +6kERgPMjAwOTA3MTQxNTM1MjlapQUCAwnxTqYDAgE8qRMbEVNURy5MRFNDSFVSQ0guT1J +HqjAwLqADAgEDoScwJRsEaG9zdBsdY2hxcHZ1dzg0MDQuc3RnLmxkc2NodXJjaC5vcmes +EQQPMA2hAwIBAaIGBARqAADA Content-Length: 51 Content-Type: text/plain Client-Date: Tue, 14 Jul 2009 15:34:38 GMT Client-Peer: 10.96.114.26:80 Client-Response-Num: 2 X-Powered-By: ASP.NET HTTP Error 401.1 - Unauthorized: Access is denied
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Authenticating to Microsoft Dynamic CRM
by rdfield (Priest) on Mar 05, 2014 at 17:55 UTC |