This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.admin.model.beans;
002/*
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *   http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing,
014 * software distributed under the License is distributed on an
015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016 * KIND, either express or implied.  See the License for the
017 * specific language governing permissions and limitations
018 * under the License.
019 */
020
021import javax.xml.bind.annotation.XmlRootElement;
022import java.io.Serializable;
023import java.util.ArrayList;
024import java.util.HashMap;
025import java.util.List;
026import java.util.Map;
027
028/**
029 * @author Olivier Lamy
030 * @since 1.4-M4
031 */
032@XmlRootElement(name = "ldapConfiguration")
033public class LdapConfiguration
034    implements Serializable
035{
036
037
038    /**
039     * The LDAP host.
040     */
041    private String hostName;
042
043    /**
044     * The LDAP port.
045     */
046    private int port;
047
048    /**
049     * ssl LDAP connection.
050     */
051    private boolean ssl = false;
052
053    /**
054     * The LDAP base dn.
055     */
056    private String baseDn;
057
058    /**
059     * contextFactory to use.
060     */
061    private String contextFactory;
062
063    /**
064     * The LDAP bind dn.
065     */
066    private String bindDn;
067
068    /**
069     * The LDAP base dn for groups (if empty baseDn is used).
070     */
071    private String baseGroupsDn;
072
073    /**
074     * The LDAP password.
075     */
076    private String password;
077
078    /**
079     * The LDAP authenticationMethod.
080     */
081    private String authenticationMethod;
082
083    /**
084     *
085     */
086    private boolean bindAuthenticatorEnabled;
087
088    /**
089     * Will use role name as LDAP group.
090     */
091    private boolean useRoleNameAsGroup = false;
092
093    /**
094     * Field extraProperties.
095     */
096    private Map<String, String> extraProperties = new HashMap<>();
097
098    /**
099     * 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}