directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maarten Coene (JIRA)" <j...@apache.org>
Subject [jira] Created: (DIRSERVER-1090) LdapConfigurationException when trying to connect with "none" security level
Date Thu, 18 Oct 2007 15:19:50 GMT
LdapConfigurationException when trying to connect with "none" security level
----------------------------------------------------------------------------

                 Key: DIRSERVER-1090
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1090
             Project: Directory ApacheDS
          Issue Type: Bug
          Components: core
    Affects Versions: 1.0.2
            Reporter: Maarten Coene


I'm starting the LDAP server in my Java code. I did allow anonymous access.
When I try to connect with "none" security level, I receive an error.

This is a snippet of my code:

{code:java}
MutableServerStartupConfiguration configuration = new MutableServerStartupConfiguration();
MutablePartitionConfiguration partitionConf = new MutablePartitionConfiguration();
partitionConf.setName("test");
partitionConf.setSuffix("dc=be");

// Create the first entry
Attributes attrs = new BasicAttributes(true);
Attribute attr = new BasicAttribute("objectClass");
attr.add("top");
attr.add("domain");
attr.add("extensibleObject");
attrs.put(attr);
attrs.put("dc", "be");
partitionConf.setContextEntry(attrs);

// As we can create more than one partition, we must store
// each created partition in a Set before initialization
Set pcfgs = new HashSet();
pcfgs.add(partitionConf);
configuration.setContextPartitionConfigurations(pcfgs);

// find the first available port
int port = AvailablePortFinder.getNextAvailable(1024);

File workingDirectory = new File("server-work");
configuration.setWorkingDirectory(workingDirectory);
configuration.setLdapPort(port);
configuration.setShutdownHookEnabled(false);
configuration.setAllowAnonymousAccess(true);

// Create the LDAP context
Hashtable env = new Hashtable(configuration.toJndiEnvironment());
env.put(Context.SECURITY_AUTHENTICATION, "none");
env.put(Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName());
env.put(Context.PROVIDER_URL, "");
InitialLdapContext root = new InitialLdapContext(env, null);
{code}

I receive the following exception:
{code}
org.apache.directory.shared.ldap.exception.LdapConfigurationException: java.naming.security.principal
cannot be null.
	at org.apache.directory.server.core.jndi.LdapJndiProperties.getLdapJndiProperties(LdapJndiProperties.java:204)
	at org.apache.directory.server.core.jndi.ServerContext.<init>(ServerContext.java:122)
	at org.apache.directory.server.core.jndi.ServerDirContext.<init>(ServerDirContext.java:83)
	at org.apache.directory.server.core.jndi.ServerLdapContext.<init>(ServerLdapContext.java:63)
	at org.apache.directory.server.core.DefaultDirectoryService.getJndiContext(DefaultDirectoryService.java:171)
	at org.apache.directory.server.core.jndi.AbstractContextFactory.getInitialContext(AbstractContextFactory.java:138)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
	at javax.naming.InitialContext.init(InitialContext.java:223)
	at javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:134)
                     [...]
{code}

I've worked around the problem by adding the following to my environment hashmap before creating
the InitialContext:

{code:java}
env.put(PropertyKeys.PARSED_BIND_DN, LdapDN.EMPTY_LDAPDN);
{code}

Maarten

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


Mime
View raw message