I have an app, that should prefill login form with variables grabbed from URL. My security config:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/", "/home").access("hasRole('USER') or hasRole('ADMIN') or hasRole('MANAGER')")
.antMatchers("/admin/**").access("hasRole('ADMIN') or hasRole('MANAGER')")
.and().formLogin().loginPage("/login")
.loginProcessingUrl("/login").usernameParameter("username").passwordParameter("password")
.and().rememberMe().rememberMeParameter("remember-me").tokenRepository(tokenRepository)
.tokenValiditySeconds(90*24*60*60).and().csrf().and().exceptionHandling().accessDeniedPage("/Access_Denied");
}
And when I tried to access app with url: "app.com/home"
I'm getting app.com/login and of course form is empty
So, I need to be able to get user from his identifier passed with such URL: app.com/home?user=test1 and pass this user to my custom login form:
But at the moment I can't get it - how can I get this path variable in code, and where can I get it.
/loginto a controller method handler which should returns your login page then process in that handler to add what you want in the model then retrieve data in your page.