Quarkus: OIDC does not support environment variables

Created on 14 Nov 2019  路  1Comment  路  Source: quarkusio/quarkus

Describe the bug
Instead of configuring Quarkus in application.properties, we use environment variable according to the MicroProfile specification. However, the extension quarkus-oidc:1.0.0.CR1 does not recognized these values at start up.
This happens when running Quarkus with: ./gradlew quarkusDev.

Expected behavior
Quarkus OIDC uses values from the environment variables.

Actual behavior
Quarkus OIDC has empty values for these properties:

quarkus.oidc.auth-server-url
quarkus.oidc.public-key
quarkus.oidc.client-id
quarkus.oidc.credentials.secret

To Reproduce
Steps to reproduce the behavior:

  1. Enable quarkus-oidc
  2. Define 4 oidc properties as environment variables as:
QUARKUS_OIDC_CLIENT_ID=myclient
QUARKUS_OIDC_AUTH_SERVER_URL=http://localhost:8899/auth/realms/myrealm
QUARKUS_OIDC_PUBLIC_KEY=abdc
QUARKUS_OIDC_CREDENTIALS_SECRET=xyz
  1. You will get this error:
java.lang.RuntimeException: java.net.MalformedURLException: no protocol: /.well-known/openid-configuration
    at io.vertx.ext.auth.oauth2.impl.OAuth2API.makeRequest(OAuth2API.java:112)
    at io.vertx.ext.auth.oauth2.providers.OpenIDConnectAuth.discover(OpenIDConnectAuth.java:42)
    at io.vertx.ext.auth.oauth2.providers.KeycloakAuth.discover(KeycloakAuth.java:120)
    at io.quarkus.oidc.runtime.OidcRecorder.setup(OidcRecorder.java:49)
    at io.quarkus.deployment.steps.OidcBuildStep$setup33.deploy_0(OidcBuildStep$setup33.zig:92)
    at io.quarkus.deployment.steps.OidcBuildStep$setup33.deploy(OidcBuildStep$setup33.zig:36)
    at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:244)
    at io.quarkus.runtime.Application.start(Application.java:94)
    at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:143)
    at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:177)
    at io.quarkus.dev.DevModeMain.start(DevModeMain.java:95)
    at io.quarkus.dev.DevModeMain.main(DevModeMain.java:66)
Caused by: java.net.MalformedURLException: no protocol: /.well-known/openid-configuration
    at java.base/java.net.URL.<init>(URL.java:667)
    at java.base/java.net.URL.<init>(URL.java:563)
    at java.base/java.net.URL.<init>(URL.java:510)
    at io.vertx.ext.auth.oauth2.impl.OAuth2API.makeRequest(OAuth2API.java:93)

Environment (please complete the following information):

  • Output of uname -a or ver: Darwin Lorents-MacBook-Pro.local 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64
  • Output of java -version: OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13+33, mixed mode, sharing)
  • Quarkus version or git rev: 1.0.0.CR1

Additional context

When logging values with ConfigProvider.getConfig().getValue("quarkus.oidc.client-id", String.class) or with @ConfigProperty(name = "quarkus.oidc.client-id"), it works fine.
OIDC extension seems to use io.quarkus.runtime.annotations.ConfigItem, which does seem to work as expected with environment variables

areoidc kinbug

Most helpful comment

Fixed by #5387.

>All comments

Fixed by #5387.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MossabTN picture MossabTN  路  3Comments

halhelal picture halhelal  路  3Comments

Rashmini picture Rashmini  路  3Comments

dansiviter picture dansiviter  路  3Comments

gsmet picture gsmet  路  3Comments