aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
blob: 5959c072780c955e854d33edce4bc11942a0a4d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License.  You may obtain a copy of the License at
  ~
  ~  http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:task="http://www.springframework.org/schema/task"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd
           http://www.springframework.org/schema/task
                       http://www.springframework.org/schema/task/spring-task-3.0.xsd">

  <context:property-placeholder location="classpath:application.properties"/>

  <bean id="loggerManager" class="org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager"
        init-method="initialize"/>

  <!-- only here to cleanup temp indexes for groups increase number if use for something else -->
  <task:executor id="springExecutor" pool-size="2"/>
  <task:scheduler id="springScheduler" pool-size="2"/>
  <task:annotation-driven executor="springExecutor" scheduler="springScheduler"/>

  <!--
  TODO olamy check user agent used in wagon !!
  <bean name="wagon#http" class="org.apache.maven.wagon.providers.http.LightweightHttpWagon" scope="prototype">
    <property name="httpHeaders">
      <map>
        <entry key="User-Agent" value="${user.agent}"/>
      </map>
    </property>
  </bean>

  <bean name="wagon#https" class="org.apache.maven.wagon.providers.http.LightweightHttpsWagon" scope="prototype">
    <property name="httpHeaders">
      <map>
        <entry key="User-Agent" value="${user.agent}"/>
      </map>
    </property>
  </bean>
  -->




  <alias name="repositoryStatisticsManager#default" alias="repositoryStatisticsManager"/>
  <!-- TODO olamy need to find a more dynamic way if using jcr impl -->
  <alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>

  <bean id="mailSession" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/mail/Session">
    </property>
  </bean>

  <bean name="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
    <property name="session" ref="mailSession"/>
  </bean>

  <!-- START SNIPPET: configuration-files-list -->
  <bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
    <property name="properties">
      <value>
        <![CDATA[
        <configuration>
          <system/>
          <jndi prefix="java:comp/env" config-optional="true"/>
          <xml fileName="${user.home}/.m2/archiva.xml" config-optional="true"
               config-name="org.apache.archiva.user"
               config-at="org.apache.archiva"/>
          <xml fileName="${user.home}/.m2/shared.xml" config-optional="true"
               config-name="org.apache.maven.shared.app.user" config-at="org.apache.maven.shared.app"
               config-forceCreate="true"/>
          <properties fileName="${user.home}/.m2/security.properties" config-optional="true"
                      config-at="org.apache.archiva.redback"/>
          <properties fileName="${user.home}/.m2/archiva.properties" config-optional="true"
                      config-at="org.apache.archiva.redback"/>
          <xml fileName="${appserver.base}/conf/archiva.xml" config-optional="true"
               config-name="org.apache.archiva.base"
               config-at="org.apache.archiva"/>
          <xml fileName="${appserver.base}/conf/shared.xml" config-optional="true"
               config-name="org.apache.maven.shared.app.base" config-at="org.apache.maven.shared.app"/>
          <xml fileName="${appserver.base}/conf/common.xml" config-optional="true"/>
          <properties fileName="${appserver.base}/conf/security.properties" config-optional="true"
                      config-at="org.apache.archiva.redback"/>
          <xml fileName="${appserver.home}/conf/archiva.xml" config-optional="true"
               config-at="org.apache.archiva"/>
          <xml fileName="${appserver.home}/conf/shared.xml" config-optional="true"
               config-at="org.apache.maven.shared.app"/>
          <xml fileName="${appserver.home}/conf/common.xml" config-optional="true"/>
          <properties fileName="${appserver.home}/conf/security.properties" config-optional="true"
                      config-at="org.apache.archiva.redback"/>
          <properties fileName="org/apache/archiva/security.properties" config-at="org.apache.archiva.redback"/>
        </configuration>
        ]]>
      </value>
    </property>    
  </bean>
  <!-- END SNIPPET: configuration-files-list -->

  <bean name="jdoFactory#users" class="org.codehaus.plexus.jdo.DataSourceConfigurableJdoFactory">
    <property name="connectionFactoryName" value="java:comp/env/jdbc/users"/>
    <property name="shutdownConnectionFactoryName" value="java:comp/env/jdbc/usersShutdown"/>
    <property name="persistenceManagerFactoryClass" value="org.jpox.PersistenceManagerFactoryImpl"/>
    <property name="otherProperties">
      <props>
        <prop key="org.jpox.autoCreateSchema">true</prop>
        <prop key="org.jpox.validateTables">false</prop>
        <prop key="org.jpox.validateConstraints">false</prop>
        <prop key="org.jpox.validateColumns">false</prop>
        <prop key="org.jpox.autoStartMechanism">None</prop>
        <prop key="org.jpox.transactionIsolation">READ_COMMITTED</prop>
        <prop key="org.jpox.poid.transactionIsolation">READ_COMMITTED</prop>
        <prop key="org.jpox.rdbms.dateTimezone">JDK_DEFAULT_TIMEZONE</prop>
        <!-- NEEDED FOR MYSQL UTF-8 Databases -->
        <prop key="org.jpox.rdbms.stringDefaultLength">255</prop>

        <!-- NEEDED FOR POSTGRES, But causes problems in other JDBC implementations.
        <prop key="org.jpox.identifier.case">PreserveCase</prop>
        -->

        <!-- cache activation -->
        <prop key="org.jpox.cache.level2">true</prop>
        <prop key="org.jpox.cache.level2.type">ehcacheclassbased</prop>
        <prop key="org.jpox.cache.level2.cacheName">defaultJpox</prop>
        <prop key="org.jpox.cache.level2.configurationFile">/ehcache.xml</prop>
      </props>
    </property>
  </bean>


  <bean name="scheduler" class="org.codehaus.redback.components.scheduler.DefaultScheduler">
    <property name="properties">
      <props>
        <prop key="org.quartz.scheduler.instanceName">scheduler1</prop>
        <prop key="org.quartz.threadPool.class">org.quartz.simpl.SimpleThreadPool</prop>
        <prop key="org.quartz.threadPool.threadCount">2</prop>
        <prop key="org.quartz.threadPool.threadPriority">4</prop>
        <prop key="org.quartz.jobStore.class">org.quartz.simpl.RAMJobStore</prop>
      </props>
    </property>
  </bean>
  

    
    <!-- <component>
      <role>org.apache.archiva.webdav.util.MimeTypes</role>
      <implementation>org.apache.archiva.webdav.util.MimeTypes</implementation>
      <description>MimeTypes</description>
      <configuration>
        <resource>archiva-mime-types.txt</resource>
      </configuration>
    </component> -->


    <!--
    olamy TODO check if necessary !!
   PLXREDBACK-81 bad role hint, redefining here until redback alpha-2 is released.

    <component>
      <role>org.apache.archiva.redback.system.check.EnvironmentCheck</role>
      <role-hint>locked-admin-check</role-hint>
      <implementation>org.apache.archiva.redback.integration.checks.security.LockedAdminEnvironmentCheck</implementation>
      <description>LockedAdminEnvironmentCheck: checks if accounts marked as system administrator are locked
        and unlocks them on startup.
      </description>
      <requirements>
        <requirement>
          <role>org.apache.archiva.redback.users.UserManager</role>
          <role-hint>cached</role-hint>
          <field-name>userManager</field-name>
        </requirement>
        <requirement>
          <role>org.apache.archiva.redback.rbac.RBACManager</role>
          <role-hint>cached</role-hint>
          <field-name>rbacManager</field-name>
        </requirement>
      </requirements>
    </component>
    -->

  <!-- TODO move to spring sample and test it -->
    <!-- START SNIPPET: ldap -->
    <!-- 
       Ldap Authentication can be enabled by setting enabling these components and setting the following configuration options in your security.properties file

       ============================================================
       user.manager.impl=ldap
       ldap.bind.authenticator.enabled=true
       redback.default.admin=admin
       security.policy.password.expiration.enabled=false

       ldap.config.hostname=ldap.hostname
       ldap.config.port=389
       ldap.config.base.dn=o=com
       ldap.config.context.factory=com.sun.jndi.ldap.LdapCtxFactory
       ldap.config.bind.dn=uid=myusername,o=com
       ldap.config.password=s3cr3t
       #ldap.config.authentication.method=
       ============================================================

       * ldap.config.hostname - The hostname of the ldap server
       * ldap.config.port - The port of the ldap server
       * ldap.config.base.dn - The baseDn of the ldap system
       * ldap.config.context.factory - context factory for ldap connections
       * ldap.config.bind.dn - the core user used for authentication the ldap server, must be able to perform the necessary searches, etc.
       * ldap.config.password - password for the bindDn for the root ldap connection

       until this process is better documented, the following is the document for configuration ldap with redback
      
       http://redback.codehaus.org/integration/ldap.html
    -->

    <!--
    
    this component manages the connection to the ldap server
     -->

    <!--
    <bean name="ldapConnectionFactory" class="org.apache.archiva.redback.common.ldap.connection.ConfigurableLdapConnectionFactory">
      <property name="userConf" ref="userConfiguration"/>
    </bean>
    -->

    
    <!-- 
    
    this component manages the mapping of attributes in ldap to user information in redback. To configure the mapping, you can add the following properties in your security.properties

       ============================================================
       ldap.config.mapper.attribute.email=mail
       ldap.config.mapper.attribute.fullname=givenName
       ldap.config.mapper.attribute.password=userPassword
       ldap.config.mapper.attribute.user.id=cn
       ldap.config.mapper.attribute.user.base.dn=
       ldap.config.mapper.attribute.user.object.class=inetOrgPerson
       ldap.config.mapper.attribute.user.filter=(attributeName=value)
       ============================================================


     * email-attribute - The name of the attribute on a user that contains the email address
     * full-name-attribute - The name of the attribute on a user that contains the users fullName
     * password-attribute - The name of the attribute containing the users password, used for the authentiction using the user manager and not the ldap bind authenticator
     * user-id-attribute - The name of the attribute containing the users userId, most commonly cn or sn.
     * user-base-dn - The base dn that will be subtree searched for users.
     * user-object-class - the objectClass used in the ldap server for indentifying users, most commonly inetOrgPerson.
     -->
    
    <!--
    <bean name="ldapUserMapper" class="org.apache.archiva.redback.common.ldap.LdapUserMapper">
      <property name="emailAttribute" value="email"/>
      <property name="fullNameAttribute" value="givenName"/>
      <property name="passwordAttribute" value="userPassword"/>
      <property name="userIdAttribute" value="cn"/>
      <property name="userBaseDn" value="o=com"/>
      <property name="userObjectClass" value="inetOrgPerson"/>
      <property name="userConf" ref="userConfiguration"/>
    </bean>     
    -->
  

    
    <!--
     
    If caching is desired to improve performance then make uncomment this and make sure the following configuration parameter is in the security.properties
     
    user.manager.impl=cached
    -->
     
    <!--
    <bean name="userManager#cached" class="org.apache.archiva.redback.users.cached.CachedUserManager">
      <property name="userImpl" ref="userMapper#ldap"/>
      <property name="usersCache" ref="cache#users"/>
    </bean>     
    -->
  

    
    <!-- 
    
    if using the user manager authenticator to authenticate the user and not the ldap bind authenticator make sure
    this definition has the correct password encoder
    
    Note: you should probably just use the ldap bind authenticator which is enabled by putting
    
    ldap.bind.authenticator.enabled=true
    
    in the security.properties
    -->
    <!--
    <bean name="userSecurityPolicy" class="org.apache.archiva.redback.policy.DefaultUserSecurityPolicy">
      <property name="config" ref="userConfiguration"/>
      <property name="passwordEncoder" ref="passwordEncoder#sha1"/>
      <property name="userValidationSettings" ref="userValidationSettings"/>
      <property name="rememberMeCookieSettings" ref="cookieSettings#rememberMe"/>
      <property name="signonCookieSettings" ref="cookieSettings#signon"/>
      <property name="rules">
        add the rules you want to applied
        <list>
          <ref bean="passwordRule#alpha-count"/>
          <ref bean="passwordRule#alpha-numeric"/>
          <ref bean="passwordRule#character-length"/>
          <ref bean="passwordRule#must-have"/>
          <ref bean="passwordRule#no-whitespaces"/>
          <ref bean="passwordRule#numerical-count"/>
        </list>
      </property>
    </bean>
    -->
    <!-- END SNIPPET: ldap -->
  <!-- override jcr repository location -->
  <!-- START SNIPPET: jcr-location -->
  <!--
  <bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create">
    <constructor-arg value="${appserver.base}/conf/repository.xml"/>
    <constructor-arg value="${appserver.base}/data/jcr"/>
  </bean>
  -->
  <!-- END SNIPPET: jcr-location -->

</beans>