You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LdapConfiguration.java 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. package org.apache.archiva.configuration;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. /**
  21. *
  22. * The LDAP configuration.
  23. *
  24. *
  25. * @version $Revision$ $Date$
  26. */
  27. @SuppressWarnings( "all" )
  28. public class LdapConfiguration
  29. implements java.io.Serializable
  30. {
  31. //--------------------------/
  32. //- Class/Member Variables -/
  33. //--------------------------/
  34. /**
  35. * The LDAP host.
  36. */
  37. private String hostName;
  38. /**
  39. * The LDAP port.
  40. */
  41. private int port = 0;
  42. /**
  43. * ssl LDAP connection.
  44. */
  45. private boolean ssl = false;
  46. /**
  47. * The LDAP base dn.
  48. */
  49. private String baseDn;
  50. /**
  51. * The LDAP base dn for groups (if empty baseDn is used).
  52. */
  53. private String baseGroupsDn;
  54. /**
  55. * contextFactory to use.
  56. */
  57. private String contextFactory;
  58. /**
  59. * The LDAP bind dn.
  60. */
  61. private String bindDn;
  62. /**
  63. * The LDAP password.
  64. */
  65. private String password;
  66. /**
  67. * The LDAP authenticationMethod.
  68. */
  69. private String authenticationMethod;
  70. /**
  71. * The LDAP authenticator enabled.
  72. */
  73. private boolean bindAuthenticatorEnabled = false;
  74. /**
  75. * LDAP writable.
  76. */
  77. private boolean writable = false;
  78. /**
  79. * Will use role name as LDAP group.
  80. */
  81. private boolean useRoleNameAsGroup = false;
  82. /**
  83. * Field extraProperties.
  84. */
  85. private java.util.Map extraProperties;
  86. //-----------/
  87. //- Methods -/
  88. //-----------/
  89. /**
  90. * Method addExtraProperty.
  91. *
  92. * @param key
  93. * @param value
  94. */
  95. public void addExtraProperty( Object key, String value )
  96. {
  97. getExtraProperties().put( key, value );
  98. } //-- void addExtraProperty( Object, String )
  99. /**
  100. * Get the LDAP authenticationMethod.
  101. *
  102. * @return String
  103. */
  104. public String getAuthenticationMethod()
  105. {
  106. return this.authenticationMethod;
  107. } //-- String getAuthenticationMethod()
  108. /**
  109. * Get the LDAP base dn.
  110. *
  111. * @return String
  112. */
  113. public String getBaseDn()
  114. {
  115. return this.baseDn;
  116. } //-- String getBaseDn()
  117. /**
  118. * Get the LDAP base dn for groups (if empty baseDn is used).
  119. *
  120. * @return String
  121. */
  122. public String getBaseGroupsDn()
  123. {
  124. return this.baseGroupsDn;
  125. } //-- String getBaseGroupsDn()
  126. /**
  127. * Get the LDAP bind dn.
  128. *
  129. * @return String
  130. */
  131. public String getBindDn()
  132. {
  133. return this.bindDn;
  134. } //-- String getBindDn()
  135. /**
  136. * Get contextFactory to use.
  137. *
  138. * @return String
  139. */
  140. public String getContextFactory()
  141. {
  142. return this.contextFactory;
  143. } //-- String getContextFactory()
  144. /**
  145. * Method getExtraProperties.
  146. *
  147. * @return Map
  148. */
  149. public java.util.Map getExtraProperties()
  150. {
  151. if ( this.extraProperties == null )
  152. {
  153. this.extraProperties = new java.util.HashMap();
  154. }
  155. return this.extraProperties;
  156. } //-- java.util.Map getExtraProperties()
  157. /**
  158. * Get the LDAP host.
  159. *
  160. * @return String
  161. */
  162. public String getHostName()
  163. {
  164. return this.hostName;
  165. } //-- String getHostName()
  166. /**
  167. * Get the LDAP password.
  168. *
  169. * @return String
  170. */
  171. public String getPassword()
  172. {
  173. return this.password;
  174. } //-- String getPassword()
  175. /**
  176. * Get the LDAP port.
  177. *
  178. * @return int
  179. */
  180. public int getPort()
  181. {
  182. return this.port;
  183. } //-- int getPort()
  184. /**
  185. * Get the LDAP authenticator enabled.
  186. *
  187. * @return boolean
  188. */
  189. public boolean isBindAuthenticatorEnabled()
  190. {
  191. return this.bindAuthenticatorEnabled;
  192. } //-- boolean isBindAuthenticatorEnabled()
  193. /**
  194. * Get ssl LDAP connection.
  195. *
  196. * @return boolean
  197. */
  198. public boolean isSsl()
  199. {
  200. return this.ssl;
  201. } //-- boolean isSsl()
  202. /**
  203. * Get will use role name as LDAP group.
  204. *
  205. * @return boolean
  206. */
  207. public boolean isUseRoleNameAsGroup()
  208. {
  209. return this.useRoleNameAsGroup;
  210. } //-- boolean isUseRoleNameAsGroup()
  211. /**
  212. * Get lDAP writable.
  213. *
  214. * @return boolean
  215. */
  216. public boolean isWritable()
  217. {
  218. return this.writable;
  219. } //-- boolean isWritable()
  220. /**
  221. * Set the LDAP authenticationMethod.
  222. *
  223. * @param authenticationMethod
  224. */
  225. public void setAuthenticationMethod( String authenticationMethod )
  226. {
  227. this.authenticationMethod = authenticationMethod;
  228. } //-- void setAuthenticationMethod( String )
  229. /**
  230. * Set the LDAP base dn.
  231. *
  232. * @param baseDn
  233. */
  234. public void setBaseDn( String baseDn )
  235. {
  236. this.baseDn = baseDn;
  237. } //-- void setBaseDn( String )
  238. /**
  239. * Set the LDAP base dn for groups (if empty baseDn is used).
  240. *
  241. * @param baseGroupsDn
  242. */
  243. public void setBaseGroupsDn( String baseGroupsDn )
  244. {
  245. this.baseGroupsDn = baseGroupsDn;
  246. } //-- void setBaseGroupsDn( String )
  247. /**
  248. * Set the LDAP authenticator enabled.
  249. *
  250. * @param bindAuthenticatorEnabled
  251. */
  252. public void setBindAuthenticatorEnabled( boolean bindAuthenticatorEnabled )
  253. {
  254. this.bindAuthenticatorEnabled = bindAuthenticatorEnabled;
  255. } //-- void setBindAuthenticatorEnabled( boolean )
  256. /**
  257. * Set the LDAP bind dn.
  258. *
  259. * @param bindDn
  260. */
  261. public void setBindDn( String bindDn )
  262. {
  263. this.bindDn = bindDn;
  264. } //-- void setBindDn( String )
  265. /**
  266. * Set contextFactory to use.
  267. *
  268. * @param contextFactory
  269. */
  270. public void setContextFactory( String contextFactory )
  271. {
  272. this.contextFactory = contextFactory;
  273. } //-- void setContextFactory( String )
  274. /**
  275. * Set additional properties to use for ldap connection.
  276. *
  277. * @param extraProperties
  278. */
  279. public void setExtraProperties( java.util.Map extraProperties )
  280. {
  281. this.extraProperties = extraProperties;
  282. } //-- void setExtraProperties( java.util.Map )
  283. /**
  284. * Set the LDAP host.
  285. *
  286. * @param hostName
  287. */
  288. public void setHostName( String hostName )
  289. {
  290. this.hostName = hostName;
  291. } //-- void setHostName( String )
  292. /**
  293. * Set the LDAP password.
  294. *
  295. * @param password
  296. */
  297. public void setPassword( String password )
  298. {
  299. this.password = password;
  300. } //-- void setPassword( String )
  301. /**
  302. * Set the LDAP port.
  303. *
  304. * @param port
  305. */
  306. public void setPort( int port )
  307. {
  308. this.port = port;
  309. } //-- void setPort( int )
  310. /**
  311. * Set ssl LDAP connection.
  312. *
  313. * @param ssl
  314. */
  315. public void setSsl( boolean ssl )
  316. {
  317. this.ssl = ssl;
  318. } //-- void setSsl( boolean )
  319. /**
  320. * Set will use role name as LDAP group.
  321. *
  322. * @param useRoleNameAsGroup
  323. */
  324. public void setUseRoleNameAsGroup( boolean useRoleNameAsGroup )
  325. {
  326. this.useRoleNameAsGroup = useRoleNameAsGroup;
  327. } //-- void setUseRoleNameAsGroup( boolean )
  328. /**
  329. * Set lDAP writable.
  330. *
  331. * @param writable
  332. */
  333. public void setWritable( boolean writable )
  334. {
  335. this.writable = writable;
  336. } //-- void setWritable( boolean )
  337. }