@Configuration(proxyBeanMethods=false) @EnableGlobalMethodSecurity(prePostEnabled=true) @EnableConfigurationProperties(value=OAuth2ResourceServerProperties.class) public class OAuth2ResourceServerAutoConfiguration extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
OAUTH2_RESOURCE_SERVER_SECURITY_FILTER_CHAIN_BEAN_NAME |
| 构造器和说明 |
|---|
OAuth2ResourceServerAutoConfiguration() |
| 限定符和类型 | 方法和说明 |
|---|---|
org.springframework.security.web.AuthenticationEntryPoint |
authenticationEntryPoint()
自定义异常处理
|
org.springframework.security.oauth2.server.resource.web.BearerTokenResolver |
bearerTokenResolver()
BearTokenResolve 允许使用 url 传参,方便 ws 连接 ps: 使用 url 传参不安全,待改进
|
CustomPermissionEvaluator |
customPermissionEvaluator()
自定义的权限判断组件
|
org.springframework.security.web.SecurityFilterChain |
oauth2ResourceServerSecurityFilterChain(Oauth2ResourceServerSecurityFilterChainBuilder builder,
org.springframework.security.config.annotation.web.builders.HttpSecurity httpSecurity)
OAuth2 授权服务器的安全过滤器链,如果和资源服务器共存,需要将其放在资源服务器之前
|
Oauth2ResourceServerSecurityFilterChainBuilder |
oauth2ResourceServerSecurityFilterChainBuilder(OAuth2ResourceServerProperties oAuth2ResourceServerProperties,
org.springframework.security.web.AuthenticationEntryPoint authenticationEntryPoint,
org.springframework.security.oauth2.server.resource.web.BearerTokenResolver bearerTokenResolver,
org.springframework.beans.factory.ObjectProvider<List<OAuth2ResourceServerConfigurerCustomizer>> configurerCustomizersProvider,
org.springframework.beans.factory.ObjectProvider<List<OAuth2ResourceServerExtensionConfigurer<org.springframework.security.config.annotation.web.builders.HttpSecurity>>> extensionConfigurersProvider)
资源服务器的过滤器链构建器
|
org.springframework.security.oauth2.server.resource.authentication.OpaqueTokenAuthenticationProvider |
opaqueTokenAuthenticationProvider(org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector opaqueTokenIntrospector)
spring-security 5.x 中开启资源服务器功能,需要的不透明令牌的支持
|
org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector |
opaqueTokenIntrospector(OAuth2ResourceServerProperties oAuth2ResourceServerProperties)
当资源服务器和授权服务器的 token 存储无法共享时,通过远程调用的方式,向授权服务鉴定 token,并同时获取对应的授权信息
|
@Bean
@ConditionalOnMissingBean(name="oauth2ResourceServerSecurityFilterChain",
value=Oauth2ResourceServerSecurityFilterChainBuilder.class)
public Oauth2ResourceServerSecurityFilterChainBuilder oauth2ResourceServerSecurityFilterChainBuilder(OAuth2ResourceServerProperties oAuth2ResourceServerProperties,
org.springframework.security.web.AuthenticationEntryPoint authenticationEntryPoint,
org.springframework.security.oauth2.server.resource.web.BearerTokenResolver bearerTokenResolver,
org.springframework.beans.factory.ObjectProvider<List<OAuth2ResourceServerConfigurerCustomizer>> configurerCustomizersProvider,
org.springframework.beans.factory.ObjectProvider<List<OAuth2ResourceServerExtensionConfigurer<org.springframework.security.config.annotation.web.builders.HttpSecurity>>> extensionConfigurersProvider)
@Bean(name="oauth2ResourceServerSecurityFilterChain") @Order(value=99) @ConditionalOnMissingBean(name="oauth2ResourceServerSecurityFilterChain") public org.springframework.security.web.SecurityFilterChain oauth2ResourceServerSecurityFilterChain(Oauth2ResourceServerSecurityFilterChainBuilder builder, org.springframework.security.config.annotation.web.builders.HttpSecurity httpSecurity) throws Exception
Exception@Bean(name="per") @ConditionalOnMissingBean(value=com.hccake.ballcat.common.security.component.CustomPermissionEvaluator.class) public CustomPermissionEvaluator customPermissionEvaluator()
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix="ballcat.security.oauth2.resourceserver",
name="shared-stored-token",
havingValue="false")
public org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector opaqueTokenIntrospector(OAuth2ResourceServerProperties oAuth2ResourceServerProperties)
@Bean @ConditionalOnMissingBean public org.springframework.security.oauth2.server.resource.authentication.OpaqueTokenAuthenticationProvider opaqueTokenAuthenticationProvider(org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector opaqueTokenIntrospector)
@Bean @ConditionalOnMissingBean public org.springframework.security.web.AuthenticationEntryPoint authenticationEntryPoint()
@Bean @ConditionalOnMissingBean public org.springframework.security.oauth2.server.resource.web.BearerTokenResolver bearerTokenResolver()
Copyright © 2023. All rights reserved.