<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2013, Perforce Software
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<global-method-security secured-annotations="disabled">
</global-method-security>
<context:annotation-config />
<http pattern="/img/**" security="none" />
<http pattern="/help/**" security="none" />
<http pattern="/about" security="none" />
<http pattern="/version" security="none" />
<http pattern="/api/search" security="none" />
<http pattern="/api/configuration" security="none" />
<http pattern="/ui/**" security="none" />
<http pattern="/favicon.ico" security="none" />
<http auto-config="true" use-expressions="true" >
<intercept-url pattern="/api/auth-search**" access="isAuthenticated()" />
<intercept-url pattern="/api/userid**" access="isAuthenticated()" />
<form-login login-page="/ui/search.html"
default-target-url="/api/userid"
always-use-default-target="true"
authentication-failure-url="/notauthorized"/>
<logout logout-url="/j_spring_security_logout" logout-success-url="/ui/search.html" />
</http>
<beans:bean id="configuration"
class="com.perforce.search.configuration.internal.ConfigurationImpl">
<beans:constructor-arg index="0"
value="#{ systemProperties['search.configfile'] == null ?
'classpath:com.perforce.search.config.properties' : systemProperties['search.configfile'] }"
type="java.io.InputStream" />
</beans:bean>
<beans:bean id="connectionPool"
class="com.perforce.search.server.impl.ServerConnectionPoolFacadeImpl">
<beans:constructor-arg index="0" ref="configuration" />
</beans:bean>
<beans:bean id="perforceAuthenticationProvider"
class="com.perforce.search.server.PerforceAuthenticationProvider">
<beans:property name="pool" ref="connectionPool" />
</beans:bean>
<!-- from 3.1 onwards, erase-credentials default to true, so we have to turn it off, but this will keep passwords being retained longer in memory -->
<authentication-manager alias="authenticationManager" erase-credentials="false">
<authentication-provider ref="perforceAuthenticationProvider" />
</authentication-manager>
</beans:beans>