Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OIDC token propagation test with the user role token #1323

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading