host:389 ldapRealm.contextFactory.authenticationMechanism = DIGEST-MD5 and
[main] ldapRealm = org.apache.shiro.realm.ldap.JndiLdapRealm ldapRealm.contextFactory.environment[java.naming.provider.url] = ldap://localhost:389 ldapRealm.contextFactory.environment[java.naming.security.authentication] = DIGEST-MD5
As you can see, the 2nd configuration block is a little more difficult to read and also requires knowledge of the underlying JNDI Context property keys. The first is easier to read and understand.
Note that occasionally it will be necessary to use the latter configuration style to set environment properties where no corresponding wrapper method exists. In this case, the hybrid approach is still a little easier to read. For example:
[main] ldapRealm = org.apache.shiro.realm.ldap.JndiLdapRealm ldapRealm.contextFactory.url = ldap://localhost:389 ldapRealm.contextFactory.authenticationMechanism = DIGEST-MD5 ldapRealm.contextFactory.environment[some.other.obscure.jndi.key] = some value
@since 1.1