Package com.totvs.tjf.autoconfigure
Class WebSecurityAutoConfiguration
- java.lang.Object
-
- org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter
-
- com.totvs.tjf.autoconfigure.WebSecurityAutoConfiguration
-
- All Implemented Interfaces:
org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurer
@Configuration @EnableResourceServer public class WebSecurityAutoConfiguration extends org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter
Implementation of theResourceServerConfigurerAdapter
.The OAuth2 Resource Servers, enabling a Spring Security filter protected by OAuth2 security.
- Author:
- Roger Steuernagel
-
-
Constructor Summary
Constructors Constructor Description WebSecurityAutoConfiguration(org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties resourceServerProperties, SecurityAccessApiProperties securityAccessApiProperties, SecurityCorsProperties securityCorsProperties)
The ResourceServerProperties is a shortcut to the Oauth2 settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
Endpoint security configurationvoid
configure(org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer resources)
Configures the resourceId, is used in the JWT validation of the request.org.springframework.web.cors.CorsConfigurationSource
corsConfigurationSource()
Setup CORS configurations used by Fluig AppsCustomJwtAccessTokenConverter
customJwtAccessTokenConverter(com.fasterxml.jackson.databind.ObjectMapper mapper, TenantConverter tenantConverter)
Setup aCustomJwtAccessTokenConverter
for RACorg.springframework.security.oauth2.provider.token.TokenStore
jwkUrisTokenStore(TenantConverter tenantConverter)
Setup aTokenStore
that has the specific convert to understand the RAC/KEYCLOAK JWT.org.springframework.security.oauth2.provider.token.TokenStore
jwkUriTokenStore(TenantConverter tenantConverter)
Setup aTokenStore
that has the specific convert to understand the RAC/KEYCLOAK JWT.TenantConverter
tenantConverter(com.fasterxml.jackson.databind.ObjectMapper mapper, SecurityAccessApiProperties properties)
-
-
-
Constructor Detail
-
WebSecurityAutoConfiguration
public WebSecurityAutoConfiguration(org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties resourceServerProperties, SecurityAccessApiProperties securityAccessApiProperties, SecurityCorsProperties securityCorsProperties)
The ResourceServerProperties is a shortcut to the Oauth2 settings.- Parameters:
resourceServerProperties
- Configuration properties for OAuth2 Resources.
-
-
Method Detail
-
configure
public void configure(org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer resources) throws Exception
Configures the resourceId, is used in the JWT validation of the request.- Specified by:
configure
in interfaceorg.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurer
- Overrides:
configure
in classorg.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter
- Parameters:
resources
- configurer for the resource server.- Throws:
Exception
-
configure
public void configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http) throws Exception
Endpoint security configuration- Specified by:
configure
in interfaceorg.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurer
- Overrides:
configure
in classorg.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter
- Parameters:
http
- the current http filter configuration.- Throws:
Exception
-
corsConfigurationSource
@Bean @ConditionalOnProperty(prefix="security.cors", name="enabled") public org.springframework.web.cors.CorsConfigurationSource corsConfigurationSource()
Setup CORS configurations used by Fluig Apps- Returns:
- CorsConfigurationSource
-
customJwtAccessTokenConverter
@Bean public CustomJwtAccessTokenConverter customJwtAccessTokenConverter(com.fasterxml.jackson.databind.ObjectMapper mapper, TenantConverter tenantConverter)
Setup aCustomJwtAccessTokenConverter
for RAC- Parameters:
mapper
- Object mapper used to convert map to json token.- Returns:
- standard
CustomJwtAccessTokenConverter
instance to be used by the application.
-
jwkUriTokenStore
@Bean @ConditionalOnProperty(prefix="security.oauth2.resource.jwk", value="key-set-uri", matchIfMissing=false) public org.springframework.security.oauth2.provider.token.TokenStore jwkUriTokenStore(TenantConverter tenantConverter)
Setup aTokenStore
that has the specific convert to understand the RAC/KEYCLOAK JWT.The Bean is only created when there is a property with the JWKS URL (RAC)
- Returns:
- standard
JwkTokenStore
instance to be used by the application.
-
jwkUrisTokenStore
@Bean @ConditionalOnProperty(prefix="security.access.api", value="jwk-uris[0]", matchIfMissing=false) public org.springframework.security.oauth2.provider.token.TokenStore jwkUrisTokenStore(TenantConverter tenantConverter)
Setup aTokenStore
that has the specific convert to understand the RAC/KEYCLOAK JWT.The Bean is only created when there is a property with the JWKS URL (RAC)
- Returns:
- standard
JwkTokenStore
instance to be used by the application.
-
tenantConverter
@Bean public TenantConverter tenantConverter(com.fasterxml.jackson.databind.ObjectMapper mapper, SecurityAccessApiProperties properties)
-
-