Announcement Announcement Module
No announcement yet.
How to perform pre login tasks Page Title Module
Move Remove Collapse
This topic is closed
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to perform pre login tasks


    I am pretty new to spring.
    I have requirement of performing db existence check before redirecting the user to the login page.

    use case :
    1. User enters loginpage url.
    2. Check if db is present.
    3. if yes redirect user to login page(A).
    4. if no redirect user to required page(B).

    Present implementation: This check was achieved by making an ajax call in page A's Post method, to a service which is exposed by security for non authenticated users.On success redirect the user to page A else to page B.

    Problem is i feel this is not the correct way to implement Pre-Login events.

    I tried using pre authentication filter but am not able to achieve this case since pre-auth filter directly gives login page first and does the processing next.
    I do not want the user to see the login page before the pre-conditions are met.

    am i implementing this in the correct way, are there any other options on which i can relay on.

  • #2
    How about implementing a custom filter which fires before the spring security filters?


    • #3
      Yes, it sounds like you don't even need Spring Security for this. Just plunk a servlet filter before any security stuff in the web app configuration.