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.ResourceServerConfigurerAdapterImplementation 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 voidconfigure(org.springframework.security.config.annotation.web.builders.HttpSecurity http)Endpoint security configurationvoidconfigure(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.CorsConfigurationSourcecorsConfigurationSource()Setup CORS configurations used by Fluig AppsCustomJwtAccessTokenConvertercustomJwtAccessTokenConverter(com.fasterxml.jackson.databind.ObjectMapper mapper, TenantConverter tenantConverter)Setup aCustomJwtAccessTokenConverterfor RACorg.springframework.security.oauth2.provider.token.TokenStorejwkUrisTokenStore(TenantConverter tenantConverter)Setup aTokenStorethat has the specific convert to understand the RAC/KEYCLOAK JWT.org.springframework.security.oauth2.provider.token.TokenStorejwkUriTokenStore(TenantConverter tenantConverter)Setup aTokenStorethat has the specific convert to understand the RAC/KEYCLOAK JWT.TenantConvertertenantConverter(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 ExceptionConfigures the resourceId, is used in the JWT validation of the request.- Specified by:
configurein interfaceorg.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurer- Overrides:
configurein 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 ExceptionEndpoint security configuration- Specified by:
configurein interfaceorg.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurer- Overrides:
configurein 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 aCustomJwtAccessTokenConverterfor RAC- Parameters:
mapper- Object mapper used to convert map to json token.- Returns:
- standard
CustomJwtAccessTokenConverterinstance 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 aTokenStorethat 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
JwkTokenStoreinstance 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 aTokenStorethat 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
JwkTokenStoreinstance to be used by the application.
-
tenantConverter
@Bean public TenantConverter tenantConverter(com.fasterxml.jackson.databind.ObjectMapper mapper, SecurityAccessApiProperties properties)
-
-