ZenHarbinger / grails-jasypt

Grails Jasypt Plugin
Apache License 2.0
21 stars 3 forks source link

Config values from application.groovy and runtime.groovy not overriding values from yml #11

Closed dano-giftbit closed 4 years ago

dano-giftbit commented 4 years ago

I'm having issue applying any jasypt config outside of the application.yml in Grails 3.3.10

I have the following config block in my application.yml

jasypt:
  algorithm: "PBEWITHSHA256AND256BITAES-CBC-BC"
  providerName: "BC"
  password: "-"
  keyObtentionIterations: 10

Which is supposed to be overridden by dynamic values in runtime.groovy

jasypt {
    algorithm = SecureKeyConfig.getInstance().jasypt.algorithm
    providerName = SecureKeyConfig.getInstance().jasypt.providerName
    password = SecureKeyConfig.getInstance().jasypt.password
    keyObtentionIterations = SecureKeyConfig.getInstance().jasypt.keyObtentionIterations
}

When I debug and output the config block I get the default password of - and decryption fails on previously set values

As well if I move the application.yml config to the application.groovy I get the following error?

org.jasypt.exceptions.EncryptionInitializationException: If "encryptorRegisteredName" is not specified, then "password" (and optionally "algorithm" and "keyObtentionIterations") must be specified

plugin v 2.0.2 with Grails 3.3.10 (hibernate5, gorm 6.1)

dano-giftbit commented 4 years ago

Appears to be a grails groovy configs in not overriding yml config values in general. I ended up creating a separate jayspt config file and am applying it manually to override the yml values