当前位置: 代码迷 >> 综合 >> spring oauth refresh-token出现401 或者org.springframework.security.web.authentication.preauth.PreAuthent
  详细解决方案

spring oauth refresh-token出现401 或者org.springframework.security.web.authentication.preauth.PreAuthent

热度:19   发布时间:2024-02-12 15:56:46.0

spring oauth refresh-token 401问题
解决:

    @Overridepublic void configure(AuthorizationServerSecurityConfigurer oauthServer) throws Exception {oauthServer.allowFormAuthenticationForClients();oauthServer.checkTokenAccess("isAuthenticated()");}

出现No AuthenticationProvider found for org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken
解决:

 PreAuthenticatedAuthenticationProvider preAuthenticatedAuthenticationProvider() {PreAuthenticatedAuthenticationProvider preAuthenticatedAuthenticationProvider = new PreAuthenticatedAuthenticationProvider();preAuthenticatedAuthenticationProvider.setPreAuthenticatedUserDetailsService(new UserDetailsByNameServiceWrapper(tbUserService));return preAuthenticatedAuthenticationProvider;}@Overrideprotected void configure(AuthenticationManagerBuilder auth) throws Exception {auth.userDetailsService(tbUserService).passwordEncoder(bCryptPasswordEncoder);auth.authenticationProvider(preAuthenticatedAuthenticationProvider());}
  相关解决方案