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