赞
踩
访问的url
http://localhost:8080/oauth/authorize?response_type=code&client_id=client&redirect_uri=http://www.baidu.com&scope=all
修改继承WebSecurityConfigurerAdapter类中的protected void configure(HttpSecurity http)方法
旧的
@Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Bean public PasswordEncoder passwordEncoder () { return new BCryptPasswordEncoder(); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests(request -> request.antMatchers("/oauth/**", "/login/**", "/logout/**") .permitAll() .anyRequest().authenticated() ).csrf(AbstractHttpConfigurer::disable); } }
新的
@Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Bean public PasswordEncoder passwordEncoder () { return new BCryptPasswordEncoder(); } @Override protected void configure(HttpSecurity http) throws Exception { http.formLogin().and().authorizeRequests(request -> request.antMatchers("/oauth/**", "/login/**", "/logout/**") .permitAll() .anyRequest().authenticated() ).csrf(AbstractHttpConfigurer::disable); } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。