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 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. package org.apache.archiva.admin.model.beans;
  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. import javax.xml.bind.annotation.XmlRootElement;
  21. import java.io.Serializable;
  22. import java.util.ArrayList;
  23. import java.util.HashMap;
  24. import java.util.List;
  25. import java.util.Map;
  26. /**
  27. * @author Olivier Lamy
  28. * @since 1.4-M4
  29. */
  30. @XmlRootElement(name = "ldapConfiguration")
  31. public class LdapConfiguration
  32. implements Serializable
  33. {
  34. /**
  35. * The LDAP host.
  36. */
  37. private String hostName;
  38. /**
  39. * The LDAP port.
  40. */
  41. private int port;
  42. /**
  43. * ssl LDAP connection.
  44. */
  45. private boolean ssl = false;
  46. /**
  47. * The LDAP base dn.
  48. */
  49. private String baseDn;
  50. /**
  51. * contextFactory to use.
  52. */
  53. private String contextFactory;
  54. /**
  55. * The LDAP bind dn.
  56. */
  57. private String bindDn;
  58. /**
  59. * The LDAP base dn for groups (if empty baseDn is used).
  60. */
  61. private String baseGroupsDn;
  62. /**
  63. * The LDAP password.
  64. */
  65. private String password;
  66. /**
  67. * The LDAP authenticationMethod.
  68. */
  69. private String authenticationMethod;
  70. /**
  71. *
  72. */
  73. private boolean bindAuthenticatorEnabled;
  74. /**
  75. * Will use role name as LDAP group.
  76. */
  77. private boolean useRoleNameAsGroup = false;
  78. /**
  79. * Field extraProperties.
  80. */
  81. private Map<String, String> extraProperties = new HashMap<String, String>();
  82. /**
  83. * field to ease json mapping wrapper on <code>extraProperties</code> field
  84. */
  85. private List<PropertyEntry> extraPropertiesEntries;
  86. /**
  87. * LDAP writable.
  88. */
  89. private boolean writable = false;
  90. public LdapConfiguration()
  91. {
  92. // no op
  93. }
  94. public String getHostName()
  95. {
  96. return hostName;
  97. }
  98. public void setHostName( String hostName )
  99. {
  100. this.hostName = hostName;
  101. }
  102. public int getPort()
  103. {
  104. return port;
  105. }
  106. public void setPort( int port )
  107. {
  108. this.port = port;
  109. }
  110. public boolean isSsl()
  111. {
  112. return ssl;
  113. }
  114. public void setSsl( boolean ssl )
  115. {
  116. this.ssl = ssl;
  117. }
  118. public String getBaseDn()
  119. {
  120. return baseDn;
  121. }
  122. public void setBaseDn( String baseDn )
  123. {
  124. this.baseDn = baseDn;
  125. }
  126. public String getContextFactory()
  127. {
  128. return contextFactory;
  129. }
  130. public void setContextFactory( String contextFactory )
  131. {
  132. this.contextFactory = contextFactory;
  133. }
  134. public String getBindDn()
  135. {
  136. return bindDn;
  137. }
  138. public void setBindDn( String bindDn )
  139. {
  140. this.bindDn = bindDn;
  141. }
  142. public String getPassword()
  143. {
  144. return password;
  145. }
  146. public void setPassword( String password )
  147. {
  148. this.password = password;
  149. }
  150. public String getAuthenticationMethod()
  151. {
  152. return authenticationMethod;
  153. }
  154. public void setAuthenticationMethod( String authenticationMethod )
  155. {
  156. this.authenticationMethod = authenticationMethod;
  157. }
  158. public Map<String, String> getExtraProperties()
  159. {
  160. return extraProperties;
  161. }
  162. public void setExtraProperties( Map<String, String> extraProperties )
  163. {
  164. this.extraProperties = extraProperties;
  165. }
  166. public boolean isBindAuthenticatorEnabled()
  167. {
  168. return bindAuthenticatorEnabled;
  169. }
  170. public void setBindAuthenticatorEnabled( boolean bindAuthenticatorEnabled )
  171. {
  172. this.bindAuthenticatorEnabled = bindAuthenticatorEnabled;
  173. }
  174. public List<PropertyEntry> getExtraPropertiesEntries()
  175. {
  176. extraPropertiesEntries = new ArrayList<>( getExtraProperties().size() );
  177. for ( Map.Entry<String, String> entry : getExtraProperties().entrySet() )
  178. {
  179. extraPropertiesEntries.add( new PropertyEntry( entry.getKey(), entry.getValue() ) );
  180. }
  181. return extraPropertiesEntries;
  182. }
  183. public void setExtraPropertiesEntries( List<PropertyEntry> extraPropertiesEntries )
  184. {
  185. this.extraPropertiesEntries = extraPropertiesEntries;
  186. if ( extraPropertiesEntries != null )
  187. {
  188. for ( PropertyEntry propertyEntry : extraPropertiesEntries )
  189. {
  190. this.extraProperties.put( propertyEntry.getKey(), propertyEntry.getValue() );
  191. }
  192. }
  193. }
  194. public String getBaseGroupsDn()
  195. {
  196. return baseGroupsDn;
  197. }
  198. public void setBaseGroupsDn( String baseGroupsDn )
  199. {
  200. this.baseGroupsDn = baseGroupsDn;
  201. }
  202. public boolean isWritable()
  203. {
  204. return writable;
  205. }
  206. public void setWritable( boolean writable )
  207. {
  208. this.writable = writable;
  209. }
  210. public boolean isUseRoleNameAsGroup()
  211. {
  212. return useRoleNameAsGroup;
  213. }
  214. public void setUseRoleNameAsGroup( boolean useRoleNameAsGroup )
  215. {
  216. this.useRoleNameAsGroup = useRoleNameAsGroup;
  217. }
  218. }