Join GitHub today
Store encrypted password #157
Secret.fromString() can take both plain text and encrypted text. And Secret instance keeps plain(decrypted) data. So this code can read old password.
In ConfigTest, existing test gives plain text password. Added testGetGerritAuthKeyFilePasswordFromEncryptedString() gives encrypted ones. both works fine.
So we can reuse the same field even if change type because stored data in config.xml has no type information.
If any concern, Please read Secret.java in core:
Now new patch is uploaded. To create Config instance, Jenkins instance is also needed. But I forgot to add it to some test classes. Sorry...
But ClassCastException was raised even if Jenkins instance is added. it was caused by powermock. So adds annotation PowerMockIgnore for javax.crypto.*.