Comments (3)
I did it:
private static final String ENVIRONMENT_VALUE_PREFIX = "systemEnvironment[";
private static final String ENVIRONMENT_VALUE_SUFFIX = "]";
@Bean
public static StringEncryptor stringEncryptor(final Environment environment) {
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
config.setPassword(getEnvProperty(getRequiredProperty(environment, "jasypt.encryptor.password")));
config.setAlgorithm(getProperty(environment, "jasypt.encryptor.algorithm", "PBEWithMD5AndDES"));
config.setKeyObtentionIterations(getProperty(environment, "jasypt.encryptor.keyObtentionIterations", "1000"));
config.setPoolSize(getProperty(environment, "jasypt.encryptor.poolSize", "1"));
// according Jasypt documentation, if no provider name is explicitly set, the default JVM provider will be used.
config.setProviderName(getProperty(environment, "jasypt.encryptor.providerName", null));
config.setSaltGeneratorClassName(getProperty(environment, "jasypt.encryptor.saltGeneratorClassname", "org.jasypt.salt.RandomSaltGenerator"));
config.setStringOutputType(getProperty(environment, "jasypt.encryptor.stringOutputType", "base64"));
encryptor.setConfig(config);
return encryptor;
}
private static String getEnvProperty(String value) {
final String trimmedValue = value.trim();
if (trimmedValue.startsWith(ENVIRONMENT_VALUE_PREFIX) &&
trimmedValue.endsWith(ENVIRONMENT_VALUE_SUFFIX)) {
return System.getenv(value.substring(ENVIRONMENT_VALUE_PREFIX.length(),
(value.length() - ENVIRONMENT_VALUE_SUFFIX.length())));
}
return value;
}
from jasypt-spring-boot.
org.springframework.context.annotation.ConfigurationClassEnhancer.intercept:350 - @bean method EnableEncryptablePropertySourcesConfiguration.enableEncryptablePropertySourcesPostProcessor is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @resource and @PostConstruct within the method's declaring @configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @bean javadoc for complete details.
from jasypt-spring-boot.
The method is in fact static, not sure why spring keeps showing the warning.
from jasypt-spring-boot.
Related Issues (20)
- I use a Gradle Project. Is this plugin just for maven project? HOT 1
- Spring RabbitMQ credentials can't be encrypted
- Create custom encryptor bean with an error HOT 4
- Password rotation possibility HOT 4
- jasypt-spring-boot 3.0.5 doesn't work with spring boot 2.3.12.RELEASE HOT 1
- Multiple property decryption
- proxy-property-sources=true causes ClassCastException HOT 1
- [BUG] in springboot 2.0.3,the "spring.config.name" properties lose efficacy
- JASYPT fails to bind properties 'spring.datasource.password' while using with ENC() HOT 1
- Is there an unresolvable circular reference HOT 3
- 3.x.x 以后可以自定义加密器吗,配置jasypt.encryptor.bean的方式
- GraalVM native app startup with errors. HOT 1
- Windows and Linux compatibility issues HOT 3
- AES256GCM, Base64 decod of key file failed...
- StackOverflowError with SpringBoot 3.1.5 and jasypt-spring-boot-starter 3.0.5 with ${cors.origins.allowed:#{http://localhost:4200}} HOT 2
- jasypt not decrypting already encrypted property (i.e in application.properties file) in xml based configuration spring boot project HOT 3
- Usage of StandardEncryptableEnvironment with additional active profile(s) and custom prefix and suffix breaks decryption
- String Encryptor custom Bean not found with name 'jasyptStringEncryptor' after upgrading to AWS CLOUD Spring3(implementation platform("io.awspring.cloud:spring-cloud-aws-dependencies:3.0.4)
- Source code to refer in order to understanding how jasypt able to "intercept" and "massage" the configuration value
- NoSuchAlgorithmException: SHA1PRNG SecureRandom not available HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasypt-spring-boot.