Named oidc-client configuration from .env file is null
See original GitHub issueDescribe the bug
I’m creating an named oidc-client in my application and the configuration come from a .env
file. When quakus starts the config properties are loaded correctly but the injected client is null
, same when injecting OidcClients
, there’s no client inside. The exact same configuration in application.properties
file is working fine. If the client is not a named one, it seem’s to work, but the grant types are not defined, i didn’t dig more on it because that’s what I saw when creating the reproduction.
Expected behavior
The injected OidcClient
from .env
configurations is not null.
Actual behavior
The injected OidcClient
from .env
configurations is null.
How to Reproduce?
Steps to reproduce:
- Create a named oidc-client configuration in
.env
- Inject the
OidcClient
Reproducer: https://github.com/Sirz3chs/quarkus-oidc-client-env-issue
Output of uname -a
or ver
Linux 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of java -version
OpenJDK Runtime Environment Temurin-17+35 (build 17+35)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.13.4.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Additional information
The issue is still reproductible in 2.14.0.Final. I’ve foud two closed issues that may be related #14480 #24078
Issue Analytics
- State:
- Created 10 months ago
- Reactions:2
- Comments:6 (4 by maintainers)
Hi @radcortez Thanks for the advice,
quarkus.oidc-client.env-client.auth-server-url=${QUARKUS_OIDC_CLIENT__ENV_CLIENT__AUTH_SERVER_URL}
Looks OK to me, and @Sirz3chs has confirmed it works. I can work on a doc PR adding a note to the config docs and to OIDC docs to clarify https://github.com/quarkusio/quarkus/issues/29325#issuecomment-1322078347
Yes, most likely, this is related to the ENV rules: https://quarkus.io/guides/config-reference#environment-variables
Which links to: https://smallrye.io/smallrye-config/2.12.1/config/environment-variables/
The issue is that when you have an ENV var like
QUARKUS_OIDC_CLIENT__ENV_CLIENT__CLIENT_ID
, without anymore information and whereENV_CLIENT
is a name (dynamically generated by the user), we don’t know if the_
should map to a.
or a-
. It could be:quarkus.oidc.client.env.client.client.id
quarkus.oidc.client.env-client.client.id
To disambiguate the case, we require to place the expected property name
quarkus.oidc.client.env-client.client.id
in a lower ordinal source. It can beapplication.properties
and it can be empty because the ENV var will override it.