0

I have gone a good distance in spring-security-core-2.0-RC5 (SSC) with Grails 2.5, but still a lot to cover. I am wondering how to achieve two tasks. So far and after integrating SSC in my project, I built a dispatcher that takes care of routing users to different landing pages according to their roles. This link shows how I do it. What I am wondering how others are doing is these two tasks:

  1. How to customize the landing page. For example, instead of the typical "Please Login", I need to say "Please login using your provided username and password" plus an image or something. This means I have to override (or overwrite) the existing login page. What is the best way to do this?
  2. The more important. When a user is logged in, I route them to different pages based on their roles, or even log them out if their account is !enabled. However, what I can't do is be in control when the user has no credentials at all. What I would like to do is instead of displaying the typical "Sorry, we were not able to find a user with that username and password.", I would like to intercept the behaviour and perform some actions before redirecting users to the logout/login page (actions like a web service request for example). How can I achieve this please - to be able to make certain tasks on behalf of non-authorized users?
Community
  • 1
  • 1
mohsenmadi
  • 2,277
  • 1
  • 23
  • 34
  • 1
    For custom login page you Just have to place a auth.gsp page in 'app/views/login/auth.gsp' – Anant Kolvankar Jun 10 '15 at 03:50
  • 1
    Regarding changing.error message you can use change literals in 'message.properties' also I found a link which might be helpful http://burtbeckwith.com/blog/?p=1090 – Anant Kolvankar Jun 10 '15 at 03:55
  • I figured out how to accomplish Task 2 above. Let me know if someone needs to know how. – mohsenmadi Jun 12 '15 at 13:35
  • 1
    did task1 worked from my suggestions ? – Anant Kolvankar Jun 12 '15 at 14:05
  • Oh thanks for asking; that was next on the list of tasks to do I should get to it <= Monday - I 'll tell you how it goes. So basically, you are saying that if I copy the existing auth.gsp (the one that comes with SpringSecurityCore SSC for example) and put it in my /views/login/, SSC would use mine over the default provided one, and that the rest of redirections will all act as if nothing has changed, right? – mohsenmadi Jun 12 '15 at 14:46
  • Hey @ Anant Kolvankar, your suggestion is perfect! It worked for me just great. If you guys want to put answers for the benefit of completion I will up them. – mohsenmadi Aug 05 '15 at 20:25

1 Answers1

1

For Task1 (custom login page) you Just have to place a auth.gsp page in 'app/views/login/auth.gsp'

Anant Kolvankar
  • 1,050
  • 9
  • 10