How to process login with spring security core and grails -
i have integrated spring security core in grails project , s2-quickstart too.
so got basic gsps, domain controllers also.
so have 1 user id = 'me' , password (encoded) = 'password' inside database role = 'role_admin'.
now confuse api classes have. need show login page on start of project , if user enters correct id password should redirect dashboard page. have written following piece of code :
urlmapping.groovy ================= "/"(controller:"login", action:"auth") logincontroller.groovy ====================== class logincontroller { def authenticationtrustresolver def springsecurityservice def index = { redirect(action: 'auth', params: params) } def auth = { //checking licensing stuff .... .... } def signin = { if ( params.username == null ) redirect(action: 'login') def config = springsecurityutils.securityconfig if (springsecurityservice.isloggedin()) { def targeturi = "/dashboard/loaddashboard" redirect(uri: targeturi) } else { println params.username println params.password //don't know class should use here } } auth.gsp inside (login directory) ================================= <form action='login/signin' method='post' id='loginform' class='cssform' autocomplete='off'> <label for='username'>login id</label> <input type='text' class='text_' name='j_username' id='username' /> <label for='password'>password</label> <input type='password' class='text_' name='j_password' id='password' /> <input type='submit' value='login' />
so don't know how should pass username , password class inside else part of signin method of logincontroller.
any highly appreciated...
spring-security you.
just route users dashboard
urlmapping.groovy ================= "/"(controller:"dashboard", action:"indexorwhatever")
and annotate @secured annotation dashboardcontroller
Comments
Post a Comment