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)
    }

错误登录给定图片

enter image description here

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...