LWP:Authen:NTLM

Discussion in 'Perl Misc' started by Ron T., Feb 27, 2007.

  1. Ron T.

    Ron T. Guest

    I've been looking up on how to use this module, following all the
    documentation and cookbooks related to it, and I'm not really sure why
    I can't get through. The credentials() function is vaguely described
    and I can't really find much info on this.

    Is there an alternative to accessing protected files that make use of
    Microsoft's NTLM using Perl? I've been looking around awhile to no
    avail. If you know something I don't, I'd appreciate the tips!

    Ron Thompson
    Ron T., Feb 27, 2007
    #1
    1. Advertising

  2. Ron T.

    gf Guest

    On Feb 27, 8:29 am, "Ron T." <> wrote:
    > I've been looking up on how to use this module, following all the
    > documentation and cookbooks related to it, and I'm not really sure why
    > I can't get through. The credentials() function is vaguely described
    > and I can't really find much info on this.
    >
    > Is there an alternative to accessing protected files that make use of
    > Microsoft's NTLM using Perl? I've been looking around awhile to no
    > avail. If you know something I don't, I'd appreciate the tips!


    I tried to get it to work too, and gave up.

    I ended up using curl to handle the authentication and to move the
    data into Perl. Then I could massage it and send it back using curl.

    http://en.wikipedia.org/wiki/CURL
    gf, Feb 27, 2007
    #2
    1. Advertising

  3. "Ron T." typed:

    > I've been looking up on how to use this module, following all the
    > documentation and cookbooks related to it, and I'm not really sure why
    > I can't get through. The credentials() function is vaguely described
    > and I can't really find much info on this.


    Have you tried it? Getting LWP::Authen::Ntlm to work is tricky. I use the
    following in production code to authenticate with IIS with NTLM
    authentication enabled:

    my $ip = '192.168.1.1';
    my $port = '443';
    # This generally works. If you have domain set up to something else,
    # use that, of course.
    my $domain = "workgroup";
    my $user = 'user';
    my $pass = 'pass';
    my $useragent = new LWP::UserAgent(keep_alive => 1);
    $useragent->credentials("$ip:$port", '', "$domain\\$user", "$pass");

    It will help massively if you enable debugging with:

    use LWP::Debug qw(+);

    --
    Ayaz Ahmed Khan

    A witty saying proves nothing, but saying something pointless gets
    people's attention.
    Ayaz Ahmed Khan, Feb 28, 2007
    #3
  4. Ron T.

    Ron T. Guest

    On Feb 28, 9:27 am, Ayaz Ahmed Khan <> wrote:
    > "Ron T." typed:
    >
    > > I've been looking up on how to use this module, following all the
    > > documentation and cookbooks related to it, and I'm not really sure why
    > > I can't get through. The credentials() function is vaguely described
    > > and I can't really find much info on this.

    >
    > Have you tried it? Getting LWP::Authen::Ntlm to work is tricky. I use the
    > following in production code to authenticate with IIS with NTLM
    > authentication enabled:
    >
    > my $ip = '192.168.1.1';
    > my $port = '443';
    > # This generally works. If you have domain set up to something else,
    > # use that, of course.
    > my $domain = "workgroup";
    > my $user = 'user';
    > my $pass = 'pass';
    > my $useragent = new LWP::UserAgent(keep_alive => 1);
    > $useragent->credentials("$ip:$port", '', "$domain\\$user", "$pass");
    >
    > It will help massively if you enable debugging with:
    >
    > use LWP::Debug qw(+);
    >
    > --
    > Ayaz Ahmed Khan
    >
    > A witty saying proves nothing, but saying something pointless gets
    > people's attention.


    Well I gave it a shot, but it's seemingly hopeless. I'm getting the
    feeling this kind of method will never work with SharePoint.

    If there's a way I'm not sure, it only returns "Unauthorized" for a
    response to my requests.
    Ron T., Feb 28, 2007
    #4
  5. "Ron T." typed:
    > Well I gave it a shot, but it's seemingly hopeless. I'm getting the
    > feeling this kind of method will never work with SharePoint.
    >
    > If there's a way I'm not sure, it only returns "Unauthorized" for a
    > response to my requests.


    I don't know what SharePoint is, but I've got LWP::Authen::NTLM to work
    with IIS. The perl code, however, runs on a Linux box in my case.

    The description section for LWP::Authen::NTLM on CPAN mentions another
    similar module and few incompatible helper modules that need to be watched
    out for. It is possible there might be some mismatch or incompatiblity
    with regard to that.

    --
    Ayaz Ahmed Khan

    A witty saying proves nothing, but saying something pointless gets
    people's attention.
    Ayaz Ahmed Khan, Mar 1, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Reto Zingg
    Replies:
    0
    Views:
    1,203
    Reto Zingg
    Sep 28, 2003
  2. sincethe2003

    how to authen AD user in my login page

    sincethe2003, Jul 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    320
    Scott Allen
    Jul 25, 2004
  3. Matthijs
    Replies:
    0
    Views:
    814
    Matthijs
    Dec 10, 2008
  4. Kevin Collins

    Authen::NTLM and MS04-011

    Kevin Collins, Apr 23, 2004, in forum: Perl Misc
    Replies:
    5
    Views:
    226
    Steve
    May 6, 2004
  5. mumebuhi

    NTLM and LWP::UserAgent

    mumebuhi, Sep 12, 2006, in forum: Perl Misc
    Replies:
    4
    Views:
    374
    mumebuhi
    Sep 13, 2006
Loading...

Share This Page