Package es.kukenan.smartfi.common.config
Class ApplicationConfig
java.lang.Object
es.kukenan.smartfi.common.config.ApplicationConfig
@Configuration
@Import({ContextPropagationProperties.class,RequestContextManager.class,JwtProperties.class,BeanValidationConfig.class,LdapUtils.class,JwtServiceImpl.class,ServletWebApplicationConfig.class,EntityPatcher.class})
@RefreshScope
public class ApplicationConfig
extends Object
Base class for application configuration. Should be used in any service.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGlobal json object mapper bean.Global Rest template factory bean.totpGenerator(String secretKey, Integer validTimeInSeconds) Global TOTP generator, only present if a secret key is defined.
-
Constructor Details
-
ApplicationConfig
public ApplicationConfig()
-
-
Method Details
-
customObjectMapper
Global json object mapper bean. It is already configured to (de)serialize java8 date and datetime formats as ISO 8601 string date.- Returns:
- the
CustomObjectMapper.
-
restTemplateFactory
Global Rest template factory bean.- Returns:
- global
RestTemplateFactory.
-
totpGenerator
@Bean @ConditionalOnProperty("otp.secretKey") public TotpGenerator totpGenerator(@Value("${otp.secretKey}") String secretKey, @Value("${otp.validTimeInSeconds}") Integer validTimeInSeconds) Global TOTP generator, only present if a secret key is defined.- Parameters:
secretKey- the secret key. This should be a String containing the key and should NOT be Base32 encoded. However: the key added to Google Authenticator SHOULD be Base32 encoded. So plaintext key in this method. Same key encoded with Base32 in Google Authenticator.validTimeInSeconds- Key validation time in seconds. When unsure: use 30 (default for Google Authenticator).- Returns:
- TOTP generator.
-