Add LDAP support.
This commit is contained in:
@@ -98,3 +98,25 @@ google.analytics.account=UA-XXXX
|
||||
# Google Ads enable
|
||||
##################################################################################
|
||||
google.ads.enabled=false
|
||||
|
||||
#######################################################################################
|
||||
LDAP Configuration Section
|
||||
#######################################################################################
|
||||
security.ldap.enabled=false
|
||||
security.ldap.server=ldap://localhost:389
|
||||
security.ldap.server.user=cn=pveiga,dc=wisemapping,dc=com
|
||||
security.ldap.server.password=password
|
||||
|
||||
security.ldap.basedn=dc=wisemapping,dc=com
|
||||
security.ldap.subDn=people
|
||||
security.ldap.auth.attribute=mail
|
||||
#######################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -28,6 +28,7 @@
|
||||
- The application context is then available via
|
||||
- WebApplicationContextUtils.getWebApplicationContext(servletContext).
|
||||
-->
|
||||
|
||||
<listener>
|
||||
<listener-class>com.wisemapping.service.HibernateAppListener</listener-class>
|
||||
</listener>
|
||||
|
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:sec="http://www.springframework.org/schema/security"
|
||||
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-3.1.xsd
|
||||
http://www.springframework.org/schema/security
|
||||
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
|
||||
|
||||
<sec:authentication-manager alias="authenticationManager">
|
||||
<sec:authentication-provider ref="dbAuthenticationProvider"/>
|
||||
<sec:authentication-provider user-service-ref="userDetailsService"/>
|
||||
</sec:authentication-manager>
|
||||
|
||||
<bean id="dbAuthenticationProvider" class="com.wisemapping.security.AuthenticationProvider">
|
||||
<property name="userDetailsService" ref="userDetailsService"/>
|
||||
<property name="encoder" ref="encoder"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:sec="http://www.springframework.org/schema/security"
|
||||
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-3.1.xsd
|
||||
http://www.springframework.org/schema/security
|
||||
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
|
||||
|
||||
|
||||
<sec:authentication-manager>
|
||||
<sec:authentication-provider ref="ldapAuthProvider"/>
|
||||
</sec:authentication-manager>
|
||||
|
||||
<!-- ================================================== -->
|
||||
<!-- LDAP Connection settings -->
|
||||
<!-- ================================================== -->
|
||||
|
||||
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
|
||||
<property name="url" value="${security.ldap.server}"/>
|
||||
<property name="userDn" value="${security.ldap.server.user}"/>
|
||||
<property name="password" value="${security.ldap.server.password}"/>
|
||||
<property name="base" value="${security.ldap.basedn}"/>
|
||||
</bean>
|
||||
|
||||
<!-- ================================================== -->
|
||||
<!-- Authentication and Authorization Handlers -->
|
||||
<!-- ================================================== -->
|
||||
<bean id="ldapAuthProvider"
|
||||
class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
|
||||
<constructor-arg>
|
||||
<bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
|
||||
<constructor-arg ref="contextSource"/>
|
||||
<property name="userSearch" ref="ldapUserSearch"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
<property name="userDetailsContextMapper" ref="userDetailsContextMapper"/>
|
||||
</bean>
|
||||
|
||||
<bean id="userDetailsContextMapper" class="com.wisemapping.security.ldap.LdapUserDetailsContextMapper">
|
||||
<property name="userService" ref="userService"/>
|
||||
</bean>
|
||||
|
||||
<bean id="ldapUserSearch"
|
||||
class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
|
||||
<constructor-arg index="0" value="ou=${security.ldap.subDn}"/>
|
||||
<constructor-arg index="1" value="(${security.ldap.auth.attribute}={0})"/>
|
||||
<constructor-arg index="2" ref="contextSource"/>
|
||||
<property name="searchSubtree" value="true"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
@@ -56,18 +56,10 @@
|
||||
<sec:logout logout-url="/c/logout" invalidate-session="true" logout-success-url="/c/login"/>
|
||||
</sec:http>
|
||||
|
||||
<sec:authentication-manager alias="authenticationManager">
|
||||
<sec:authentication-provider ref="dbAuthenticationProvider"/>
|
||||
<sec:authentication-provider user-service-ref="userDetailsService"/>
|
||||
</sec:authentication-manager>
|
||||
|
||||
<bean id="dbAuthenticationProvider" class="com.wisemapping.security.AuthenticationProvider">
|
||||
<property name="userDetailsService" ref="userDetailsService"/>
|
||||
<property name="encoder" ref="encoder"/>
|
||||
</bean>
|
||||
<!--<import resource="wisemapping-security-db.xml"/>-->
|
||||
<import resource="wisemapping-security-ldap.xml"/>
|
||||
|
||||
<bean id="userDetailsService" class="com.wisemapping.security.UserDetailsService">
|
||||
<!--suppress SpringModelInspection -->
|
||||
<property name="userService" ref="userService"/>
|
||||
<property name="adminUser" value="${admin.user}"/>
|
||||
</bean>
|
||||
@@ -76,4 +68,5 @@
|
||||
<property name="defaultTargetUrl" value="/c/maps/"/>
|
||||
<property name="alwaysUseDefaultTargetUrl" value="false"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
Reference in New Issue
Block a user