473,506 Members | 11,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AD authentication

5 New Member
I am attempting to write a perl script that will automatically connect to a website and post information to a form. I am currently stuck on authenticating against active directory. Does anyone have any script references on how to do this?
Dec 1 '06 #1
4 4010
miller
1,089 Recognized Expert Top Contributor
http://search.cpan.org/~gaas/libwww-perl-5.805/lwpcook.pod
Dec 1 '06 #2
Narsarius
5 New Member
Thank you for the link, that is a great referance for some things I will be doing later on in this project!

Although I am still not quite there. I have been attempting the following code thus far:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2.  
  3. use LWP::UserAgent;
  4. $ua = LWP::UserAgent->new;
  5.  
  6. use HTTP::Request::Common qw(POST);
  7.  
  8. my $req = (POST 'http://USERNAME:PASSWORD@URL');
  9.  
  10. $request = $ua->request($req);
  11. $content = $request->content;
  12.  
  13. print $ua->request($req)->as_string;
  14.  
  15. exit;
  16.  
and also

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2.  
  3. use LWP::UserAgent;
  4. $ua = LWP::UserAgent->new;
  5.  
  6. use HTTP::Request::Common qw(POST);
  7.  
  8. $req = HTTP::Request->new(GET => 'URL');
  9.  
  10. #  $req->authorization_basic('USERNAME', 'PASSWORD');
  11. #  print $ua->request($req)->as_string;
  12. exit;
  13.  

However both return the following error both ways(blanked out some fields for security):

HTTP/1.1 401 (Unauthorized) Authorization Required
Connection: close
Date: DATE HERE
Server: SERVER TYPE
WWW-Authenticate: NTLM
Content-Length: 498
Content-Type: text/html; charset=iso-8859-1
Client-Date: DATE HERE
Client-Peer: IP HERE
Client-Response-Num: 1
Client-Warning: Unsupported authentication scheme 'ntlm'
Title: 401 Authorization Required

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Authorization Required</title>
</head><body>
<h1>Authorization Required</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
<hr>
<address>Address server and port information goes here</address>
</body></html>

The end result of this is to authenticate to active directory, then I must authenticate to a php login, then fill out and submit a php form.
Dec 2 '06 #3
Narsarius
5 New Member
Also tried

Expand|Select|Wrap|Line Numbers
  1. use LWP::UserAgent;
  2. use HTTP::Request::Common;
  3. my $url = 'http://WHATEVER';
  4.  
  5. # Set up the ntlm client and then the base64 encoded ntlm handshake message
  6. my $ua = new LWP::UserAgent(keep_alive=>1);
  7. $ua->credentials('WHATEVER:80', '', "DOMAIN\\USERNAME", 'PASSWORD');
  8.  
  9. $request = GET $url;
  10. print "--Performing request now...-----------\n";
  11. $response = $ua->request($request);
  12. print "--Done with request-------------------\n";
  13.  
  14. if ($response->is_success) {print "It worked!->" . $response->code . "\n"}
  15. else {print "It didn't work->" . $response->code . "\n"}
  16.  
and returned the error 401
Dec 2 '06 #4
Narsarius
5 New Member
Also i do not have to go through a proxy to access this site
Dec 2 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
9262
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
8
3678
by: Bob Everland | last post by:
I have an application that is ISAPI and the only way to secure it is through NT permissions. I need to have a way to login to windows authentication so that when I get to the ISAPI application no...
6
4797
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
9
2494
by: Tom B | last post by:
In my web.config file I've specified Windows for the authentication, in IIS I've set it to Integrated Authentication. But my SQL connection is still showing Anonymous. Is there somewhere else I...
0
4199
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
4
6791
by: Andrew | last post by:
Hey all, I would like to preface my question by stating I am still learning ASP.net and while I am confident in the basics and foundation, the more advanced stuff is still a challenge. Ok....
0
1507
by: Albertas | last post by:
What I'm doing wrong that I can't make my authentication to work. Here is the situation: I'm hosting a Web Service from a Windows forms application, using .NET Framework 3.0 WCF. And I want to...
18
3385
by: troywalker | last post by:
I am new to LDAP and Directory Services, and I have a project that requires me to authenticate users against a Sun Java System Directory Server in order to access the application. I have found...
2
7500
by: Frank Swarbrick | last post by:
I am trying to understand "client authentication" works. My environment is DB2/UDB LUW 8.2 on zSeries SLES9 as the database server and DB2 for VSE 7.4 as the client. We currently have DB2/LUW set...
5
3530
by: Rory Becker | last post by:
Having now created a Custom MembershipProvider that seems to work correctly with my Logon and ChangePassword controls, I am, as they say, a happy bunny. The next stange is to move on to the...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7479
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3178
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.