feat: resource-server-demo 适配 Spring Authorization Server

This commit is contained in:
zlt2000
2024-03-05 17:52:07 +08:00
parent fdb97c4c3a
commit ed1fdb06d5
2 changed files with 4 additions and 5 deletions
@@ -45,7 +45,7 @@ public class DefaultResourceServerConf {
private AccessDeniedHandler oAuth2AccessDeniedHandler; private AccessDeniedHandler oAuth2AccessDeniedHandler;
@Bean @Bean
public SecurityFilterChain springSecurityFilterChain(HttpSecurity http) throws Exception { public SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests(authorizeRequests -> { http.authorizeHttpRequests(authorizeRequests -> {
AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizedUrl authorizedUrl = authorizeRequests AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizedUrl authorizedUrl = authorizeRequests
.requestMatchers(HttpMethod.OPTIONS).permitAll() .requestMatchers(HttpMethod.OPTIONS).permitAll()
@@ -1,7 +1,7 @@
package org.zlt.config; package org.zlt.config;
import com.central.oauth2.common.config.DefaultResourceServerConf;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
/** /**
* security资源服务器配置 * security资源服务器配置
@@ -13,7 +13,6 @@ import org.springframework.context.annotation.Configuration;
* Blog: http://zlt2000.gitee.io * Blog: http://zlt2000.gitee.io
* Github: https://github.com/zlt2000 * Github: https://github.com/zlt2000
*/ */
/*@Configuration @Configuration
@EnableResourceServer
public class MyResourceConfig extends DefaultResourceServerConf { public class MyResourceConfig extends DefaultResourceServerConf {
}*/ }