Skip to content

Keycloak Dev Services  #30138

@iskhakovt

Description

@iskhakovt

Describe the bug

Keycloak Dev Services issuer doesn't match the expected configuration:

Caused by: org.jose4j.jwt.consumer.InvalidJwtException: JWT (claims-
{"exp":1672438567,"iat":1672437967,"jti":"f3694e7b-2d19-434c-8c26-273af214b030",
"iss":"http://localhost:45713/realms/quarkus","sub":"7da16905-87c9-436d-ba43-3bcb720914aa",
"typ":"Bearer","azp":"quarkus-app","session_state":"ef58267d-1c3f-4a4e-8966-fe720b427d95",
"scope":"microprofile-jwt","sid":"ef58267d-1c3f-4a4e-8966-fe720b427d95","upn":"alice","groups":["admin","user"]})
rejected due to invalid claims or other invalid content. Additional details: [[12] Issuer (iss) claim value
(http://localhost:45713/realms/quarkus) doesn't match expected value of http://keycloak-fardw:8080/realms/quarkus]

As far as I understand, in case of using a shared network we set the keycloak host to localhost while keycloak.url resolves into keycloak-[a-zA-Z0-9]5.

Expected behavior

KEYCLOAK_QUARKUS_HOSTNAME / KEYCLOAK_WILDFLY_FRONTEND_URL is set to the shared network hostname.

Actual behavior

KEYCLOAK_QUARKUS_HOSTNAME / KEYCLOAK_WILDFLY_FRONTEND_URL is hardcoded to localhost.

How to Reproduce?

I'm using this config mainly because I didn't manage to get OidcIdentityProvider to work with ServerInterceptor for grpc (due to the lack of RoutingContext):

mp.jwt.verify.publickey.location=${keycloak.url}/realms/quarkus/protocol/openid-connect/certs
mp.jwt.verify.issuer=${quarkus.oidc.auth-server-url}
smallrye.jwt.path.groups=realm_access/roles

Output of uname -a or ver

Linux ip-172-28-46-89 5.15.0-1021-aws #25~20.04.1-Ubuntu SMP Thu Sep 22 13:59:08 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk 17.0.5 2022-10-18

GraalVM version (if different from Java)

From quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17

Quarkus version or git rev

2.15.1.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Gradle 7.4

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions