Announcement Announcement Module
No announcement yet.
Tomcat (JDBCRealm) + Spring @Secured annotation . Do i need authentication-provider ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tomcat (JDBCRealm) + Spring @Secured annotation . Do i need authentication-provider ?


    I am stuck with this issue and don't know how to resolve this.

    Tomcat Setup
    1.) I have defined my users and roles in the DB and use JDBCRealm in Tomcat to authenticate.

    Spring Setup
    1.) My method looks like this :

    public List<Test> execute(Settings settings);

    * The HttpServletRequest object does have the UserPrincipal before i make a call to this execute method. I also see the correct role in UserPrincipal.

    2.) My application-context.xml looks like this :

    <bean id="filterChainProxy" class=" nProxy">
    <sec:filter-chain-map path-type="ant">
    <sec:filter-chain pattern="/images/**" filters="none"/>
    <sec:filter-chain pattern="/css/**" filters="none"/>
    <sec:filter-chain pattern="/scripts/**" filters="none"/>
    <sec:filter-chain pattern="/**" filters="httpRequestFilter" />
    <bean id="httpRequestFilter" class=""/>

    <sec:global-method-security secured-annotations="enabled" />

    * Spring tells me i need to add an "authentication-provider". If i am already authenticating using can i leverage that ?

    When i did create an "authentication-provider" like shown below, i get a BadCredentialsException.

    <bean id="authenticationManager" class=" .ProviderManager">
    <property name="providers">
    <ref local="daoAuthenticationProvider" />

    <bean id="daoAuthenticationProvider"
    class=" .dao.DaoAuthenticationProvider">
    <property name="userDetailsService" ref="userDetailsService" />
    <property name="hideUserNotFoundExceptions"
    value="false" />

    <sec:user-service id="userDetailsService">
    <sec:user name="admin" password="admin" authorities="ROLE_USER, ROLE_ADMIN" />

    Please help !!!

  • #2
    Dont worry about it guys...i figured it out.

    This is what i needed :

    The webapp : "samples/preauth" is extremely helpful.