You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "John Wagenleitner (JIRA)" <ji...@apache.org> on 2010/07/14 00:24:51 UTC

[jira] Commented: (CAMEL-2701) camel-ldap - Look into how to use camel-ldap with a DN (username)

    [ https://issues.apache.org/activemq/browse/CAMEL-2701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60636#action_60636 ] 

John Wagenleitner commented on CAMEL-2701:
------------------------------------------

The following works for me in order to bind using credentials using 2.3.0 and in 2.5-SNAPSHOT

---
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
props.setProperty(Context.PROVIDER_URL, "ldap://localhost:389");
props.setProperty(Context.URL_PKG_PREFIXES, "com.sun.jndi.url");
props.setProperty(Context.REFERRAL, "ignore");
props.setProperty(Context.SECURITY_AUTHENTICATION, "simple");
props.setProperty(Context.SECURITY_PRINCIPAL, "cn=Manager");
props.setProperty(Context.SECURITY_CREDENTIALS, "secret");

SimpleRegistry reg = new SimpleRegistry();
reg.put("myldap", new InitialLdapContext(props, null));

CamelContext context = new DefaultCamelContext(reg);
context.addRoutes(
    new RouteBuilder() {
        public void configure() throws Exception {
            from("direct:start").to("ldap:myldap?base=ou=test");
        }
    }
);
context.start();

ProducerTemplate template = context.createProducerTemplate();

Endpoint endpoint = context.getEndpoint("direct:start");
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody("(uid=test)");
Exchange out = template.send(endpoint, exchange);

Collection<SearchResult> data = out.getOut().getBody(Collection.class);
assert data != null;
assert !data.isEmpty();

System.out.println(out.getOut().getBody());

context.stop();
---

> camel-ldap - Look into how to use camel-ldap with a DN (username)
> -----------------------------------------------------------------
>
>                 Key: CAMEL-2701
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2701
>             Project: Apache Camel
>          Issue Type: Task
>          Components: camel-ldap
>            Reporter: Claus Ibsen
>            Priority: Minor
>
> See
> http://www.manning-sandbox.com/thread.jspa?messageID=99281#99281

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.