angularjs - Give public privilege to login.html page with spring security -
i integrated angularjs template (sb admin angular) spring boot front-end application (the output of 'grunt built' command ). trying set login.html page privileges public. code used (not working)
@configuration @order(securityproperties.access_override_order) public class websecurityconfig extends websecurityconfigureradapter { @override protected void configure(httpsecurity http) throws exception { http .httpbasic().and().authorizerequests() .antmatchers("/","/index.html","/views/pages/login.html") .permitall().anyrequest().authenticated(); } }
whenever go http://localhost:8080/#/login browser's window shows telling me spring boot demands username , pass. need know mistake did.
this project structure
again, if ever wanted explore template , see how ui-router used in template : http://startangular.com/product/sb-admin-angular-theme/
npm install grunt build create dist directory contains template.
i think have login issue , cerdential not passed in application.
use formlogin
.
@override protected void configure(httpsecurity http) throws exception { http .httpbasic().and().authorizerequests() .antmatchers("/","/index.html","/views/pages/login.html") .permitall() .anyrequest().authenticated() .and() .formlogin() .successhandler(new authenticationsuccesshandler() { @override public void onauthenticationsuccess( httpservletrequest request, httpservletresponse response, authentication a) throws ioexception, servletexception { //to change body of generated methods, response.setstatus(httpservletresponse.sc_ok); } }) .failurehandler(new authenticationfailurehandler() { @override public void onauthenticationfailure( httpservletrequest request, httpservletresponse response, authenticationexception ae) throws ioexception, servletexception { response.setstatus(httpservletresponse.sc_unauthorized); } }) .loginprocessingurl("/access/login") .and() .logout() .logouturl("/access/logout") .logoutsuccesshandler(new logoutsuccesshandler() { @override public void onlogoutsuccess( httpservletrequest request, httpservletresponse response, authentication a) throws ioexception, servletexception { response.setstatus(httpservletresponse.sc_no_content); } }) }
Comments
Post a Comment