Re: Authenticating users from external website using Active Direct
- From: "Richard Glenn" <NewsGroups@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 14 Jul 2005 11:09:20 -0400
Rob, I know some java but not much. That is why I believe this should be
moved to a scripting forum where someone that knows java better than I could
assist.
Richard Glenn
NewsGroups@xxxxxxxxxxxxxxxxxxxx
"Rob B." <RobB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:731D8BF5-7B2A-4A77-B890-A45128255F19@xxxxxxxxxxxxxxxx
> Richard,
>
> Here is the code that the web designer is using which can also be found at
> http://developer.novell.com/ndk/doc/samplecode/jldap_sample/VerifyPassword.java.html :
>
> //Sample code file: VerifyPassword.java
> //Warning: This code has been marked up for HTML
>
>
> /*******************************************************************************
> * $Novell: VerifyPassword.java,v 1.14 2003/08/21 11:37:01 $
> * Copyright (C) 1999, 2000, 2001 Novell, Inc. All Rights Reserved.
> *
> * THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
> * TREATIES. USE AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO THE LICENSE
> * AGREEMENT ACCOMPANYING THE SOFTWARE DEVELOPMENT KIT (SDK) THAT CONTAINS
> * THIS WORK. PURSUANT TO THE SDK LICENSE AGREEMENT, NOVELL HEREBY GRANTS
> TO
> * DEVELOPER A ROYALTY-FREE, NON-EXCLUSIVE LICENSE TO INCLUDE NOVELL'S
> SAMPLE
> * CODE IN ITS PRODUCT. NOVELL GRANTS DEVELOPER WORLDWIDE DISTRIBUTION
> RIGHTS
> * TO MARKET, DISTRIBUTE, OR SELL NOVELL'S SAMPLE CODE AS A COMPONENT OF
> * DEVELOPER'S PRODUCTS. NOVELL SHALL HAVE NO OBLIGATIONS TO DEVELOPER OR
> * DEVELOPER'S CUSTOMERS WITH RESPECT TO THIS CODE.
> *
> * $name: VerifyPassword.java
> * $description: The VerifyPassword.java sample verifies that a password
> is
> * correct for the given entry.
> *
> * We simply compare the password with the "userPassword"
> * attribute of the entry using the LDAP compare function.
> *
>
> ******************************************************************************/
> import com.novell.ldap.*;
> import java.io.UnsupportedEncodingException;
>
> public class VerifyPassword
> {
> public static void main( String[] args )
> {
> if (args.length != 5) {
> System.out.println("Usage: java VerifyPassword <host name>"
> + " <login dn> <password> <object dn>\n"
> + " <test password>");
> System.out.println("Example: java VerifyPassword Acme.com "
> + "\"cn=Admin,o=Acme\" secret\n"
> + " \"cn=JSmith,ou=Sales,o=Acme\"
> testPassword");
> System.exit(0);
> }
>
> int ldapPort = LDAPConnection.DEFAULT_PORT;
> int ldapVersion = LDAPConnection.LDAP_V3;
> String ldapHost = args[0];
> String loginDN = args[1];
> String password = args[2];
> String objectDN = args[3];
> String testPassword = args[4];
> LDAPConnection lc = new LDAPConnection();
>
> try {
> // connect to the server
> lc.connect( ldapHost, ldapPort );
>
> // authenticate to the server
> lc.bind( ldapVersion, loginDN, password.getBytes("UTF8") );
>
> LDAPAttribute attr = new LDAPAttribute(
> "userPassword", testPassword );
> boolean correct = lc.compare( objectDN, attr );
>
> System.out.println( correct ? "The password is correct.":
> "The password is incorrect.\n");
>
> // disconnect with the server
> lc.disconnect();
> }
> catch( LDAPException e ) {
> if ( e.getResultCode() == LDAPException.NO_SUCH_OBJECT ) {
> System.err.println( "Error: No such entry" );
> } else if ( e.getResultCode() ==
> LDAPException.NO_SUCH_ATTRIBUTE ) {
> System.err.println( "Error: No such attribute" );
> } else {
> System.err.println( "Error: " + e.toString() );
> }
> }
> catch( UnsupportedEncodingException e ) {
> System.out.println( "Error: " + e.toString() );
> }
> System.exit(0);
> }
> }
>
>
> Thanks!
>
> Rob B.
>
> "Richard" wrote:
>
>> I will look for this thread in the vbscript forum, please include your
>> code
>> (vbscript, jscript, C, etc...)
>>
>> Richard Glenn
>> NewsGroups@xxxxxxxxxxxxxxxxxxxx
>>
>>
>> "Rob B." <RobB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:CA76DF81-E550-4AE3-9257-56698C154ADE@xxxxxxxxxxxxxxxx
>> > Sorry, We are running Win2K3 AD. I have given it a user account to do
>> > the
>> > query, just a test account with 'Domain User' rights. I even tried with
>> > an
>> > admin account but still nothing worked.
>> >
>> > "Richard" wrote:
>> >
>> >> I do not know if this is the best forum for this type of question,
>> >> however
>> >> in any forum could you give specifics such as the type of domain
>> >> (WinNT,
>> >> Win2K, Win2003), and as an FYI, Win2003 AD by default does not allow
>> >> anonymous LDAP queries, you must specify an account such as a service
>> >> accout
>> >> that has basic rights in the directory before performing your query.
>> >>
>> >>
>> >> Richard Glenn
>> >> NewsGroups@xxxxxxxxxxxxxxxxxxxx
>> >>
>> >>
>> >> "Rob B." <Rob B.@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> >> news:A26EE51F-ACFD-4254-865A-DB7128E89786@xxxxxxxxxxxxxxxx
>> >> >I have an external web site (running TomCat 5) for our school that
>> >> >has a
>> >> > faculty and student access area. We want this area to be password
>> >> > protected
>> >> > using student or faculty AD credentials so our users don't have to
>> >> > know
>> >> > multiple account information. Our web designer is trying to use Open
>> >> > LDAP
>> >> > to
>> >> > make a connection and verify whether a user is valid or not.
>> >> > However,
>> >> > this
>> >> > constantly gives us errors as follows:
>> >> >
>> >> > Error: LDAPException: Operations Error (1) Operations Error
>> >> > LDAPException: Server Message: 00000000: LdapErr: DSID-0C090B95,
>> >> > comment:
>> >> > In
>> >> > order to perform this operation a successful bind must be completed
>> >> > on
>> >> > the
>> >> > connection., data 0, vece
>> >> > LDAPException: Matched DN:
>> >> >
>> >> > And:
>> >> >
>> >> > Error: LDAPException: Invalid Credentials (49) Invalid Credentials
>> >> > LDAPException: Server Message: 80090308: LdapErr: DSID-0C090334,
>> >> > comment:
>> >> > AcceptSecurityContext error, data 525, vece
>> >> > LDAPException: Matched DN:
>> >> >
>> >> > Does any one know of a secure way to achieve our goal? The whole
>> >> > site
>> >> > is
>> >> > database driven as well and has a customized web interface.
>> >> >
>> >>
>> >>
>> >>
>>
>>
>>
.
- Follow-Ups:
- References:
- Authenticating users from external website using Active Directory
- From: Rob B.
- Re: Authenticating users from external website using Active Directory
- From: Richard
- Re: Authenticating users from external website using Active Direct
- From: Rob B.
- Re: Authenticating users from external website using Active Direct
- From: Richard
- Re: Authenticating users from external website using Active Direct
- From: Rob B.
- Authenticating users from external website using Active Directory
- Prev by Date: Re: Joining a computer to a domain
- Next by Date: Printers missing in AD
- Previous by thread: Re: Authenticating users from external website using Active Direct
- Next by thread: Re: Authenticating users from external website using Active Direct
- Index(es):
Relevant Pages
|