开发者

Spring Boot Oauth Authentication Rememberme

开发者 https://www.devze.com 2022-12-07 22:05 出处:网络
im implementing spring boot with oauth authentication agains Google, this part is working well but now im trying to implement remember me functionality but im finding quite hard as there is no documen

im implementing spring boot with oauth authentication agains Google, this part is working well but now im trying to implement remember me functionality but im finding quite hard as there is no documentation available, the following configuration is given me some errors in my security config

Note: I modified already the oauth object to always return the refresh token.

@Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeRequests()
        .antMatchers("/resources/**").permitAll()
         .anyRequest().authenticated()
         .and()
         .oauth2Login(oauth2 -> oauth2
                                .authorizationEndpoint()
                                .authorizationRequestResolver(
                                        new Oauth2AuthorizationProvider(
                                        this.clientRegistrationRepository)))
         .rememberMe();
        return http.build();

}

ERROR: rg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterChain' defined in class path resource [com/starter/jetpathhub/demo/config/Securi开发者_Python百科tyConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.web.SecurityFilterChain]: Factory method 'filterChain' threw exception; nested exception is java.lang.IllegalStateException: userDetailsService cannot be null. Invoke RememberMeConfigurer#userDetailsService(UserDetailsService) or see its javadoc for alternative approaches.

Im expecting for the remember me configuration to work with oauth authentication as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消