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

Ability to apply provider to 'quarkus.oidc.credentials.secret' configuration key #15125

Closed
rw-RobertJesionek opened this issue Feb 16, 2021 · 12 comments · Fixed by #18073
Closed
Labels
area/oidc kind/enhancement New feature or request
Milestone

Comments

@rw-RobertJesionek
Copy link

The framework provides the ability to apply credentials-provider to 'quarkus.datasource' configuration key. It works great if developer decides to store sensitive data in the key vault.

It would be great if the Open ID Connect extension supported similar feature, that could be leveraged if developer prefers to store oidc's credential secret in the vault, too.

@rw-RobertJesionek rw-RobertJesionek added the kind/enhancement New feature or request label Feb 16, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 16, 2021

/cc @pedroigor, @sberyozkin

@rw-RobertJesionek rw-RobertJesionek changed the title Ability to apply provider approach to 'quarkus.oidc.credentials.secret' configuration key Ability to apply provider to 'quarkus.oidc.credentials.secret' configuration key Feb 16, 2021
@sberyozkin
Copy link
Member

I wonder if a property initialization like this one can work:

my.secret=secret_from_vault
quarkus.oidc.credential.secret=${my.secret}

@vsevel Hi Vincent, I recall we were talking awhile back about something similar ? Also CC @radcortez

@vsevel
Copy link
Contributor

vsevel commented Feb 17, 2021

it is more:

quarkus.vault.secret-config-kv-path=path/in/vault
...
quarkus.oidc.credential.secret=${my.secret}

with path/in/vault containing key my.secret
the only thing that is not supported is the Credentials Povider approach. this means that you can not use a store that is not accessible through the MP config source approach. but the vault being also a config source, you can definitely fetch the password from the vault as you have shown.

but yes it works. there is nothing specific here. is this what you mean?

@sberyozkin
Copy link
Member

@vsevel thanks Vincent; I see, yes, in this specific case getting my.secret as you have shown should be sufficient as the issue is about fetching it from Vault.
@robertjesionek can you please try something similar to what @vsevel typed above ?
thanks

@rw-RobertJesionek
Copy link
Author

rw-RobertJesionek commented Feb 17, 2021

That does not work for me. I do not use a built-in vault extension. I am interacting with Azure Key Vault through their dedicated Java SDK: https://docs.microsoft.com/en-us/azure/key-vault/secrets/quick-create-java

@vsevel
Copy link
Contributor

vsevel commented Feb 17, 2021

there are 2 solutions:

  1. implement the credentials provider pattern for the azure key vault (as a quarkus extension, or an app specific module) and support it in the oidc extension
  2. implement an azure key vault config source

@sberyozkin
Copy link
Member

@robertjesionek I see; I'm pretty sure I've seen a blog post somewhere showing how the Azure key Vault values can be exposed as MP configuration properties, using a custom ConfigSource. CC @radcortez Hi Roberto - do you recall seeing it ?

@sberyozkin
Copy link
Member

@sberyozkin
Copy link
Member

Hi @robertjesionek @vsevel Sure, I'll keep this issue open even if ConfigSource is confirmed to work as I agree going forward it would be useful for quarkus-oidc users to have CredentialsProvider checked; I can't prioritize on it now though so hopefully the ConfigSource approach will do well in the short/medium term

@radcortez
Copy link
Member

@robertjesionek I see; I'm pretty sure I've seen a blog post somewhere showing how the Azure key Vault values can be exposed as MP configuration properties, using a custom ConfigSource. CC @radcortez Hi Roberto - do you recall seeing it ?

I guess you find it? :)

@sberyozkin
Copy link
Member

Sorry @radcortez I meant to react with a smiley but chose a confused one by mistake :-), re-reacted with thumb up :-)

@rw-RobertJesionek
Copy link
Author

FYI https://github.com/Azure/azure-microprofile/tree/master/microprofile-config-keyvault does not work.
But found a 1 liner workaround:

System.setProperty("quarkus.oidc.credentials.secret", secretClient.getSecret("secretKey"));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/oidc kind/enhancement New feature or request
Projects
None yet
4 participants