Grails v3.1.4 specify encrypted password for mongodb connection

135 views Asked by At
---
grails:
    mongodb:
        host: "localhost"
        port: 27017
        databaseName: "dbName"
        username: "user"
        password: "encryptedPassword"
---

How do I decrypt the password before it is used to make connection to MongoDB? The reason being that I don't need to specify plain-text password in my configuration.

1

There are 1 answers

1
Taras Kohut On

Encrypting a password is security through obscurity, and could be hacked easily. I would recommend you using either external config file or system environment variable.

Another advantage of this approach is the fact that you don't need to recompile/modify your war every time you change the password.