Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8524437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:41:11+00:00 2026-06-11T07:41:11+00:00

I have a simple authentication provider that I’m trying to use with Spring Security.

  • 0

I have a simple authentication provider that I’m trying to use with Spring Security.

<security:http auto-config="true" use-expressions="true">
    <security:intercept-url pattern="/**" access="isAuthenticated()" />
</security:http>
<security:authentication-manager>
    <security:authentication-provider
        ref="ipAddressAuthenticationProvider" />
</security:authentication-manager>

Currently, with the above configuration, the user is redirected to a logon page when the first visit. I do not want this redirect. I’m trying to hit this authentication provider on every page visit. Any way to make this work without writing additional custom code?

I’m guessing I need to cleanly get rid of form filter and basic filter somehow.

Result

I got it working with the config below. I had to extend AbstractPreAuthenticatedProcessingFilter and simply return ""; for both of its abstract methods.

<security:http use-expressions="true" entry-point-ref="http403ForbiddenEntryPoint">
    <security:intercept-url pattern="/**" access="isAuthenticated()" />
    <security:custom-filter position="PRE_AUTH_FILTER" ref="preAuthFilter" />
</security:http>
<bean id="preAuthFilter" class="com.hercules.ratinggame.business.security.IpAddressPreAuthenticationFilter">
    <property name="authenticationManager" ref="authenticationManager"/>
</bean>
<bean id="http403ForbiddenEntryPoint" class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint"/>
<security:authentication-manager alias="authenticationManager">
    <security:authentication-provider
        ref="ipAddressAuthenticationProvider" />
</security:authentication-manager>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:41:13+00:00Added an answer on June 11, 2026 at 7:41 am

    Currently you use auto-config="true" which means you get few filters configured iunder the hood, including <form-login> element with UsernamePasswordAuthenticationFilter filter.

    Also, to hit this authentication provider on every page visit you’ll need a filter which can obtain data from request (IP address as far as I can see). The filter will probably be RequestHeaderAuthenticationFilter or more likely your own AbstractPreAuthenticatedProcessingFilter implementation which will have access to your autentication-manager.

    To sum up, configuration will look like:

    <security:http use-expressions="true">
        <security:intercept-url pattern="/**" access="isAuthenticated()" />
        <security:logout /> <!-- optional -->
        <security:custom-filter position="PRE_AUTH_FILTER"
                ref="ipFromRequestPreAuthenticationFilter" />
    </security:http>
    
    <!-- this will probably extend AbstractPreAuthenticatedProcessingFilter -->
    <bean id="ipFromRequestPreAuthenticationFilter"
            class="com.example.IpFromRequestPreAuthenticationFilter">
        <property name="authenticationManager" ref="authenticationManager" />
    </bean>
    
    <security:authentication-manager alias="authenticationManager">
        <security:authentication-provider ref="ipAddressAuthenticationProvider" />
    </security:authentication-manager>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have simple Spring Security webapp with password encoding: <security:authentication-manager alias=authenticationManager> <security:authentication-provider user-service-ref=personService> <security:password-encoder hash=md5
I am trying to do a really simple basic authentication with Spring Security. I
I'm trying to make a simple username/password authentication in a Spring Security web app.
I'm using Spring Security 3. I have my own authentication provider. Here is what
I need to have a custom authentication in spring, it should be a simple
I currently have a simple app that includes user authentication through devise and a
We have an MVC3 site that uses the ASP.NET Membership Provider with Forms Authentication
I'm trying configure Request-Header Authentication using spring 2.0 security, and I'm a complete newbie
I have simple php validation form that is halfway working. If you leave the
I have simple win service, that executes few tasks periodically. How should I pass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.