javasecuritywildflyelytron

How to get a password from Wildfly


I have a password to some service. I need to save it in WildFly 19 and then get it in a java application.

I found a certain amount of information, but I'm not sure if it's outdated.

  1. Do I need vault?
  2. How do I write my password to the Wildfly? I found the following commands. Is this enough to save the password?
/subsystem=elytron/credential-store=test:add(relative-to=jboss.server.data.dir, location=test.jceks, create=true,credential-reference={clear-text=storepass})

/subsystem=elytron/credential-store=test:add-alias(alias=keystorepw,secret-value=secret)
  1. How do I get a password in a java application?

Solution

    1. No, vaults are a legacy tool and you should use a credential store to secure passwords.
    2. Yes, those commands should be sufficient. You can find more information in the Elytron documentation. The docs for the current Wildfly 26.1 may also be helpful.
    3. You can find an example application here.