Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have not been able to find anything relating to what I want to achieve

I have a web system that is using Spring Secuirty 3.1 that needs to link users from an Active Directory. For my dev, I was just storing them in the spring-security.xml file. This was fine, but for production, I need to have the users linked from Active Directory. I have this working now so I can log in ect, so this isn't the issue. The issue I have is, in my local dev work, I had users and "groups", i.e. ROLE_USER and ROLE_ADMIN.

In Active directory, there are two groups that map on to these names. I need to do the URL intercept-url based on these role types, but I dont know how to do this for active directory.

This is my local dev version that hard codes the users in the authentication-provider. This needs to be forr active directory:

<http auto-config="true" disable-url-rewriting="true">
    <intercept-url pattern="/test/*" access="ROLE_USER, ROLE_ADMIN"  />
    <intercept-url pattern="/admin" access="ROLE_ADMIN"  />
    <intercept-url pattern="/list*" access="ROLE_USER, ROLE_ADMIN" />
    <form-login login-page="/login" 
            authentication-failure-url="/loginfailed" />
    <logout invalidate-session="true" logout-success-url="/logout" />
    <session-management invalid-session-url="/login">
        <concurrency-control max-sessions="1" error-if-maximum-exceeded="true"/>

            <user name="test" password="test" authorities="ROLE_USER" />
            <user name="admin" password="admin" authorities="ROLE_ADMIN" />

BUT, what I need to do is replace this with active directory based authentication-manager.

    <authentication-provider ref="ldapActiveDirectoryAuthProvider"/>

I know the users are in this directory for AD:


and the groups are in:


The key attribute in Active Directory that is used to log in is 'SAM-Account-Name'

Please help.

share|improve this question

migrated from Sep 11 '12 at 18:32

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Have a look at the Spring Security Reference!

Chapter 19.5 Active Directory Authentication

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.