Question

Using spring security to handle pre-authenticated user.

Asked by: intlgd

Hello,

This is my second post relating to this question. I got a pointer to the pre-authenticated section of the spring security in the answer of my last request for help and felt kind of silly when I realized that I hadn't read the documentation. I can now say that I've read through the security documentation multiple times, read 2 books on spring security, and downloaded the spring security sample source files and am still stuck!

I can get authentication to work perfectly for form based authentication, but cannot seem to get my custom authentication. I've put my security-config.xml below for the basic authentication. I'm using Dacs for authentication which handles single sign on for a number of our apps that sit in the same server space. Dacs creates an encrypted cookie, which we then gets decrypted when it hits our entry point servlet. The challenge is that I need an HttpServletRequest to get Dacs to decrypt the cookie and need to do so without using form based authentication.

As you can see below I've created a custom authentication provider to handle authentication against our userProfile database. The actual authentication is happening in the dacsLogin.htm, which is a servlet. The servlet redirects to a jsp which automatically posts to spring security with the extracted details captured in the servlet. This is a real hack and is causing problems for me in ajax based requests when the session times out. If I could either replace the servlet with the pre-auth stuff without causing anything to be output to the client that would be the perfect solution.

The problem is I've tried 20 different configurations and can't seem to get the pre-auth to work. Does someone have a stipped down example of pre-auth working. Your help would be greatly appreciated.

Please don't refer me to spring documentation, as I've read it over and over and can't come to a solution from there. I need an example of using pre-auth with all the required pieces.

Thanks,

Jared

-----security-config.xml--------
 
<?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-2.0.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">
 
   <!-- Put '@Secured( {"ROLE_SUPER"} )' over service methods ~ Not working causes error -->
    <!--<global-method-security secured-annotations="enabled" /> -->
 
    <http>
        <intercept-url pattern='/dacsLogin.htm' filters='none'/>
        <intercept-url pattern='/system/**' access='ROLE_SUPER' />
        <intercept-url pattern='/admin/**' access='ROLE_ADMIN' />
        <intercept-url pattern='/**' access='ROLE_BASIC' />
        <form-login login-page='/dacsLogin.htm' default-target-url='/index.jsp' always-use-default-target='false' />
    </http>
 
    <authentication-provider user-service-ref='userDetailsService'/>
 
    <beans:bean id="userDetailsService" class="com.cisco.btd.security.BtdUserDetailsService">
        <beans:property name="userService" ref="userService"/>
    </beans:bean>
 
</beans:beans>
 
------web.xml---------
..................
 <!-- Spring security -->
    <filter>
      <filter-name>springSecurityFilterChain</filter-name>
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
 
    <filter-mapping>
      <filter-name>springSecurityFilterChain</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>
.........................
 
---------dacs authentication servlet -----------
 
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 
        String dacsUsername;
        try {
            dacsUsername = DacsUtil.resolveUsername(DACS_BASE_URI, DACS_AUTH_JURIS, request);
            if (dacsUsername == null) {
                dacsUsername = "dacsuser";
                logger.error("Authentication problem. Couldn't find dacsUsername");
            }
            // Set session info.
            request.getSession(true).setAttribute(SESSION_USER_NAME, dacsUsername);
 
            logger.info("DACS credentials set for : " + dacsUsername);
        } catch (DacsException de) {
            dacsUsername = "dacsuser";
            logger.error("Failed authenticating with DACS: " + de.getMessage());
        }
 
        request.setAttribute("btdUser", dacsUsername);
        request.setAttribute("btdPassword", "");
        RequestDispatcher dispatcher;
        dispatcher = request.getRequestDispatcher("localLogin.jsp");
        dispatcher.forward(request, response);
 
}
 
--------------my hacked login jsp with auto-submit --------------
 
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
 
<html>
    <head>
        <title>Login Page</title>
    </head>
    <body>
        <form name='loginForm' action='<%= request.getContextPath() %>/j_spring_security_check' method='POST'>
            <input type='hidden' name='j_username' value='${btdUser}'>
            <input type='hidden' name='j_password' value='${btdPassword}' />
        </form>
        <SCRIPT language="JavaScript">
            document.loginForm.submit();
        </SCRIPT>
    </body>
</html>
 
------------my custom user authentication class - which works perfectly at this point -------------
 
