65 |
65 |
private String ldapUrl;
|
66 |
66 |
private String ldapsUrl;
|
67 |
67 |
private String ldapBase;
|
|
68 |
private String referral;
|
68 |
69 |
|
69 |
70 |
/**
|
70 |
71 |
* Construct an AuthLdap
|
... | ... | |
75 |
76 |
this.ldapUrl = MetaCatUtil.getOption("ldapurl");
|
76 |
77 |
this.ldapsUrl = MetaCatUtil.getOption("ldapsurl");
|
77 |
78 |
this.ldapBase = MetaCatUtil.getOption("ldapbase");
|
|
79 |
this.referral = MetaCatUtil.getOption("referral");
|
78 |
80 |
}
|
79 |
81 |
|
80 |
82 |
/**
|
... | ... | |
144 |
146 |
|
145 |
147 |
// Now that we have the dn, we can authenticate, so
|
146 |
148 |
// authenticate this time when opening the DirContext
|
|
149 |
env.put(Context.REFERRAL, referral);
|
147 |
150 |
env.put(Context.PROVIDER_URL, ldapsUrl + ldapBase);
|
148 |
151 |
if ( !ldapsUrl.equals(ldapUrl) ) {
|
149 |
152 |
// ldap is set on default port 389
|
... | ... | |
209 |
212 |
Hashtable env = new Hashtable(11);
|
210 |
213 |
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
211 |
214 |
"com.sun.jndi.ldap.LdapCtxFactory");
|
|
215 |
env.put(Context.REFERRAL, referral);
|
212 |
216 |
env.put(Context.PROVIDER_URL, ldapUrl + ldapBase);
|
213 |
217 |
// non-secure LDAP context; dn are publicly readable
|
214 |
218 |
// env.put(Context.SECURITY_PROTOCOL, "ssl");
|
... | ... | |
315 |
319 |
Hashtable env = new Hashtable(11);
|
316 |
320 |
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
317 |
321 |
"com.sun.jndi.ldap.LdapCtxFactory");
|
|
322 |
env.put(Context.REFERRAL, referral);
|
318 |
323 |
env.put(Context.PROVIDER_URL, ldapUrl + ldapBase);
|
319 |
324 |
|
320 |
325 |
try {
|
... | ... | |
375 |
380 |
Hashtable env = new Hashtable(11);
|
376 |
381 |
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
377 |
382 |
"com.sun.jndi.ldap.LdapCtxFactory");
|
|
383 |
env.put(Context.REFERRAL, referral);
|
378 |
384 |
env.put(Context.PROVIDER_URL, ldapUrl + ldapBase);
|
379 |
385 |
|
380 |
386 |
try {
|
... | ... | |
457 |
463 |
Hashtable env = new Hashtable(11);
|
458 |
464 |
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
459 |
465 |
"com.sun.jndi.ldap.LdapCtxFactory");
|
|
466 |
env.put(Context.REFERRAL, referral);
|
460 |
467 |
env.put(Context.PROVIDER_URL, ldapUrl); // + ldapBase);
|
461 |
468 |
|
462 |
469 |
try {
|
... | ... | |
517 |
524 |
Hashtable env = new Hashtable(11);
|
518 |
525 |
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
519 |
526 |
"com.sun.jndi.ldap.LdapCtxFactory");
|
|
527 |
env.put(Context.REFERRAL, referral);
|
520 |
528 |
env.put(Context.PROVIDER_URL, ldapUrl); // + ldapBase);
|
521 |
529 |
|
522 |
530 |
try {
|
... | ... | |
577 |
585 |
Hashtable env = new Hashtable(11);
|
578 |
586 |
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
579 |
587 |
"com.sun.jndi.ldap.LdapCtxFactory");
|
|
588 |
env.put(Context.REFERRAL, referral);
|
580 |
589 |
env.put(Context.PROVIDER_URL, ldapUrl + ldapBase);
|
581 |
590 |
|
582 |
591 |
try {
|
... | ... | |
637 |
646 |
Hashtable env = new Hashtable(11);
|
638 |
647 |
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
639 |
648 |
"com.sun.jndi.ldap.LdapCtxFactory");
|
|
649 |
env.put(Context.REFERRAL, referral);
|
640 |
650 |
env.put(Context.PROVIDER_URL, ldapUrl + ldapBase);
|
641 |
651 |
|
642 |
652 |
try {
|
... | ... | |
724 |
734 |
Hashtable env = new Hashtable(11);
|
725 |
735 |
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
726 |
736 |
"com.sun.jndi.ldap.LdapCtxFactory");
|
|
737 |
env.put(Context.REFERRAL, referral);
|
727 |
738 |
env.put(Context.PROVIDER_URL, ldapUrl + ldapBase);
|
728 |
739 |
|
729 |
740 |
try {
|
... | ... | |
778 |
789 |
Hashtable env = new Hashtable(11);
|
779 |
790 |
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
780 |
791 |
"com.sun.jndi.ldap.LdapCtxFactory");
|
|
792 |
env.put(Context.REFERRAL, referral);
|
781 |
793 |
env.put(Context.PROVIDER_URL, ldapUrl + ldapBase);
|
782 |
794 |
|
783 |
795 |
try {
|
Fix for bug #309 so that Metacat will now follow LDAP referrals. Previously
the default was to ignore referrals. Now we explictly set the JNDI
Context.REFERRAL value to the value in the metacat.propert "referral".
The metacat.properties file has been modified to add the "referral" property,
which can be set to one of: follow, ignore, throw. If set to follow,
metacat will automatically resolve referrals. If set to ignore, metacat will
ignore referrals, and if set to throw, a "ReferralException will be thrown.
As metacat doesn't catch this exception, I can pretty much guarantee it
wouldn't be good to use the 'throw' value.