{
    "content": [
        {
            "type": "text",
            "text": "# LWP::Authen::Ntlm (perldoc)\n\n## NAME\n\nLWP::Authen::Ntlm - Library for enabling NTLM authentication (Microsoft) in LWP\n\n## SYNOPSIS\n\nuse LWP::UserAgent;\nuse HTTP::Request::Common;\nmy $url = 'http://www.company.com/protectedpage.html';\n# Set up the ntlm client and then the base64 encoded ntlm handshake message\nmy $ua = LWP::UserAgent->new(keepalive=>1);\n$ua->credentials('www.company.com:80', '', \"MyDomain\\\\MyUserCode\", 'MyPassword');\n$request = GET $url;\nprint \"--Performing request now...-----------\\n\";\n$response = $ua->request($request);\nprint \"--Done with request-------------------\\n\";\nif ($response->issuccess) {print \"It worked!->\" . $response->code . \"\\n\"}\nelse {print \"It didn't work!->\" . $response->code . \"\\n\"}\n\n## DESCRIPTION\n\nLWP::Authen::Ntlm allows LWP to authenticate against servers that are using the NTLM\nauthentication scheme popularized by Microsoft. This type of authentication is common on\nintranets of Microsoft-centric organizations.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **USAGE**\n- **AVAILABILITY**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "LWP::Authen::Ntlm",
        "section": "",
        "mode": "perldoc",
        "summary": "LWP::Authen::Ntlm - Library for enabling NTLM authentication (Microsoft) in LWP",
        "synopsis": "use LWP::UserAgent;\nuse HTTP::Request::Common;\nmy $url = 'http://www.company.com/protectedpage.html';\n# Set up the ntlm client and then the base64 encoded ntlm handshake message\nmy $ua = LWP::UserAgent->new(keepalive=>1);\n$ua->credentials('www.company.com:80', '', \"MyDomain\\\\MyUserCode\", 'MyPassword');\n$request = GET $url;\nprint \"--Performing request now...-----------\\n\";\n$response = $ua->request($request);\nprint \"--Done with request-------------------\\n\";\nif ($response->issuccess) {print \"It worked!->\" . $response->code . \"\\n\"}\nelse {print \"It didn't work!->\" . $response->code . \"\\n\"}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 16,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "USAGE",
                "lines": 23,
                "subsections": []
            },
            {
                "name": "AVAILABILITY",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "LWP::Authen::Ntlm - Library for enabling NTLM authentication (Microsoft) in LWP\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use LWP::UserAgent;\nuse HTTP::Request::Common;\nmy $url = 'http://www.company.com/protectedpage.html';\n\n# Set up the ntlm client and then the base64 encoded ntlm handshake message\nmy $ua = LWP::UserAgent->new(keepalive=>1);\n$ua->credentials('www.company.com:80', '', \"MyDomain\\\\MyUserCode\", 'MyPassword');\n\n$request = GET $url;\nprint \"--Performing request now...-----------\\n\";\n$response = $ua->request($request);\nprint \"--Done with request-------------------\\n\";\n\nif ($response->issuccess) {print \"It worked!->\" . $response->code . \"\\n\"}\nelse {print \"It didn't work!->\" . $response->code . \"\\n\"}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "LWP::Authen::Ntlm allows LWP to authenticate against servers that are using the NTLM\nauthentication scheme popularized by Microsoft. This type of authentication is common on\nintranets of Microsoft-centric organizations.\n\nThe module takes advantage of the Authen::NTLM module by Mark Bush. Since there is also another\nAuthen::NTLM module available from CPAN by Yee Man Chan with an entirely different interface, it\nis necessary to ensure that you have the correct NTLM module.\n\nIn addition, there have been problems with incompatibilities between different versions of\nMime::Base64, which Bush's Authen::NTLM makes use of. Therefore, it is necessary to ensure that\nyour Mime::Base64 module supports exporting of the \"encodebase64\" and \"decodebase64\"\nfunctions.\n",
                "subsections": []
            },
            "USAGE": {
                "content": "The module is used indirectly through LWP, rather than including it directly in your code. The\nLWP system will invoke the NTLM authentication when it encounters the authentication scheme\nwhile attempting to retrieve a URL from a server. In order for the NTLM authentication to work,\nyou must have a few things set up in your code prior to attempting to retrieve the URL:\n\n*   Enable persistent HTTP connections\n\nTo do this, pass the \"keepalive=>1\" option to the LWP::UserAgent when creating it, like\nthis:\n\nmy $ua = LWP::UserAgent->new(keepalive=>1);\n\n*   Set the credentials on the UserAgent object\n\nThe credentials must be set like this:\n\n$ua->credentials('www.company.com:80', '', \"MyDomain\\\\MyUserCode\", 'MyPassword');\n\nNote that you cannot use the HTTP::Request object's \"authorizationbasic()\" method to set\nthe credentials. Note, too, that the 'www.company.com:80' portion only sets credentials on\nthe specified port AND it is case-sensitive (this is due to the way LWP is coded, and has\nnothing to do with LWP::Authen::Ntlm)\n",
                "subsections": []
            },
            "AVAILABILITY": {
                "content": "General queries regarding LWP should be made to the LWP Mailing List.\n\nQuestions specific to LWP::Authen::Ntlm can be forwarded to jtillman@bigfoot.com\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (c) 2002 James Tillman. All rights reserved. This program is free software; you can\nredistribute it and/or modify it under the same terms as Perl itself.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "LWP, LWP::UserAgent, lwpcook.\n",
                "subsections": []
            }
        }
    }
}