Skip to content

Commit

Permalink
Merge pull request #36 from kouddy/userpass-auth-mount-path
Browse files Browse the repository at this point in the history
Added support to specify Userpass Auth method's mount name
  • Loading branch information
ltamaster authored Nov 19, 2021
2 parents 651618b + 6cd46a2 commit 5dcbc3f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ConfigOptions {
static final String VAULT_TRUST_STORE_FILE = "trustStoreFile";
static final String VAULT_CLIENT_PEM_FILE = "clientPemFile";
static final String VAULT_CLIENT_KEY_PEM_FILE = "clientKeyPemFile";
static final String VAULT_USERPASS_AUTH_MOUNT = "userpassAuthMount";
static final String VAULT_USERNAME = "username";
static final String VAULT_PASSWORD = "password";
static final String VAULT_GITHUB_TOKEN = "githubToken";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ static Description getDescription() {
.required(true)
.defaultValue("true")
)
.property(PropertyBuilder.builder()
.string(VAULT_USERPASS_AUTH_MOUNT)
.title("Userpass Mount name")
.description("The mount name of the Userpass authentication back end")
.defaultValue("userpass")
)
.property(PropertyBuilder.builder()
.string(VAULT_USERNAME)
.title("User name")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ private String getVaultAuthToken() throws ConfigurationException {
break;

case USERPASS:
final String vaultUserpassAuthMount = configuration.getProperty(VAULT_USERPASS_AUTH_MOUNT);
final String vaultUsername = configuration.getProperty(VAULT_USERNAME);
final String vaultPassword = configuration.getProperty(VAULT_PASSWORD);
if (vaultUsername == null || vaultPassword == null) {
Expand All @@ -222,7 +223,7 @@ private String getVaultAuthToken() throws ConfigurationException {

try {
authToken = vaultAuth
.loginByUserPass(vaultUsername, vaultPassword)
.loginByUserPass(vaultUsername, vaultPassword, vaultUserpassAuthMount)
.getAuthClientToken();

} catch (VaultException e) {
Expand Down

0 comments on commit 5dcbc3f

Please sign in to comment.