Revision 4729
Added by daigle almost 16 years ago
lib/metacat.properties | ||
---|---|---|
122 | 122 |
auth.administrators= |
123 | 123 |
auth.url=ldap://ldap.ecoinformatics.org:389/ |
124 | 124 |
auth.surl=ldap://ldap.ecoinformatics.org:389/ |
125 |
auth.base=dc=ecoinformatics,dc=org |
|
125 | 126 |
auth.allowedSubmitters= |
126 | 127 |
auth.deniedSubmitters= |
127 | 128 |
auth.moderators=cn=knb-prod,o=NCEAS,dc=ecoinformatics,dc=org:cn=esa-moderators,dc=ecoinformatics,dc=org |
... | ... | |
155 | 156 |
|
156 | 157 |
############### Organization Values ############### |
157 | 158 |
|
158 |
#ldap.NCEAS.dn=o=NCEAS,dc=ecoinformatics,dc=org |
|
159 |
organization.configured.NCEAS=false |
|
160 |
organization.name.NCEAS=National Center for Ecological Analysis and Synthesis |
|
161 |
organization.base.NCEAS=dc=ecoinformatics,dc=org |
|
162 |
organization.org.NCEAS=o=NCEAS |
|
163 |
organization.user.NCEAS=cn=Manager |
|
164 |
organization.password.NCEAS= |
|
165 |
#ldap.OBFS.dn=o=OBFS,dc=ecoinformatics,dc=org |
|
166 |
organization.configured.OBFS=false |
|
167 |
organization.name.OBFS=Organization of Biological Field Stations |
|
168 |
organization.base.OBFS=dc=ecoinformatics,dc=org |
|
169 |
organization.org.OBFS=o=OBFS |
|
170 |
organization.user.OBFS=cn=Manager |
|
171 |
organization.password.OBFS= |
|
172 |
#ldap.OSUSB.dn=o=OSUSB,dc=ecoinformatics,dc=org |
|
173 |
organization.configured.OSUSB=false |
|
174 |
organization.name.OSUSB= |
|
175 |
organization.base.OSUSB=dc=ecoinformatics,dc=org |
|
176 |
organization.org.OSUSB=o=OSUSB |
|
177 |
organization.user.OSUSB=cn=Manager |
|
178 |
organization.password.OSUSB= |
|
179 |
#ldap.UCNRS.dn=ou=people,O=ucnrs.org |
|
180 |
organization.configured.UCNRS=false |
|
181 |
organization.name.UCNRS= |
|
182 |
organization.base.UCNRS=ou=people,O=ucnrs.org |
|
183 |
organization.org.UCNRS= |
|
184 |
organization.user.UCNRS=cn=Manager |
|
185 |
organization.password.UCNRS= |
|
186 |
#ldap.KU.dn=o=KU,dc=ecoinformatics,dc=org |
|
187 |
organization.configured.KU=false |
|
188 |
organization.name.KU= |
|
189 |
organization.base.KU=dc=ecoinformatics,dc=org |
|
190 |
organization.org.KU=o=KU |
|
191 |
organization.user.KU=cn=Manager |
|
192 |
organization.password.KU= |
|
193 |
#ldap.LTER.dn=o=LTER,dc=ecoinformatics,dc=org |
|
194 |
organization.configured.LTER=false |
|
195 |
organization.name.LTER= |
|
196 |
organization.base.LTER=dc=ecoinformatics,dc=org |
|
197 |
organization.org.LTER=o=LTER |
|
198 |
organization.user.LTER=cn=Manager |
|
199 |
organization.password.LTER= |
|
200 |
#ldap.UVM.dn=o=UVM,dc=ecoinformatics,dc=org |
|
201 |
organization.configured.UVM=false |
|
202 |
organization.name.UVM= |
|
203 |
organization.base.UVM=dc=ecoinformatics,dc=org |
|
204 |
organization.org.UVM=o=UVM |
|
205 |
organization.user.UVM=cn=Manager |
|
206 |
organization.password.UVM= |
|
207 |
#ldap.SDSC.dn=o=SDSC,dc=ecoinformatics,dc=org |
|
208 |
organization.configured.SDSC=false |
|
209 |
organization.name.SDSC= |
|
210 |
organization.base.SDSC=dc=ecoinformatics,dc=org |
|
211 |
organization.org.SDSC=o=SDSC |
|
212 |
organization.user.SDSC=cn=Manager |
|
213 |
organization.password.SDSC= |
|
214 |
#ldap.MSU.dn=o=MSU,dc=ecoinformatics,dc=org |
|
215 |
organization.configured.MSU=false |
|
216 |
organization.name.MSU= |
|
217 |
organization.base.MSU=dc=ecoinformatics,dc=org |
|
218 |
organization.org.MSU= |
|
219 |
organization.user.MSU=cn=Manager,dc=ecoinformatics,dc=org |
|
220 |
organization.password.MSU= |
|
221 |
#ldap.NAPIER.dn=o=NAPIER,dc=ecoinformatics,dc=org |
|
222 |
organization.configured.NAPIER=false |
|
223 |
organization.name.NAPIER= |
|
224 |
organization.base.NAPIER=dc=ecoinformatics,dc=org |
|
225 |
organization.org.NAPIER=o=NAPIER |
|
226 |
organization.user.NAPIER=cn=Manager |
|
227 |
organization.password.NAPIER= |
|
228 |
#ldap.SANPARKS.dn=o=SANParks,dc=ecoinformatics,dc=org |
|
229 |
organization.configured.SANPARKS=false |
|
230 |
organization.name.SANPARKS=Kruger National Park |
|
231 |
organization.base.SANPARKS=dc=ecoinformatics,dc=org |
|
232 |
organization.org.SANPARKS= |
|
233 |
organization.user.SANPARKS=cn=Manager |
|
234 |
organization.password.SANPARKS= |
|
235 |
#ldap.SAEON.dn=o=SAEON,dc=ecoinformatics,dc=org |
|
236 |
organization.configured.SAEON=false |
|
237 |
organization.name.SAEON=South African Environmental Observation Network Repository |
|
238 |
organization.base.SAEON=dc=ecoinformatics,dc=org |
|
239 |
organization.org.SAEON= |
|
240 |
organization.user.SAEON=cn=Manager |
|
241 |
organization.password.SAEON= |
|
242 | 159 |
#ldap.unaffiliated.dn=o=unaffiliated,dc=ecoinformatics,dc=org |
243 | 160 |
organization.configured.unaffiliated=false |
244 | 161 |
organization.name.unaffiliated= |
lib/auth.properties.metadata.xml | ||
---|---|---|
36 | 36 |
<description>Authentication Secure Server URL.</description> |
37 | 37 |
<helpFile>properties.html#auth.surl</helpFile> |
38 | 38 |
</config> |
39 |
|
|
40 |
<config> |
|
41 |
<key>auth.base</key> |
|
42 |
<label>Authentication Base</label> |
|
43 |
<group>1</group> |
|
44 |
<index>4</index> |
|
45 |
<description>Base part of Distinguished Name that Metacat uses for authentication.</description> |
|
46 |
<helpFile>properties.html#auth.base</helpFile> |
|
47 |
</config> |
|
39 | 48 |
|
40 | 49 |
<config> |
41 | 50 |
<key>auth.administrators</key> |
42 | 51 |
<label>Metacat Administrators</label> |
43 | 52 |
<group>1</group> |
44 |
<index>4</index>
|
|
53 |
<index>5</index>
|
|
45 | 54 |
<description>Authentication users or groups for Metacat administration. |
46 | 55 |
Typically, this holds LDAP credentials. |
47 | 56 |
<font color="red"> Note: this must be set to a username or |
src/edu/ucsb/nceas/metacat/advancedsearch/MetacatHelper.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
package edu.ucsb.nceas.metacat.advancedsearch; |
26 | 26 |
|
27 |
import edu.ucsb.nceas.metacat.AuthLdap; |
|
28 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
|
29 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
|
30 |
|
|
27 | 31 |
import javax.servlet.ServletContext; |
28 | 32 |
import javax.servlet.http.HttpServletRequest; |
29 | 33 |
import javax.servlet.http.HttpSession; |
30 | 34 |
|
35 |
import org.apache.log4j.Logger; |
|
31 | 36 |
|
37 |
|
|
32 | 38 |
/** |
33 | 39 |
* @author dcosta |
34 | 40 |
* |
... | ... | |
36 | 42 |
* classes interact with Metacat. |
37 | 43 |
*/ |
38 | 44 |
public class MetacatHelper { |
39 |
|
|
45 |
|
|
46 |
private static Logger logMetacat = Logger.getLogger(AuthLdap.class); |
|
47 |
|
|
40 | 48 |
/** |
41 |
* Constructs a DN (Distinguished Name) string for the ecoinformatics.org |
|
42 |
* LDAP. |
|
43 |
* |
|
44 |
* @param username The LDAP uid, e.g. "dcosta" |
|
45 |
* @param organization The LDAP organization, e.g. "LTER" |
|
46 |
* @return DN The distinguished name string. |
|
47 |
*/ |
|
48 |
public String constructDN(final String username, final String organization) { |
|
49 |
final String DN = "uid=" + username + |
|
50 |
",o=" + organization + |
|
51 |
",dc=ecoinformatics,dc=org"; |
|
52 |
|
|
53 |
return DN; |
|
54 |
} |
|
49 |
* Constructs a DN (Distinguished Name) string for the ecoinformatics.org |
|
50 |
* LDAP. |
|
51 |
* |
|
52 |
* @param username |
|
53 |
* The LDAP uid, e.g. "dcosta" |
|
54 |
* @param organization |
|
55 |
* The LDAP organization, e.g. "LTER" |
|
56 |
* @return DN The distinguished name string. |
|
57 |
*/ |
|
58 |
public String constructDN(final String username, final String organization) { |
|
59 |
String DC; |
|
60 |
try { |
|
61 |
DC = PropertyService.getProperty("auth.base"); |
|
62 |
} catch (PropertyNotFoundException pnfe) { |
|
63 |
DC = "dc=ecoinformatics,dc=org"; |
|
64 |
logMetacat.error("Could not find property: auth.base. Setting to: " + |
|
65 |
"dc=ecoinformatics,dc=org : " + pnfe.getMessage()); |
|
66 |
} |
|
67 |
final String DN = "uid=" + username + ",o=" + organization |
|
68 |
+ "," + DC; |
|
69 |
|
|
70 |
return DN; |
|
71 |
} |
|
55 | 72 |
|
56 | 73 |
|
57 | 74 |
/** |
58 |
* Constructs a URL to the metacat servlet. |
|
59 |
* |
|
60 |
* @param serverName A server name, e.g. "prairie.lternet.edu" |
|
61 |
* @param serverPort A server port, e.g. 8080. If no port is required in |
|
62 |
* the URL, pass a 0 and the argument will be ignored. |
|
63 |
* @param contextString The context under which metacat is running, e.g. "knb". |
|
64 |
* @return metacatURL The URL to the metacat servlet. |
|
65 |
*/ |
|
75 |
* Constructs a URL to the metacat servlet. |
|
76 |
* |
|
77 |
* @param serverName |
|
78 |
* A server name, e.g. "prairie.lternet.edu" |
|
79 |
* @param serverPort |
|
80 |
* A server port, e.g. 8080. If no port is required in the URL, |
|
81 |
* pass a 0 and the argument will be ignored. |
|
82 |
* @param contextString |
|
83 |
* The context under which metacat is running, e.g. "knb". |
|
84 |
* @return metacatURL The URL to the metacat servlet. |
|
85 |
*/ |
|
66 | 86 |
public String constructMetacatURL(final String serverName, |
67 | 87 |
final int serverPort, |
68 | 88 |
final String contextString) { |
src/edu/ucsb/nceas/metacat/AuthLdap.java | ||
---|---|---|
92 | 92 |
try { |
93 | 93 |
this.ldapUrl = PropertyService.getProperty("auth.url"); |
94 | 94 |
this.ldapsUrl = PropertyService.getProperty("auth.surl"); |
95 |
// use the NCEAS base as a fallback. Normally, the base will be |
|
96 |
// parsed from the user during authentication |
|
97 |
// TODO MCD this may need to remain always at NCEAS value |
|
98 |
this.ldapBase = PropertyService.getProperty("organization.base.NCEAS"); |
|
95 |
this.ldapBase = PropertyService.getProperty("auth.base"); |
|
99 | 96 |
this.referral = PropertyService.getProperty("ldap.referral"); |
100 | 97 |
this.ldapConnectTimeLimit = PropertyService |
101 | 98 |
.getProperty("ldap.connectTimeLimit"); |
docs/user/properties.html | ||
---|---|---|
1056 | 1056 |
<h2 class="property-inline"> Example: </h2> |
1057 | 1057 |
<p class="property-text">ldap://ldap.ecoinformatics.org:389/</p> |
1058 | 1058 |
</div> |
1059 |
|
|
1060 |
<a name="auth.base"></a><h1 class="property-main"> auth.base </h1> |
|
1061 |
<div class="property-description-line"> |
|
1062 |
<h2 class="property-inline"> Default Value: </h2> |
|
1063 |
<p class="property-text">dc=ecoinformatics,dc=org</p> |
|
1064 |
</div> |
|
1065 |
<div class="property-description-line"> |
|
1066 |
<h2 class="property-inline"> Set Method: </h2> |
|
1067 |
<p class="property-text">Configuration Utility</p> |
|
1068 |
</div> |
|
1069 |
<div class="property-description-line"> |
|
1070 |
<h2 class="property-inline"> Description: </h2> |
|
1071 |
<p class="property-text"> The base part of the distinguished name that |
|
1072 |
metacat uses for authentication.</p> |
|
1073 |
</div> |
|
1074 |
<div class="property-description-line"> |
|
1075 |
<h2 class="property-inline"> Example: </h2> |
|
1076 |
<p class="property-text">dc=ecoinformatics,dc=org</p> |
|
1077 |
</div> |
|
1059 | 1078 |
|
1060 | 1079 |
<a name="auth.allowedSubmitters"></a><h1 class="property-main"> auth.allowedSubmitters </h1> |
1061 | 1080 |
<div class="property-description-line"> |
Also available in: Unified diff
Add back the auth.base variable to metacat.properties. Use this variable when creating ldap distinguished name.