How do I configure OAuth 2.0 in Spring Security and which package is responsible for what?

I am studying Spring Security and in particular I have reached OAuth 2.0. I have a complete misunderstanding and confusion about how to configure and use it in general – I mean the packages spring-security-oauth2-resource-server, spring-security-oauth2-authorization-server and spring-security-oauth2-client.

It will be very verbose to try to give specific examples of what I don’t understand, so I’ll just formulate four questions:

  1. What is the difference between the listed modules and when to use which one?
  2. Let’s say there is a task: you need to write a server where registration and authorization will be possible, and then issue your own JWT token with which you can use the REST API through the Authorization header and, in essence, it is solved plus or minus in the simplest way (the controller methods themselves, creating a JWT and signing it using RSA keys it is omitted here, because too much unnecessary code will come out):
    @Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http, Converter<Jwt, UsernamePasswordAuthenticationToken> converter) throws Exception {
    http
            .authorizeHttpRequests(authorize ->
                    authorize
                            .requestMatchers(
                                    "/api/" + apiVersion + "/auth/register",
                                    "/api/" + apiVersion + "/auth/login"
                            )
                            .permitAll()
                            .anyRequest()
                            .authenticated()
            )
            .csrf(AbstractHttpConfigurer::disable)
            .cors(AbstractHttpConfigurer::disable)
            .httpBasic(AbstractHttpConfigurer::disable)
            .oauth2ResourceServer(configurer ->
                    configurer.
                            jwt((jwt) -> jwt.jwtAuthenticationConverter(converter))
            )
            .sessionManagement(configurer ->
                    configurer
                            .sessionCreationPolicy(SessionCreationPolicy.STATELESS))
            .exceptionHandling(configurer ->
                    configurer
                            .authenticationEntryPoint(new BearerTokenAuthenticationEntryPoint())
                            .accessDeniedHandler(new BearerTokenAccessDeniedHandler())
            );
    return http.build();
}
*that is, we just created a resource server and thanks to it we have a BearerTokenAuthenticationFilter in the filter chain, which will now convert and verify our token. But here comes the task: the customer wants to add the ability to release and use login via GitHub and Google in our application, and later Apple, but at the same time maintain the login functionality using their own JWT token. **In this case, how do I configure OAuth 2.0?***
  1. The next question concerns the implementation of any lesser-known systems. Let’s say YooMoney. It has a standard-compliant OAuth login mechanism using authorization_code. How do I add it to the configuration? By the way, as for YooMoney, here the token is needed to interact with their API in the future, and not to authorize the application, so you cannot log into applications using this token – you just need to intercept it and save it to the database.
  2. Well, the last question, or rather even a clarification: I am interested in a stateless system, i.e. SessionCreationPolicy.STATELESS

It has already been described in detail

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật