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.
- remote annotation action.
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"]) }
add following login form.
<input type='hidden' name='spring-security-redirect' value='${params['spring-security-redirect']}'/>
Comments
Post a Comment