Oauth2 访问oauth/authorize/**出现 403
问题: Oauth2 访问oauth/authorize/**出现 403访问的urlhttp://localhost:8080/oauth/authorize?response_typecodeclient_idclientredirect_urihttp://www.baidu.comscopeall解决方案修改继承WebSecurityConfigurerAdapter类中的protected void configure(HttpSecurity http)方法旧的ConfigurationEnableWebSecuritypublicclassSecurityConfigextendsWebSecurityConfigurerAdapter{BeanpublicPasswordEncoderpasswordEncoder(){returnnewBCryptPasswordEncoder();}Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http.authorizeRequests(request-request.antMatchers(/oauth/**,/login/**,/logout/**).permitAll().anyRequest().authenticated()).csrf(AbstractHttpConfigurer::disable);}}新的ConfigurationEnableWebSecuritypublicclassSecurityConfigextendsWebSecurityConfigurerAdapter{BeanpublicPasswordEncoderpasswordEncoder(){returnnewBCryptPasswordEncoder();}Overrideprotectedvoidconfigure(HttpSecurityhttp)throwsException{http.formLogin().and().authorizeRequests(request-request.antMatchers(/oauth/**,/login/**,/logout/**).permitAll().anyRequest().authenticated()).csrf(AbstractHttpConfigurer::disable);}}