Grails Spring Security Core Plugin - adding flash message to login page -


i using grails spring security core plugin secure action using following annotation.

@secured(['is_authenticated_remembered']) 

this causes action redirect login page if user not logged in. once logged in redirected original action.

how can add flash message login page in scenario, i.e.

flash.message = "you must logged in submit news story" 

to clarify, want message displayed if user redirected login page after attempting access specific action. other actions not trigger message.

i have solved follows.

  1. remote annotation action.
  2. add following code @ beginning of action (news , submit being relevant controller , action respectively).

    if (!springsecurityservice.isloggedin()) {     flash.message = "you must logged in submit news story."     redirect(controller:"login", action: "auth", params:["spring-security-redirect" : "/news/submit"]) } 
  3. add following login form.

    <input type='hidden' name='spring-security-redirect' value='${params['spring-security-redirect']}'/> 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -