JDK-4485724 : Need way in JNDI to escape/parse attribute-value pairs for LDAP
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: javax.naming
  • Affected Version: 1.2.1
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-07-29
  • Updated: 2002-05-22
  • Resolved: 2002-05-22
Related Reports
Duplicate :  
Description

Name: boT120536			Date: 07/29/2001


java version "1.3.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)

I am implementing an LDAP authentication mechanism for a servlet.  It uses
JNDI, naturally.  I want my code to not have to worry about how to escape
attribute-value pairs in LDAP.  It seems to me that the NameParser class
should be able to handle that.  It does not.
(Review ID: 127043) 
======================================================================

Comments
WORK AROUND Name: boT120536 Date: 07/29/2001 One solution is to have these two methods: Name parse(String attrName, String attrValue) and Name parse(String attrName, byte[] attrValue) They would return a name with one component. Then client code would have to add that onto some other base name via Name.addAll(Name suffix). Another solution is to have these two methods: String escape(String attrName, String attrValue) and String escape(String attrName, byte[] attrValue) They would return a properly escaped string component that could then be passed to Name.add(String comp). You might also conceivably have those escape methods be overloaded versions of Name.add, which would make the API cleaner. ======================================================================
02-09-2004