Skip to content

Commit

Permalink
Merge pull request #1323 from sberyozkin/add_oidc_token_propagation_test
Browse files Browse the repository at this point in the history
Add OIDC token propagation test with the user role token
  • Loading branch information
geoand authored Sep 5, 2023
2 parents 08e8a24 + 5524b19 commit 04a2e39
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ public void testGetNameWithAdminTokenPropagated() {
.statusCode(200)
.body(is("admin"));
}

@Test
public void testGetNameWithUserTokenPropagated() {
String userToken = getAccessToken("alice");

RestAssured.given().auth().oauth2(userToken)
.when().get("/frontend/user-name-with-propagated-token")
.then()
.statusCode(200)
.body(is("alice"));

RestAssured.given().auth().oauth2(userToken)
.when().get("/frontend/admin-name-with-propagated-token")
.then()
.statusCode(403);
}

@Test
public void testGetNameWithOidcClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
quarkus.oidc.client-id=backend-service
quarkus.oidc.credentials.secret=secret
quarkus.keycloak.devservices.realm-path=quarkus-realm.json
quarkus.keycloak.devservices.grant.type=client

# DEBUG console logging
quarkus.log.console.enable=true
Expand All @@ -18,3 +19,6 @@ quarkus.log.file.enable=true
#quarkus.log.category."io.quarkus.smallrye.jwt".level=TRACE
#quarkus.log.category."io.undertow.request.security".level=TRACE
#quarkus.log.category."io.smallrye.jwt".level=TRACE

quarkus.log.category."io.quarkus.oidc.runtime.OidcProvider".level=TRACE
quarkus.log.category."io.quarkus.oidc.runtime.OidcProvider".min-level=TRACE

0 comments on commit 04a2e39

Please sign in to comment.