public class BtdUserDetailsService implements UserDetailsService {
........................
 
@Override
    public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException, DataAccessException {
 
        //find user - do the regular stuff.
        checkDefaultRoles();
 
        User user = userService.findByUserId(userName);
 
        user = checkUser(user, userName);
 
        return new BtdUserDetails(user);
    }
 
............................
 
}

                                  
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:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-04-06 at 16:29:26ID24300242
Tags

Spring Security

,

JSP

Topics

Spring

,

Java Server Pages (JSP)

,

Jakarta Struts

Participating Experts
1
Points
500
Comments
6

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Spring
    What kind of exceptions does the Spring framework throw?
  2. How to work with spring security using cookie to authentic…
    Hello all, I have a basic understanding of how spring security works from the Spring in Action 2 book, but my situation is a little unique. So let me explain: We have apache sitting in front of port 80 (on a secured intranet) and authenticate through a proprietary apache mo...
  3. Spring binding
    Hi, I am new to the spring framework. In my jsp i am trying to bind a form to a hashmap I am getting this exception when i call the jsp, org.apache.jasper.JasperException: /WEB-INF/jsp/modifyConfigManagement.jsp(72,77) equal symbol expected What is wrong in the code. Coul...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: boonlengPosted on 2009-04-06 at 18:51:07ID: 24083402

By default spring pre-auth retrieve the user from "request.getUserPrincipal()".
To retrieve user from other source e.g cookie, you need to extends the class "J2eePreAuthenticatedProcessingFilter" and override the method "getPreAuthenticatedPrincipal(HttpServletRequest request)".

Then configure the security-config.xml to use the custom preauth filter, e.g:
 <bean id="j2eePreAuthFilter" class="com.mycompany.CustomPreAuthenticatedProcessingFilter">

Let me know if you are still have problem getting the user.


Boon Leng

 

by: intlgdPosted on 2009-04-07 at 08:25:21ID: 24088321

I'm not in a J2EE situation. Not sure how this applies to me. Do you have a functional security.xml example? I've downloaded and reviewed the J2EE Pre-auth sample source and don't see how this ties into my situation. I need a functional example.

Thanks,

Jared

 

by: intlgdPosted on 2009-04-07 at 10:15:43ID: 24089651

Alright, I've taken you example and what I've found in other places and it is compiling and trying to authenticate. Can you look over this and point me in the right direction. See code below:

-----------security-config.xml using special filter
 
<?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-2.5.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
 
    <bean id="springSecurityFilterChain" class="org.springframework.security.util.FilterChainProxy">
        <sec:filter-chain-map path-type="ant">
            <sec:filter-chain pattern="/**" filters="sif,preAuthenticatedProcessingFilter,logoutFilter,fsi"/>
        </sec:filter-chain-map>
    </bean>
 
    <!-- Filter # 1 -->
    <bean id="sif" class="org.springframework.security.context.HttpSessionContextIntegrationFilter"/>
 
    <sec:authentication-manager alias="authenticationManager" />
 
    <sec:authentication-provider user-service-ref='userDetailsService'/>
 
    <bean id="userDetailsService" class="com.cisco.btd.security.BtdUserDetailsService">
        <property name="userService" ref="userService"/>
    </bean>
    
    <bean id="preAuthenticatedProcessingFilter" class="com.cisco.btd.security.PreAuthenticatedProcessingFilter">
        <sec:custom-filter position="PRE_AUTH_FILTER" />
        <property name="authenticationManager" ref="authenticationManager" />
    </bean>
 
    <bean id="preAuthenticatedAuthenticationProvider" class="org.springframework.security.providers.preauth.PreAuthenticatedAuthenticationProvider">
        <sec:custom-authentication-provider />
        <property name="preAuthenticatedUserDetailsService">
            <bean id="userDetailsServiceWrapper" class="org.springframework.security.userdetails.UserDetailsByNameServiceWrapper">
                <property name="userDetailsService" ref="userDetailsService" />
            </bean>
        </property>
    </bean>
    
    <!-- Handle logout -->
    <bean id="logoutFilter" class="org.springframework.security.ui.logout.LogoutFilter">
        <constructor-arg value="/"/>
        <constructor-arg>
            <list>
                <bean class="org.springframework.security.ui.logout.SecurityContextLogoutHandler"/>
            </list>
        </constructor-arg>
    </bean>
 
    <bean id="httpRequestAccessDecisionManager" class="org.springframework.security.vote.AffirmativeBased">
        <property name="allowIfAllAbstainDecisions" value="false"/>
        <property name="decisionVoters">
            <list>
                <ref bean="roleVoter"/>
            </list>
        </property>
    </bean>
 
    <bean id="fsi" class="org.springframework.security.intercept.web.FilterSecurityInterceptor">
        <property name="authenticationManager" ref="authenticationManager"/>
        <property name="accessDecisionManager" ref="httpRequestAccessDecisionManager"/>
        <property name="objectDefinitionSource">
            <sec:filter-invocation-definition-source>
                <sec:intercept-url pattern='/system/**' access='ROLE_SUPER' />
                <sec:intercept-url pattern='/admin/**' access='ROLE_ADMIN' />
                <sec:intercept-url pattern='/**' access='ROLE_BASIC' />
            </sec:filter-invocation-definition-source>
        </property>
    </bean>
 
    <bean id="roleVoter" class="org.springframework.security.vote.RoleVoter"/>
 
    <bean id="securityContextHolderAwareRequestFilter" class="org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter">
        <property name="wrapperClass" value="org.springframework.security.wrapper.SecurityContextHolderAwareRequestWrapper"/>
    </bean>
 
