Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of springboot2 Integrated oauth2

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about the example analysis of springboot2 integration oauth2, many people may not know much about it. In order to make you understand better, the editor summarizes the following content for you. I hope you can get something according to this article.

@ EnableOAuth3Client annotation and customized the relevant configuration

@ Bean public FilterRegistrationBean oauth3ClientFilterRegistration (OAuth3ClientContextFilter filter) {FilterRegistrationBean registration = new FilterRegistrationBean (); registration.setFilter (filter); registration.setOrder (- 100); return registration;} @ Bean @ ConfigurationProperties ("security.oauth3") public ClientResources trina () {return new ClientResources ();}

The following error will be reported after startup:

Description:The bean 'scopedTarget.oauth3ClientContext', defined in class path resource [org/springframework/boot/autoconfigure/security/oauth3/client/OAuth3RestOperationsConfiguration$SessionScopedConfiguration$ClientContextConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/security/oauth3/config/annotation/web/configuration/OAuth3ClientConfiguration$OAuth3ClientContextConfiguration.class] and overriding is disabled.Action:

There are two solutions: 1. Get rid of autoconfig dependence on spring-security-oauth3-autoconfigure 2 and use @ EnableAutoConfiguration to eliminate oauth3-related auto-assembly, which depends on the specific error message. As follows:

@ EnableAutoConfiguration (exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class})

3. Add configuration spring.main.allow-bean-definition-overriding = true

After reading the above, do you have any further understanding of the example analysis of springboot2 integrated oauth2? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report