Grails 3 Spring Security override login form -
i've found few things spring documentation can override login controller , form. want override login form while keeping default controller. found this:
in grails security plugin, login gsp page located @ grails-app/views/login/auth.gsp , controller @ grails-app/controllers/grails/plugin/springsecurity/logincontroller.groovy. don't think controller can overwritten creating own implementation, should able override gsp page placing own auth.gsp in same path shown above, in app.
https://plus.google.com/117486613280979732172/posts/cvqcfaqvwe6
however, not working override page , default page keeps coming up. has done grails 3 , spring security libraries?
edit: i'm using oauth2 using these libraries , setting own beans. think other way might use grails plugins spring security. there way override login page using these libraries?
compile "org.springframework.boot:spring-boot-starter-security" compile "org.springframework.security.oauth:spring-security-oauth2:2.0.8.release"
ok, since i'm not using grails spring security plugin, needed replace login page guidance here: http://docs.spring.io/spring-security/site/docs/3.2.x/guides/form.html
essentially, had create logincontroller
class logincontroller { def auth() { } def error() { } then, placed views in respective paths: views/login/auth, views/login/error
here sample auth.gsp
<html> <body> <h1 id="banner">login security demo</h1> <form name="f" action="/login/auth" method="post"> <table> <tr> <td>username:</td> <td><input type='text' name='username' /></td> </tr> <tr> <td>password:</td> <td><input type='password' name='password'></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan='2'><input name="submit" type="submit"> <input name="reset" type="reset"></td> </tr> </table> <input type="hidden" name="${_csrf.parametername}" value="${_csrf.token}"/> </form> </body> </html> then in configuration of httpsecurity:
@override public void configure(httpsecurity http) { http .authorizerequests() .anyrequest().authenticated() .and() .formlogin() .loginpage('/login/auth') .defaultsuccessurl("/") .failureurl("/login/error") .usernameparameter("username").passwordparameter("password") .permitall() } it nice use grails security plugin couldn't figure out how use oauth2 it. if has guidance on that, i'd change accepted answer.
Comments
Post a Comment