</beans>
 
---------- UserDetailsService
 
public class BtdUserDetailsService implements UserDetailsService {
    private UserService userService;
 
    @Override
    public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException, DataAccessException {
 
        //find user - do the regular stuff.
        checkDefaultRoles();
 
        User user = userService.findByUserId(userName);
 
        user = checkUser(user, userName);
 
        return new BtdUserDetails(user);
    }
......
}
 
 
------------- Custom filter - this is incomplete and needs some pointers.
 
import javax.servlet.http.HttpServletRequest;
import org.springframework.security.ui.preauth.AbstractPreAuthenticatedProcessingFilter;
 
public class PreAuthenticatedProcessingFilter extends AbstractPreAuthenticatedProcessingFilter {
 
    @Override
    protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
        //WHAT OBJECT DO I RETURN HERE?
        String userName = "testUser";
        return userName;
    }
 
    @Override
    protected Object getPreAuthenticatedCredentials(HttpServletRequest arg0) {
        return null;
    }
 
    public int getOrder() {
        return org.springframework.security.ui.FilterChainOrder.PRE_AUTH_FILTER;
    }
 
}
                                              
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:

Select allOpen in new window

 

by: boonlengPosted on 2009-04-07 at 18:53:11ID: 24093420

Correct, the "getPreAuthenticatedPrincipal()" is returning the username.

For the UserDetailsService, you need to implement "AuthenticationUserDetailsService" rather then "UserDetailsService" coz using class "PreAuthenticatedAuthenticationProvider" as provider. Class "UserDetailsService" is use by DatabaseAuthenticationProvider.

The following is the sample UserDetailsService:

public class BtdUserDetailsService implements AuthenticationUserDetailsService {
 
    public UserDetails loadUserDetails(Authentication authentication)
            throws UsernameNotFoundException {
        String username = (String) authentication.getPrincipal();
        
        User user = userService.findByUserId(userName);
        
        return user;
    }
}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:

Select allOpen in new window

 

by: boonlengPosted on 2009-04-07 at 19:01:18ID: 24093435

For the class "PreAuthenticatedProcessingFilter", the method getPreAuthenticatedCredentials() cannot return null as "PreAuthenticatedAuthenticationProvider" will verify the credential and if null it will throw exception. Just return empty string or any wording.

 

by: intlgdPosted on 2009-04-08 at 08:58:09ID: 24098736

Hello booleng,

You rock my friend!!!! Thanks so much for your help. I've attached my latest configuration for anyone else out there struggling with this. Good luck to all out there setting up Spring security.

Jared

---In your web.xml add this:
...
    <!-- Spring security -->
    <filter>
      <filter-name>springSecurityFilterChain</filter-name>
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
 
    <filter-mapping>
      <filter-name>springSecurityFilterChain</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>
