如何解决groovy.lang.MissingMethodException:由于存在OAuth2LoginConfigurer.authorizationEndpoint
由以下原因引起:org.springframework.beans.BeanInstantiationException:无法实例化[javax.servlet.Filter]:工厂方法'springSecurityFilterChain'引发了异常;嵌套异常是groovy.lang.MissingMethodException:没有方法签名:org.springframework.security.config.annotation.web.configurers.oauth2.client.OAuth2LoginConfigurer.authorizationEndpoint()适用于参数类型:()值:[]
我正在尝试使用spring-security-oauth2-client,但出现上述错误。
我正在关注此https://www.callicoder.com/spring-boot-security-oauth2-social-login-part-2/ 来实现这一点。
protected void configure(final HttpSecurity http) throws Exception {
http
.cors().configurationSource(new CorsConfigurationSource() {
@Override
public CorsConfiguration getCorsConfiguration(HttpServletRequest request) {
CorsConfiguration config = new CorsConfiguration()
config.setAllowedHeaders(Collections.singletonList("*"))
config.setAllowedMethods(Collections.singletonList("*"))
config.addAllowedOrigin("*")
config.setAllowCredentials(true)
return config
}
})
.and()
.csrf().disable()
.antMatcher("/api/**")
.exceptionHandling()
.accessDeniedHandler(accessDeniedHandler)
.authenticationEntryPoint(jwtAuthenticationEntryPoint)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/api/auth/**","/error/**",).permitAll()
.antMatchers("/auth/**","/oauth2/**").permitAll()
.antMatchers("/resources/**","/**","/css/**","/fonts/**","/js/**","/img/**").permitAll()
.antMatchers("/api*").fullyAuthenticated()
.anyRequest()
.authenticated()
.and()
http.oauth2Login()
.authorizationEndpoint()
.baseUri("/oauth2/authorize")
.authorizationRequestRepository(cookieAuthorizationRequestRepository())
.and()
.redirectionEndpoint()
.baseUri("/oauth2/callback/*")
.and()
.userInfoEndpoint()
.userService(customOAuth2UserService)
.and()
.successHandler(oAuth2AuthenticationSuccessHandler)
.failureHandler(oAuth2AuthenticationFailureHandler);
http.addFilterBefore(jwtAuthenticationFilter,UsernamePasswordAuthenticationFilter.class)
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。