认证
Http Basic认证
http.httpBasic()
.and()
.csrf().disable()
.authorizeRequests()
.antMatchers("/login.html", "/auth").permitAll()
.anyRequest().authenticated()表单认证
http.formLogin()
.loginPage("/login.html")
.loginProcessingUrl("/auth")
.usernameParameter("user")
.passwordParameter("pass")
.successHandler(bookShopAuthenticationSuccessHandler)
.failureHandler(bookShopAuthenticationFailureHandler)
.and()
.csrf().disable()
.authorizeRequests()
.antMatchers("/login.html", "/auth").permitAll()
.anyRequest().authenticated()Last updated