...
.
---In your spring-secutity.xml (or application-context.xml)
<?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-2.5.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
 
    <bean id="springSecurityFilterChain" class="org.springframework.security.util.FilterChainProxy">
        <sec:filter-chain-map path-type="ant">
            <sec:filter-chain pattern="/devMachineSetup*" filters="none"/>
			<sec:filter-chain pattern="/css/**" filters="none"/>
			<sec:filter-chain pattern="/js/**" filters="none"/>
            <sec:filter-chain pattern="/img/**" filters="none"/>
            <sec:filter-chain pattern="/**" filters="sif,preAuthenticatedProcessingFilter,logoutFilter,fsi"/>
        </sec:filter-chain-map>
    </bean>
 
    <!-- Filter # 1 -->
    <bean id="sif" class="org.springframework.security.context.HttpSessionContextIntegrationFilter"/>
 
    <sec:authentication-manager alias="authenticationManager" />
 
    <sec:authentication-provider user-service-ref='userDetailsService'/>
 
    <bean id="userDetailsService" class="com.cisco.btd.security.BtdUserDetailsService">
        <property name="userService" ref="userService"/>
    </bean>
 
    <bean id="preAuthenticatedProcessingFilter" class="com.cisco.btd.security.PreAuthenticatedProcessingFilter">
        <sec:custom-filter position="PRE_AUTH_FILTER" />
        <property name="authenticationManager" ref="authenticationManager" />
    </bean>
 
    <bean id="preAuthenticatedAuthenticationProvider" class="org.springframework.security.providers.preauth.PreAuthenticatedAuthenticationProvider">
        <sec:custom-authentication-provider />
        <property name="preAuthenticatedUserDetailsService">
            <bean id="userDetailsServiceWrapper" class="org.springframework.security.userdetails.UserDetailsByNameServiceWrapper">
                <property name="userDetailsService" ref="userDetailsService" />
            </bean>
        </property>
    </bean>
    
    <!-- Handle logout -->
    <bean id="logoutFilter" class="org.springframework.security.ui.logout.LogoutFilter">
        <constructor-arg value="/"/>
        <constructor-arg>
            <list>
                <bean class="org.springframework.security.ui.logout.SecurityContextLogoutHandler"/>
            </list>
        </constructor-arg>
    </bean>
 
    <bean id="httpRequestAccessDecisionManager" class="org.springframework.security.vote.AffirmativeBased">
        <property name="allowIfAllAbstainDecisions" value="false"/>
        <property name="decisionVoters">
            <list>
                <ref bean="roleVoter"/>
            </list>
        </property>
    </bean>
 
    <bean id="fsi" class="org.springframework.security.intercept.web.FilterSecurityInterceptor">
        <property name="authenticationManager" ref="authenticationManager"/>
        <property name="accessDecisionManager" ref="httpRequestAccessDecisionManager"/>
        <property name="objectDefinitionSource">
            <sec:filter-invocation-definition-source>
                <sec:intercept-url pattern='/system/**' access='ROLE_SUPER' />
                <sec:intercept-url pattern='/admin/**' access='ROLE_ADMIN' />
                <sec:intercept-url pattern='/**' access='ROLE_BASIC' />
            </sec:filter-invocation-definition-source>
        </property>
    </bean>
 
    <bean id="roleVoter" class="org.springframework.security.vote.RoleVoter"/>
 
    <bean id="securityContextHolderAwareRequestFilter" class="org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter">
        <property name="wrapperClass" value="org.springframework.security.wrapper.SecurityContextHolderAwareRequestWrapper"/>
    </bean>
 
</beans>
.
----Create a custom pre-auth filter
public class PreAuthenticatedProcessingFilter extends AbstractPreAuthenticatedProcessingFilter {
    @Override
    protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
        return "loggedInUser";
    }
    @Override
    protected Object getPreAuthenticatedCredentials(HttpServletRequest request) {
        return "";
    }
    public int getOrder() {
        return org.springframework.security.ui.FilterChainOrder.PRE_AUTH_FILTER;
    }
}
.
---Create a custom userDetailsService (if desired)
.
public class BtdUserDetailsService implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException, DataAccessException {
 
      //This is a org.springframework.security.userdetails.UserDetails object (extend as needed - I extended it an the roles)
      return new UserDetails(...);
    }

                                              
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:

Select allOpen in new window

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...