Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 74261 invoked from network); 18 Aug 2005 18:26:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Aug 2005 18:26:26 -0000 Received: (qmail 22766 invoked by uid 500); 18 Aug 2005 18:26:11 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 22697 invoked by uid 500); 18 Aug 2005 18:26:10 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 22684 invoked by uid 99); 18 Aug 2005 18:26:09 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2005 11:26:09 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [63.244.250.132] (HELO mustang.mpi.com) (63.244.250.132) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Aug 2005 11:26:28 -0700 Received: from thunderbolt.mpi.com (thunderbolt [63.244.253.70]) by mustang.mpi.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id j7IIQ7TH018632 for ; Thu, 18 Aug 2005 14:26:07 -0400 (EDT) Received: from US-BE3.corp.mpi.com (us-be3.mpi.com [63.244.252.209]) by thunderbolt.mpi.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id j7IIPd4p021392 for ; Thu, 18 Aug 2005 14:26:05 -0400 (EDT) Received: from [63.244.153.42] ([63.244.153.42]) by US-BE3.corp.mpi.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 18 Aug 2005 14:23:41 -0400 Mime-Version: 1.0 (Apple Message framework v733) Content-Transfer-Encoding: 7bit Message-Id: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: tomcat-user@jakarta.apache.org From: ferrante Subject: new InitialDirContext(env); instantiating with invalid user info Date: Thu, 18 Aug 2005 14:23:42 -0400 X-Mailer: Apple Mail (2.733) X-OriginalArrivalTime: 18 Aug 2005 18:23:41.0220 (UTC) FILETIME=[F5A78640:01C5A421] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I've been trying to use the code below to validate a username/ password against an LDAP (ActiveDirectory) server When I use this in a main from the command line with a bad password I get > Exception in thread "main" javax.naming.AuthenticationException: > [LDAP: error code 49 - 80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 52e, v893] but when from a servlet in Tomcat, I proceeds without error. I googled for answers but couldn't quite find anything that quite matches my situation -- I'm runing Java 5 and Apache Tomcat/5.5.7 I thought it might have to do with realms, so following some recommendations I commented out the realm info in the server.xml, but it didn't have any effect. Any info/pointers would be appreciated. Thanks ---rdf Hashtable env = new Hashtable(); try { env.put(Context.PROVIDER_URL, "ldap://ldapHost:389"); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, "" + userId + "@domain"); env.put(Context.SECURITY_CREDENTIALS, password); env.put(Context.REFERRAL, "follow"); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); DirContext ctx = new InitialDirContext(env); -- Richard D. Ferrante Assoc Principal Software Engineer Millennium Pharmaceuticals 40 Landsdowne St. Cambridge, Ma. 02139 ferrante@mpi.com Phone: 617-679-7466 Fax: 617-577-3555 This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org