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

  • Home
  • SEARCH
  • 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 3879884
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:46:45+00:00 2026-05-19T22:46:45+00:00

In our app spring security uses ldap as a provider. i am working on

  • 0

In our app spring security uses ldap as a provider.

i am working on a change that will let you flip a flag in dev that will allow you to log in if your user/pass matches a value from database. the ldap server might be down and you can still log in.

What ive realized though is that some urls are secured with

@Secured( {"ROLE_USER","ROLE_MERCHANT"})

so i need to still have some dealings with spring security in order for my logins to work. How do i go about doing this?

  • 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-05-19T22:46:45+00:00Added an answer on May 19, 2026 at 10:46 pm

    You can configure 2 providers: one LDAP provider and another DAO provider.

    <sec:authentication-manager alias="authenticationManager">
        <sec:authentication-provider ref="yourLdapAuthenticationProvider" />
        <sec:authentication-provider ref="yourDaoAuthenticationProvider" />
    </sec:authentication-manager>
    

    If the LDAP fails, it will fall back to DAO authentication provider.

    You will need to configure your own authentication filter to inject that flag into yourDaoAuthenticationProvider so that when the authentication falls back to yourDaoAuthenticationProvider, it can check whether to proceed with further authentication (say, in development) or ignore it (say, in production). So, in your authenticationFilter, override setDetails() to store the flag:-

    myAuthenticationFilter bean

    @Override
    protected void setDetails(HttpServletRequest request, UsernamePasswordAuthenticationToken authRequest) {
        YourObject yourObject = new YourObject(request.getParameter("devAuthAgainstDAO"));
        authRequest.setDetails(yourObject);
    }
    

    With this, have your yourDaoAuthenticationProvider to check against this flag before proceeding with further authentication.

    In the end, your configuration will look something like this:-

    <sec:http auto-config="false" entry-point-ref="loginUrlAuthenticationEntryPoint">
        <sec:logout logout-success-url="/login.jsp"/>
        <sec:intercept-url ... />
    
        <sec:custom-filter position="FORM_LOGIN_FILTER" ref="myAuthenticationFilter"/>
    </sec:http>
    
    <bean id="myAuthenticationFilter" class="[YOUR_CUSTOM_AUTHENTICATION_FILTER]">
        <property name="authenticationManager" ref="authenticationManager"/>
        <property name="authenticationFailureHandler" ref="failureHandler"/>
        <property name="authenticationSuccessHandler" ref="successHandler"/>
    </bean>
    
    <bean id="loginUrlAuthenticationEntryPoint"
          class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
        <property name="loginFormUrl" value="/login.jsp"/>
    </bean>
    
    <bean id="successHandler"
          class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler">
        <property name="defaultTargetUrl" value="/welcome.jsp"/>
        <property name="alwaysUseDefaultTargetUrl" value="true"/>
    </bean>
    
    <bean id="failureHandler"
          class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
        <property name="defaultFailureUrl" value="/login.jsp?login_error=1"/>
    </bean>
    
    
    <bean id="yourLdapAuthenticationProvider" ... />
    
    <bean id="yourDaoAuthenticationProvider" ... />
    
    <sec:authentication-manager alias="authenticationManager">
        <sec:authentication-provider ref="yourLdapAuthenticationProvider"/>
        <sec:authentication-provider ref="yourDaoAuthenticationProvider"/>
    </sec:authentication-manager>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented spring security's remember me feature in our app, the way i
We are having trouble getting Spring Security/Kerberos/AD to work for our web app. Our
Whilst trying to get our app working in Firefox (I'm a big proponent of
I added some simple WatiN tests to our app today to check that a
I'm writing an Android app for work that shows the status of our phone
We are preparing to deploy a Windows .NET client app that will make web
Would that be a reason for rejection of our app, if we use the
Our app (already deployed) is using an Access/Jet database. The upcoming version of our
Our app allows multiple files to be selected in a file selection dialog which
In our app, we currently live with the legacy of a decision to store

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.