我正在使用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驗證?