Skip to content

Commit 5d6003e

Browse files
committed
Removes need for OIDC client
1 parent 3636ba7 commit 5d6003e

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

leaderboards/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@
8080
<artifactId>quarkus-oidc</artifactId>
8181
</dependency>
8282

83-
<dependency>
84-
<groupId>io.quarkus</groupId>
85-
<artifactId>quarkus-oidc-client</artifactId>
86-
</dependency>
87-
8883
<dependency>
8984
<groupId>io.quarkus</groupId>
9085
<artifactId>quarkus-keycloak-authorization</artifactId>

leaderboards/src/main/java/com/lunatech/leaderboard/client/graphql/lunagraph/GraphQLClients.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package com.lunatech.leaderboard.client.graphql.lunagraph;
22

3-
import io.quarkus.oidc.client.Tokens;
43
import io.smallrye.graphql.client.typesafe.api.TypesafeGraphQLClientBuilder;
4+
import org.eclipse.microprofile.jwt.JsonWebToken;
55

6-
import javax.inject.Singleton;
6+
import javax.enterprise.context.RequestScoped;
77

88
public class GraphQLClients {
99

10-
@Singleton
11-
public LunagraphApi lunagraphApi(Tokens tokens) {
10+
@RequestScoped
11+
public LunagraphApi lunagraphApi(JsonWebToken jwt) {
1212
return TypesafeGraphQLClientBuilder.newBuilder()
13-
.header("Authorization", "Bearer " + tokens.getAccessToken())
13+
.header("Authorization", "Bearer " + jwt.getRawToken())
1414
.configKey("lunagraph")
1515
.build(LunagraphApi.class);
1616
}

leaderboards/src/main/java/com/lunatech/leaderboard/controller/provider/filter/RequestFilter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ private void addUserEmailToHeader(ContainerRequestContext context) {
2828
private Optional<String> securityEmail() {
2929
return Optional.ofNullable(securityIdentity)
3030
.map(SecurityIdentity::getPrincipal)
31+
.filter(principal -> principal instanceof OidcJwtCallerPrincipal)
3132
.map(principal -> (OidcJwtCallerPrincipal) principal)
3233
.map(principal -> principal.getClaim("email"));
3334
}

leaderboards/src/main/resources/application-dev.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ quarkus:
1313
tls:
1414
verification: none
1515

16-
oidc-client:
17-
auth-server-url: http://localhost:8081/realms/Quarkus
18-
credentials:
19-
secret: secret
20-
2116
keycloak:
2217
devservices:
2318
enabled: true
@@ -27,4 +22,9 @@ quarkus:
2722
# Swagger
2823
smallrye-openapi:
2924
security-scheme-name: SecurityScheme
30-
oidc-open-id-connect-url: http://localhost:8081/realms/Quarkus/.well-known/openid-configuration
25+
oidc-open-id-connect-url: http://localhost:8081/realms/Quarkus/.well-known/openid-configuration
26+
27+
log:
28+
category:
29+
"io.quarkus.oidc":
30+
level: DEBUG

0 commit comments

Comments
 (0)