angularjs - ui.router + spring security - redirect upon required log in -
i'm building mvc web application using spring-security securing app , angular.js clent side framework.
ui.router changes content of page depanding on selected state. problem starts when user tries select page referring page lacks privilages access, spring returns login page, , ui.router inserts login page body of page.
what do, redirect login page if login required instead of inserting current page.
how can acheive that?
i created 2 different angular modules, , each module had own routing.
the 2 angular modules are:
1) loginmodule (with own ui-router configuration, es. login, retrieve password, forgot password , on...)
2) securedmodule: authenticated part
i created 2 main pages entry point each ui-router
/signin -> signin.html -> (loginmodule) -> ui-routing login
/secured -> secured.html -> (securedmodule) -> ui-routing secure
now can configure un spring configuration , assign /signin login page , path /secured authenticated.
here spring security configuration:
.antmatchers("/secured").hasauthority("sp_light") .and().formlogin().loginpage("/signin")