我正在使用Spring Security根据角色对用户进行身份验证。对于身份验证是/**
给予:不显示我能够在Spring Security中进行身份验证?
Page load failed with error: too many HTTP redirects
错误和登录页面。
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/login*").authenticated()
.antMatchers("/**").authenticated()
.and()
.formLogin().loginPage("/login").failureUrl("/login?error").defaultSuccessUrl("/welcome")
.usernameParameter("username").passwordParameter("password")
.and()
.logout().logoutSuccessUrl("/login?logout").logoutUrl("/login?logout")
.and()
.exceptionHandling().accessDeniedPage("/accessDenied")
.and()
.csrf();
}
但如果我这样做:
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/login").authenticated()
.antMatchers("/").authenticated()
.and()
.formLogin().loginPage("/login").failureUrl("/login?error").defaultSuccessUrl("/welcome")
.usernameParameter("username").passwordParameter("password")
.and()
.logout().logoutSuccessUrl("/login?logout").logoutUrl("/login?logout")
.and()
.exceptionHandling().accessDeniedPage("/accessDenied")
.and()
.csrf();
}
有什么错此代码为/**
URL验证?