Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension point for credentials types #144

Open
timja opened this issue Dec 8, 2022 · 0 comments
Open

Extension point for credentials types #144

timja opened this issue Dec 8, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@timja
Copy link
Member

timja commented Dec 8, 2022

What feature do you want to see added?

Credentials providers types are currently hardcoded in the plugin, it should be an extension point so other plugins can contribute adapters:
https://github.com/jenkinsci/azure-keyvault-plugin#azure-key-vault-credentials-provider

switch (type) {
case "string": {
AzureSecretStringCredentials cred = new AzureSecretStringCredentials(getSecretName(id), "", new KeyVaultSecretRetriever(client, id));
credentials.add(cred);
break;
}
case "username": {
AzureUsernamePasswordCredentials cred = new AzureUsernamePasswordCredentials(
getSecretName(id), tags.get("username"), "", new KeyVaultSecretRetriever(client, id)
);
credentials.add(cred);
break;
}
case "sshUserPrivateKey": {
String usernameSecretTag = tags.get("username-is-secret");
boolean usernameSecret = false;
if (StringUtils.isNotBlank(usernameSecretTag)) {
usernameSecret = Boolean.parseBoolean(usernameSecretTag);
}
AzureSSHUserPrivateKeyCredentials cred = new AzureSSHUserPrivateKeyCredentials(
getSecretName(id), "", tags.get("username"), usernameSecret, new KeyVaultSecretRetriever(client, id)
);
credentials.add(cred);
break;
}
default: {
throw new IllegalStateException("Unknown type: " + type);
}

Upstream changes

No response

@timja timja added the enhancement New feature or request label Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant