Re: LDAP Authentication
From: Jim (jmackin_at_hastings.edu)
Date: 05/29/03
- Next message: Mark: "Cookies can't be deleted"
- Previous message: Mark Schupp: "Re: LDAP Authentication"
- In reply to: Mark Schupp: "Re: LDAP Authentication"
- Next in thread: Mark Schupp: "Re: LDAP Authentication"
- Reply: Mark Schupp: "Re: LDAP Authentication"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 29 May 2003 10:41:41 -0500
Mark,
The Error message I get is:
error '8007052e'
Logon failure: unknown user name or bad password.
/ldaptest2.asp, line 35
Something I have determined. If I put in a line that I hard code the
username and password in like:
Set lobjUser = dso.OpenDSObject("LDAP://server.domain.edu/DC=domain,DC=edu",
"knownuser", "knownpw", 0)
If I put in the login name it does not work. If I put in the display
name(Lastname, Firstname) then I can successfully log in. Why?
What does the number '0' or '1' in the command do?
Thanks for your help.
Jim
"Mark Schupp" <mschupp@ielearning.com> wrote in message
news:%23H31JKfJDHA.1024@TK2MSFTNGP10.phx.gbl...
> try
>
> Set lobjUser = dso.OpenDSObject(ldapserver, userName, password, 1)
>
> You might also want to check for the specific error meaning that an
invalid
> login name or password was supplied. Here is what I use:
>
> If Err.Number = 0 Then
>
> AuthenticateUser = 0 'authenticated.
>
> ElseIf Err.Number = -2147023570 Then
> '8007052e - LDAP_INVALID_CREDENTIALS - The supplied credential is
invalid.
> ' ERROR_LOGON_FAILURE - Logon failure: unknown user name or bad
> password.
>
> AuthenticateUser = 1 'not authenticated
>
> Else
>
> 'error occurred
> strErrorMsg = Err.Number & ":" & Err.Description
> AuthenticateUser=999
>
> End If
>
> --
> Mark Schupp
> --
> Head of Development
> Integrity eLearning
> Online Learning Solutions Provider
> mschupp@ielearning.com
> http://www.ielearning.com
> 714.637.9480 x17
>
>
> "Jim" <jmackin@hastings.edu> wrote in message
> news:O0e%23tDeJDHA.1024@TK2MSFTNGP10.phx.gbl...
> > I am trying to create an asp page that will authenticate against AD
using
> > LDAP and vbscript. I have borrowed some code that supposedly works but
I
> am
> > having trouble getting it to work. Can anyone help? I just want to
have
> > users login using this page and a previous one, with a form that does a
> post
> > with logon information. If the username and password are correct then
> > another page will be called if it is incorrect it will take you back to
> the
> > logon page.
> >
> > Below is what I have so far. When I get to the command
> >
> > Set lobjUser = dso.OpenDSObject(ldapserver, userName, password, 0)
> >
> > I get an error saying the username or password is incorrect. Please
help.
> >
> >
>
____________________________________________________________________________
> > __
> >
> > <%@ Language=VBScript %>
> >
> > <%
> > Dim UserName, Password, ldapserver, ldap_path
> >
> > 'Construct the FQDN
> >
> > ldap_path = "LDAP://server.domain.edu/cn=##,DC=domain,DC=edu"
> >
> > 'get the ldap server name into local variable by replacing the
> > special<BR>charcter
> > 'with the username
> >
> > ldapserver = Replace(ldap_path,"##",Request.Form("username"))
> >
> >
> > Response.Write(Request.Form("username") & "<br>")
> > Response.Write(ldapserver & "<br>")
> >
> > ' Connect to the LDAP Directory
> >
> > Set dso = GetObject("LDAP:")
> >
> > 'parse the username from the ldap path
> >
> > userName = Mid(ldapserver, InStr(8, ldapserver, "/") + 1)
> >
> > Response.Write(userName & "<br>")
> >
> > 'get the password
> >
> > Password = Request.Form("Password")
> >
> > 'Validate the User Name and Password
> >
> > Set lobjUser = dso.OpenDSObject(ldapserver, userName, password, 0)
> >
> > 'Response.Write(lobjUser.class)
> > 'Response.Write(err.description)
> >
> >
> > 'exit with error - Incorrect username & password - return to
login.asp
> > page
> >
> > 'If Err.number<>0 Then
> > ' Response.Write "AUTHENTICATION FAILURE!"
> > ' Set lobjUser = nothing
> > ' Set dso = nothing
> > 'Else
> > ' Response.Write "SUCCESS!!"
> > 'End If
> >
> > 'To get information from the LDAP directory you need to know the
> > "attributes"
> > 'available and then you can reference them. Ex:
> > 'strUserName = lobjUser.Get("cn")>
> > %>
> >
> >
>
>
- Next message: Mark: "Cookies can't be deleted"
- Previous message: Mark Schupp: "Re: LDAP Authentication"
- In reply to: Mark Schupp: "Re: LDAP Authentication"
- Next in thread: Mark Schupp: "Re: LDAP Authentication"
- Reply: Mark Schupp: "Re: LDAP Authentication"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|