Skip to content

Instantly share code, notes, and snippets.

@lalyos
Created February 15, 2012 17:41
Show Gist options
  • Save lalyos/1837587 to your computer and use it in GitHub Desktop.
Save lalyos/1837587 to your computer and use it in GitHub Desktop.
Spring Security LDAP
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
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.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<!-- HTTP security configurations -->
<http auto-config="true" use-expressions="true">
<form-login login-processing-url="/resources/j_spring_security_check" login-page="/login" authentication-failure-url="/login?login_error=t"/>
<logout logout-url="/resources/j_spring_security_logout"/>
<!-- Configure these elements to secure URIs in your application -->
<intercept-url pattern="/choices/**" access="hasRole('ROLE_ADMIN')"/>
<intercept-url pattern="/surveys/**" access="isAuthenticated()" />
<intercept-url pattern="/resources/**" access="permitAll" />
<intercept-url pattern="/**" access="permitAll" />
</http>
<ldap-server id="ldapServer" url="ldap://10.0.10.11:389/dc=budapest,dc=epam,dc=com" manager-dn="CN=Your Name,CN=Users,DC=budapest,DC=epam,DC=com" manager-password="XXXXX" />
<authentication-manager>
<ldap-authentication-provider server-ref="ldapServer"
user-search-base="CN=Users"
user-search-filter="(sAMAccountName={0})"
group-search-base="CN=Users"
group-search-filter="(distinguishedName={0})"
role-prefix="ROLE_" />
</authentication-manager>
</beans:beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment