use of com.sun.jndi.ldap.LdapURL in project jdk8u_jdk by JetBrains.
the class ldapURLContextFactory method getUsingURLIgnoreRootDN.
static ResolveResult getUsingURLIgnoreRootDN(String url, Hashtable<?, ?> env) throws NamingException {
LdapURL ldapUrl = new LdapURL(url);
DirContext ctx = new LdapCtx("", ldapUrl.getHost(), ldapUrl.getPort(), env, ldapUrl.useSsl());
String dn = (ldapUrl.getDN() != null ? ldapUrl.getDN() : "");
// Represent DN as empty or single-component composite name.
CompositeName remaining = new CompositeName();
if (!"".equals(dn)) {
// if nonempty, add component
remaining.add(dn);
}
return new ResolveResult(ctx, remaining);
}
use of com.sun.jndi.ldap.LdapURL in project jdk8u_jdk by JetBrains.
the class ldapURLContext method getURLSuffix.
/**
* Return the suffix of an ldap url.
* prefix parameter is ignored.
*/
protected Name getURLSuffix(String prefix, String url) throws NamingException {
LdapURL ldapUrl = new LdapURL(url);
String dn = (ldapUrl.getDN() != null ? ldapUrl.getDN() : "");
// Represent DN as empty or single-component composite name.
CompositeName remaining = new CompositeName();
if (!"".equals(dn)) {
// if nonempty, add component
remaining.add(dn);
}
return remaining;
}
use of com.sun.jndi.ldap.LdapURL in project jdk8u_jdk by JetBrains.
the class ldapURLContext method searchUsingURL.
// Search using the LDAP URL in name.
// LDAP URL query components override the search argments.
private NamingEnumeration<SearchResult> searchUsingURL(String name) throws NamingException {
LdapURL url = new LdapURL(name);
ResolveResult res = getRootURLContext(name, myEnv);
DirContext ctx = (DirContext) res.getResolvedObj();
try {
return ctx.search(res.getRemainingName(), setFilterUsingURL(url), setSearchControlsUsingURL(url));
} finally {
ctx.close();
}
}
use of com.sun.jndi.ldap.LdapURL in project jdk8u_jdk by JetBrains.
the class LdapUnicodeURL method main.
public static void main(String[] args) throws Exception {
// First 3 characters of the CJK Unified Ideographs
String uid = "uid=一丁丂";
LdapURL ldURL = new LdapURL("ldap://www.example.com/" + uid);
if (!ldURL.getDN().equals(uid)) {
throw new Exception("uid changed to " + ldURL.getDN());
}
}
Aggregations