From 7a8d03522b31fcf6dbe926126cbf7a1c6ff37c89 Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Thu, 16 Nov 2023 23:44:47 +0000 Subject: [PATCH 1/9] Support custom Authorization schemes for OIDC bearer tokens --- .../io/quarkus/oidc/OidcTenantConfig.java | 14 ++++++ .../BearerAuthenticationMechanism.java | 17 +++++--- .../runtime/OidcAuthenticationMechanism.java | 5 +-- .../it/keycloak/CustomTenantResolver.java | 3 ++ .../io/quarkus/it/keycloak/UsersResource.java | 8 ++++ .../src/main/resources/application.properties | 6 +++ .../BearerTokenAuthorizationTest.java | 43 +++++++++++++++++++ 7 files changed, 87 insertions(+), 9 deletions(-) diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java index db4eea48e8d00..fb65fd82b712a 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/OidcTenantConfig.java @@ -1402,6 +1402,12 @@ public static Token fromAudience(String... audience) { @ConfigItem public Optional header = Optional.empty(); + /** + * HTTP Authorization header scheme. + */ + @ConfigItem(defaultValue = OidcConstants.BEARER_SCHEME) + public String authorizationScheme = OidcConstants.BEARER_SCHEME; + /** * Required signature algorithm. * OIDC providers support many signature algorithms but if necessary you can restrict @@ -1622,6 +1628,14 @@ public boolean isSubjectRequired() { public void setSubjectRequired(boolean subjectRequired) { this.subjectRequired = subjectRequired; } + + public String getAuthorizationScheme() { + return authorizationScheme; + } + + public void setAuthorizationScheme(String authorizationScheme) { + this.authorizationScheme = authorizationScheme; + } } public static enum ApplicationType { diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BearerAuthenticationMechanism.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BearerAuthenticationMechanism.java index 78f4f2fe978de..f6c22753ab98e 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BearerAuthenticationMechanism.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BearerAuthenticationMechanism.java @@ -1,10 +1,11 @@ package io.quarkus.oidc.runtime; +import java.util.function.Function; + import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpResponseStatus; import io.quarkus.oidc.AccessTokenCredential; import io.quarkus.oidc.OidcTenantConfig; -import io.quarkus.oidc.common.runtime.OidcConstants; import io.quarkus.security.identity.IdentityProviderManager; import io.quarkus.security.identity.SecurityIdentity; import io.quarkus.vertx.http.runtime.security.ChallengeData; @@ -15,9 +16,6 @@ public class BearerAuthenticationMechanism extends AbstractOidcAuthenticationMechanism { - protected static final ChallengeData UNAUTHORIZED_CHALLENGE = new ChallengeData(HttpResponseStatus.UNAUTHORIZED.code(), - HttpHeaderNames.WWW_AUTHENTICATE, OidcConstants.BEARER_SCHEME); - public Uni authenticate(RoutingContext context, IdentityProviderManager identityProviderManager, OidcTenantConfig oidcTenantConfig) { String token = extractBearerToken(context, oidcTenantConfig); @@ -29,7 +27,14 @@ public Uni authenticate(RoutingContext context, } public Uni getChallenge(RoutingContext context) { - return Uni.createFrom().item(UNAUTHORIZED_CHALLENGE); + Uni tenantContext = resolver.resolveContext(context); + return tenantContext.onItem().transformToUni(new Function>() { + @Override + public Uni apply(TenantConfigContext tenantContext) { + return Uni.createFrom().item(new ChallengeData(HttpResponseStatus.UNAUTHORIZED.code(), + HttpHeaderNames.WWW_AUTHENTICATE, tenantContext.oidcConfig.token.authorizationScheme)); + } + }); } private String extractBearerToken(RoutingContext context, OidcTenantConfig oidcConfig) { @@ -49,7 +54,7 @@ private String extractBearerToken(RoutingContext context, OidcTenantConfig oidcC return headerValue; } - if (!OidcConstants.BEARER_SCHEME.equalsIgnoreCase(scheme)) { + if (!oidcConfig.token.authorizationScheme.equalsIgnoreCase(scheme)) { return null; } diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java index edf944566678b..bd5c8ab18aeea 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java @@ -23,8 +23,6 @@ @ApplicationScoped public class OidcAuthenticationMechanism implements HttpAuthenticationMechanism { - private static HttpCredentialTransport OIDC_SERVICE_TRANSPORT = new HttpCredentialTransport( - HttpCredentialTransport.Type.AUTHORIZATION, OidcConstants.BEARER_SCHEME); private static HttpCredentialTransport OIDC_WEB_APP_TRANSPORT = new HttpCredentialTransport( HttpCredentialTransport.Type.AUTHORIZATION_CODE, OidcConstants.CODE_FLOW_CODE); @@ -105,7 +103,8 @@ public HttpCredentialTransport apply(OidcTenantConfig oidcTenantConfig) { return null; } return isWebApp(context, oidcTenantConfig) ? OIDC_WEB_APP_TRANSPORT - : OIDC_SERVICE_TRANSPORT; + : new HttpCredentialTransport( + HttpCredentialTransport.Type.AUTHORIZATION, oidcTenantConfig.token.authorizationScheme); } }); } diff --git a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CustomTenantResolver.java b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CustomTenantResolver.java index 1df7467d064ad..34ffd429732e1 100644 --- a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CustomTenantResolver.java +++ b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CustomTenantResolver.java @@ -44,6 +44,9 @@ public String resolve(RoutingContext context) { if (path.endsWith("bearer")) { return "bearer"; } + if (path.endsWith("bearer-id")) { + return "bearer-id"; + } if (path.endsWith("bearer-required-algorithm")) { return "bearer-required-algorithm"; } diff --git a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/UsersResource.java b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/UsersResource.java index 3e55f570cfbe9..37f4565cbca0b 100644 --- a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/UsersResource.java +++ b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/UsersResource.java @@ -29,6 +29,14 @@ public User principalName() { return new User(identity.getPrincipal().getName()); } + @GET + @Path("/me/bearer-id") + @RolesAllowed("user") + @Produces(MediaType.APPLICATION_JSON) + public User principalNameId() { + return new User(identity.getPrincipal().getName()); + } + @GET @Path("/preferredUserName/bearer") @RolesAllowed("user") diff --git a/integration-tests/oidc-wiremock/src/main/resources/application.properties b/integration-tests/oidc-wiremock/src/main/resources/application.properties index f806a8948240c..2959c7785cbed 100644 --- a/integration-tests/oidc-wiremock/src/main/resources/application.properties +++ b/integration-tests/oidc-wiremock/src/main/resources/application.properties @@ -121,6 +121,12 @@ quarkus.oidc.bearer.credentials.secret=secret quarkus.oidc.bearer.token.audience=https://service.example.com quarkus.oidc.bearer.allow-token-introspection-cache=false +quarkus.oidc.bearer-id.auth-server-url=${keycloak.url}/realms/quarkus/ +quarkus.oidc.bearer-id.client-id=quarkus-app +quarkus.oidc.bearer-id.credentials.secret=secret +quarkus.oidc.bearer-id.allow-token-introspection-cache=false +quarkus.oidc.bearer-id.token.authorization-scheme=ID + quarkus.oidc.bearer-required-algorithm.auth-server-url=${keycloak.url}/realms/quarkus/ quarkus.oidc.bearer-required-algorithm.client-id=quarkus-app quarkus.oidc.bearer-required-algorithm.credentials.secret=secret diff --git a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java index 4c0b332ce82ad..05c6b6a4d0a26 100644 --- a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java +++ b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java @@ -262,6 +262,17 @@ public void testExpiredBearerToken() { .header("WWW-Authenticate", equalTo("Bearer")); } + @Test + public void testBearerToken() { + String token = getAccessToken("alice", Set.of("user")); + + RestAssured.given().auth().oauth2(token).when() + .get("/api/users/me/bearer") + .then() + .statusCode(200) + .body(Matchers.containsString("alice")); + } + @Test public void testBearerTokenWrongIssuer() { String token = getAccessTokenWrongIssuer("alice", Set.of("user")); @@ -284,6 +295,38 @@ public void testBearerTokenWrongAudience() { .header("WWW-Authenticate", equalTo("Bearer")); } + @Test + public void testBearerTokenIdScheme() { + String token = getAccessToken("alice", Set.of("user")); + + RestAssured.given().header("Authorization", "ID " + token).when() + .get("/api/users/me/bearer-id") + .then() + .statusCode(200) + .body(Matchers.containsString("alice")); + } + + @Test + public void testBearerTokenIdSchemeButBearerSchemeIsUsed() { + String token = getAccessToken("alice", Set.of("user")); + + RestAssured.given().auth().oauth2(token).when() + .get("/api/users/me/bearer-id") + .then() + .statusCode(401); + } + + @Test + public void testBearerTokenIdSchemeWrongIssuer() { + String token = getAccessTokenWrongIssuer("alice", Set.of("user")); + + RestAssured.given().auth().oauth2(token).when() + .get("/api/users/me/bearer-id") + .then() + .statusCode(401) + .header("WWW-Authenticate", equalTo("ID")); + } + @Test public void testAcquiringIdentityOutsideOfHttpRequest() { String tenant = "bearer"; From 2712330280c6870a991f6b724cf4433ae7baaae7 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 20 Nov 2023 10:48:45 +0100 Subject: [PATCH 2/9] Build cache - Ignore more files for Spotless --- independent-projects/parent/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/independent-projects/parent/pom.xml b/independent-projects/parent/pom.xml index 0c88d626eeb8e..be3075bf1548b 100644 --- a/independent-projects/parent/pom.xml +++ b/independent-projects/parent/pom.xml @@ -562,6 +562,8 @@ .settings/* target/* .cache/* + .factorypath + *.log true From 7824826929ab4bcecbcd55991b27a70988e41c81 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 20 Nov 2023 10:49:00 +0100 Subject: [PATCH 3/9] Build cache - Avoid runtimeClasspath being overridden --- integration-tests/oidc-client-reactive/pom.xml | 3 +++ integration-tests/rest-client-reactive/pom.xml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/integration-tests/oidc-client-reactive/pom.xml b/integration-tests/oidc-client-reactive/pom.xml index 5c9c5f1f2e838..5d504c6944136 100644 --- a/integration-tests/oidc-client-reactive/pom.xml +++ b/integration-tests/oidc-client-reactive/pom.xml @@ -156,6 +156,9 @@ + + META-INF/ide-deps/** + application.properties diff --git a/integration-tests/rest-client-reactive/pom.xml b/integration-tests/rest-client-reactive/pom.xml index 05fc6fb2cf4c5..e70e0e07b177d 100644 --- a/integration-tests/rest-client-reactive/pom.xml +++ b/integration-tests/rest-client-reactive/pom.xml @@ -156,6 +156,9 @@ + + META-INF/ide-deps/** + application.properties From 5727c2dcbd1afc6c0e0a13bd7edcd3cb0085e204 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Mon, 20 Nov 2023 11:04:46 +0100 Subject: [PATCH 4/9] Build cache - Avoid hardcoded path in generated test file --- .../project-using-test-template-from-extension/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/test-extension/tests/src/test/resources-filtered/projects/project-using-test-template-from-extension/pom.xml b/integration-tests/test-extension/tests/src/test/resources-filtered/projects/project-using-test-template-from-extension/pom.xml index 2750c013fadbf..eef420dac8589 100644 --- a/integration-tests/test-extension/tests/src/test/resources-filtered/projects/project-using-test-template-from-extension/pom.xml +++ b/integration-tests/test-extension/tests/src/test/resources-filtered/projects/project-using-test-template-from-extension/pom.xml @@ -46,7 +46,7 @@ io.quarkus integration-test-extension-that-defines-junit-test-extensions ${quarkus.version} - test + test @@ -109,7 +109,7 @@ - ${project.build.directory}/${project.build.finalName}-runner + \${project.build.directory}/\${project.build.finalName}-runner org.jboss.logmanager.LogManager \${maven.home} From 6c69e6ddad8ab45bb4f5ec3419d7f1cbdcb41728 Mon Sep 17 00:00:00 2001 From: Bernhard Schuhmann Date: Mon, 20 Nov 2023 12:56:02 +0100 Subject: [PATCH 5/9] Use LinkedHashMap for parts map to ensure user input order --- .../reactive/server/multipart/MultipartFormDataOutput.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/multipart/MultipartFormDataOutput.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/multipart/MultipartFormDataOutput.java index df175a86839c8..3b8212907a3ca 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/multipart/MultipartFormDataOutput.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/multipart/MultipartFormDataOutput.java @@ -1,7 +1,7 @@ package org.jboss.resteasy.reactive.server.multipart; import java.util.Collections; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import jakarta.ws.rs.core.MediaType; @@ -10,7 +10,7 @@ * Used when a Resource method needs to return a multipart output */ public final class MultipartFormDataOutput { - private final Map parts = new HashMap<>(); + private final Map parts = new LinkedHashMap<>(); public Map getFormData() { return Collections.unmodifiableMap(parts); From a63209782a0f18970652c2a7bef2d29194e94869 Mon Sep 17 00:00:00 2001 From: mert18 Date: Sat, 25 Nov 2023 07:38:34 +0300 Subject: [PATCH 6/9] deprecated dev-v1 url is corrected with dev-ui in a few places. --- .../src/main/resources/META-INF/resources/index.entry.qute.html | 2 +- docs/src/main/asciidoc/grpc-service-implementation.adoc | 2 +- docs/src/main/asciidoc/security-keycloak-authorization.adoc | 2 +- .../security-oidc-bearer-token-authentication-tutorial.adoc | 2 +- docs/src/main/asciidoc/security-openid-connect-client.adoc | 2 +- .../src/main/asciidoc/security-openid-connect-dev-services.adoc | 2 +- .../io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/grpc-codestart/base/src/main/resources/META-INF/resources/index.entry.qute.html b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/grpc-codestart/base/src/main/resources/META-INF/resources/index.entry.qute.html index 4f3acc377dc7f..07f8b05dacbc2 100644 --- a/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/grpc-codestart/base/src/main/resources/META-INF/resources/index.entry.qute.html +++ b/devtools/project-core-extension-codestarts/src/main/resources/codestarts/quarkus/extension-codestarts/grpc-codestart/base/src/main/resources/META-INF/resources/index.entry.qute.html @@ -1,3 +1,3 @@ {#include index-entry} -{#body}
› It can be tested in the Dev UI (available in dev mode only). +{#body}
› It can be tested in the Dev UI (available in dev mode only). {/include} \ No newline at end of file diff --git a/docs/src/main/asciidoc/grpc-service-implementation.adoc b/docs/src/main/asciidoc/grpc-service-implementation.adoc index 2d870aed2c917..8878d03c29b28 100644 --- a/docs/src/main/asciidoc/grpc-service-implementation.adoc +++ b/docs/src/main/asciidoc/grpc-service-implementation.adoc @@ -359,7 +359,7 @@ public class HelloServiceTest implements Greeter { == Trying out your services manually In the dev mode, you can try out your gRPC services in the Quarkus Dev UI. -Just go to http://localhost:8080/q/dev-v1 and click on _Services_ under the gRPC tile. +Just go to http://localhost:8080/q/dev-ui and click on _Services_ under the gRPC tile. Please note that your application needs to expose the "normal" HTTP port for the Dev UI to be accessible. If your application does not expose any HTTP endpoints, you can create a dedicated profile with a dependency on `quarkus-vertx-http`: [source,xml] diff --git a/docs/src/main/asciidoc/security-keycloak-authorization.adoc b/docs/src/main/asciidoc/security-keycloak-authorization.adoc index 6f58b3c0681c1..8d6c6a063ac92 100644 --- a/docs/src/main/asciidoc/security-keycloak-authorization.adoc +++ b/docs/src/main/asciidoc/security-keycloak-authorization.adoc @@ -235,7 +235,7 @@ include::{includes}/devtools/dev.adoc[] xref:security-openid-connect-dev-services.adoc[Dev Services for Keycloak] will launch a Keycloak container and import a `quarkus-realm.json`. -Open a xref:dev-ui.adoc[Dev UI] available at http://localhost:8080/q/dev-v1[/q/dev-v1] and click on a `Provider: Keycloak` link in an `OpenID Connect` `Dev UI` card. +Open a xref:dev-ui.adoc[Dev UI] available at http://localhost:8080/q/dev-ui[/q/dev-ui] and click on a `Provider: Keycloak` link in an `OpenID Connect` `Dev UI` card. You will be asked to log in into a `Single Page Application` provided by `OpenID Connect Dev UI`: diff --git a/docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc b/docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc index 79b64542b456d..1be0d80000013 100644 --- a/docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc +++ b/docs/src/main/asciidoc/security-oidc-bearer-token-authentication-tutorial.adoc @@ -263,7 +263,7 @@ For more information, see the link:{url-quarkusio-guides}security-keycloak-admin include::{includes}/devtools/dev.adoc[] ==== * link:{quarkusio-guides}/security-openid-connect-dev-services[Dev Services for Keycloak] will start a Keycloak container and import a `quarkus-realm.json`. -. Open a link:{url-quarkusio-guides}dev-ui[Dev UI], which you can find at http://localhost:8080/q/dev-v1[/q/dev-v1], then click a `Provider: Keycloak` link in an `OpenID Connect` `Dev UI` card. +. Open a link:{url-quarkusio-guides}dev-ui[Dev UI], which you can find at http://localhost:8080/q/dev-ui[/q/dev-ui], then click a `Provider: Keycloak` link in an `OpenID Connect` `Dev UI` card. . When prompted to log in to a `Single Page Application` provided by `OpenID Connect Dev UI`, do the following steps: * Log in as `alice` (password: `alice`), who has a `user` role. diff --git a/docs/src/main/asciidoc/security-openid-connect-client.adoc b/docs/src/main/asciidoc/security-openid-connect-client.adoc index 62a63de2f71a4..bcce8989a88da 100644 --- a/docs/src/main/asciidoc/security-openid-connect-client.adoc +++ b/docs/src/main/asciidoc/security-openid-connect-client.adoc @@ -363,7 +363,7 @@ include::{includes}/devtools/dev.adoc[] xref:security-openid-connect-dev-services.adoc[Dev Services for Keycloak] will launch a Keycloak container and import a `quarkus-realm.json`. -Open a xref:dev-ui.adoc[Dev UI] available at http://localhost:8080/q/dev-v1[/q/dev-v1] and click on a `Provider: Keycloak` link in an `OpenID Connect` `Dev UI` card. +Open a xref:dev-ui.adoc[Dev UI] available at http://localhost:8080/q/dev-ui[/q/dev-ui] and click on a `Provider: Keycloak` link in an `OpenID Connect` `Dev UI` card. You will be asked to log in into a `Single Page Application` provided by `OpenID Connect Dev UI`: diff --git a/docs/src/main/asciidoc/security-openid-connect-dev-services.adoc b/docs/src/main/asciidoc/security-openid-connect-dev-services.adoc index 3e4f7fc20672e..ee38209a69427 100644 --- a/docs/src/main/asciidoc/security-openid-connect-dev-services.adoc +++ b/docs/src/main/asciidoc/security-openid-connect-dev-services.adoc @@ -419,7 +419,7 @@ Please follow the xref:dev-ui.adoc[Dev UI] tutorial as well as check the `extens == Non Application Root Path Considerations -This document refers to the `http://localhost:8080/q/dev-v1` Dev UI URL in several places where `q` is a default non application root path. If you customize `quarkus.http.root-path` and/or `quarkus.http.non-application-root-path` properties then replace `q` accordingly, please see https://quarkus.io/blog/path-resolution-in-quarkus/[Path Resolution in Quarkus] for more information. +This document refers to the `http://localhost:8080/q/dev-ui` Dev UI URL in several places where `q` is a default non application root path. If you customize `quarkus.http.root-path` and/or `quarkus.http.non-application-root-path` properties then replace `q` accordingly, please see https://quarkus.io/blog/path-resolution-in-quarkus/[Path Resolution in Quarkus] for more information. == References diff --git a/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java b/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java index 350d9e1a7a480..e82ac2ece7dff 100644 --- a/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java +++ b/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java @@ -14,7 +14,7 @@ /** * A route for handling requests in the dev console. *

- * Routes are registered under /q/dev-v1/{groupId}.{artifactId}/ + * Routes are registered under /q/dev-ui/{groupId}.{artifactId}/ *

* The route is registered: *

    From 0c3c9c27bdbe3739838fe19384ef6ff078fa71e3 Mon Sep 17 00:00:00 2001 From: mert18 Date: Sat, 25 Nov 2023 14:13:50 +0300 Subject: [PATCH 7/9] DevConsoleRouteBuildItem.java dev-ui change reverted. --- .../spi/DevConsoleRouteBuildItem.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java b/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java index e82ac2ece7dff..9db5cf349d174 100644 --- a/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java +++ b/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java @@ -14,11 +14,12 @@ /** * A route for handling requests in the dev console. *

    - * Routes are registered under /q/dev-ui/{groupId}.{artifactId}/ + * Routes are registered under /q/dev-v1/{groupId}.{artifactId}/ *

    * The route is registered: *

      - *
    • in the "regular" app router (runtime class loader), if the handler is produced by a recorder (i.e. implements + *
    • in the "regular" app router (runtime class loader), if the handler is + * produced by a recorder (i.e. implements * {@link io.quarkus.deployment.recording.BytecodeRecorderImpl.ReturnedProxy}),
    • *
    • in the Dev UI router (deployment class loader).
    • *
    @@ -89,7 +90,8 @@ public DevConsoleRouteBuildItem(String path, String method, this.isBlockingHandler = false; } - private DevConsoleRouteBuildItem(String groupId, String artifactId, String path, String method, Class callerClass, + private DevConsoleRouteBuildItem(String groupId, String artifactId, String path, String method, + Class callerClass, Handler handler, boolean isBodyHandlerRequired, boolean isBlockingHandler) { this.groupId = groupId; this.artifactId = artifactId; @@ -102,7 +104,8 @@ private DevConsoleRouteBuildItem(String groupId, String artifactId, String path, } /** - * Gets the group id and artifact ID. This needs the curate result to map the calling class to the + * Gets the group id and artifact ID. This needs the curate result to map the + * calling class to the * artifact that contains it in some situations (namely in dev mode tests). */ public Map.Entry groupIdAndArtifactId(CurateOutcomeBuildItem curateOutcomeBuildItem) { @@ -181,7 +184,8 @@ public Builder blockingHandler() { public DevConsoleRouteBuildItem build() { Class callerClass; if (groupId == null) { - String callerClassName = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass() + String callerClassName = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE) + .getCallerClass() .getCanonicalName(); try { callerClass = Thread.currentThread().getContextClassLoader().loadClass(callerClassName); @@ -191,7 +195,8 @@ public DevConsoleRouteBuildItem build() { } else { callerClass = null; } - return new DevConsoleRouteBuildItem(groupId, artifactId, path, method, callerClass, handler, isBodyHandlerRequired, + return new DevConsoleRouteBuildItem(groupId, artifactId, path, method, callerClass, handler, + isBodyHandlerRequired, isBlockingHandler); } From 8613d0bb43449e31103a91e7f1d6501643b09da1 Mon Sep 17 00:00:00 2001 From: mert18 Date: Sat, 25 Nov 2023 14:15:53 +0300 Subject: [PATCH 8/9] Revert "DevConsoleRouteBuildItem.java dev-ui change reverted." This reverts commit 0c3c9c27bdbe3739838fe19384ef6ff078fa71e3. --- .../spi/DevConsoleRouteBuildItem.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java b/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java index 9db5cf349d174..e82ac2ece7dff 100644 --- a/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java +++ b/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java @@ -14,12 +14,11 @@ /** * A route for handling requests in the dev console. *

    - * Routes are registered under /q/dev-v1/{groupId}.{artifactId}/ + * Routes are registered under /q/dev-ui/{groupId}.{artifactId}/ *

    * The route is registered: *

      - *
    • in the "regular" app router (runtime class loader), if the handler is - * produced by a recorder (i.e. implements + *
    • in the "regular" app router (runtime class loader), if the handler is produced by a recorder (i.e. implements * {@link io.quarkus.deployment.recording.BytecodeRecorderImpl.ReturnedProxy}),
    • *
    • in the Dev UI router (deployment class loader).
    • *
    @@ -90,8 +89,7 @@ public DevConsoleRouteBuildItem(String path, String method, this.isBlockingHandler = false; } - private DevConsoleRouteBuildItem(String groupId, String artifactId, String path, String method, - Class callerClass, + private DevConsoleRouteBuildItem(String groupId, String artifactId, String path, String method, Class callerClass, Handler handler, boolean isBodyHandlerRequired, boolean isBlockingHandler) { this.groupId = groupId; this.artifactId = artifactId; @@ -104,8 +102,7 @@ private DevConsoleRouteBuildItem(String groupId, String artifactId, String path, } /** - * Gets the group id and artifact ID. This needs the curate result to map the - * calling class to the + * Gets the group id and artifact ID. This needs the curate result to map the calling class to the * artifact that contains it in some situations (namely in dev mode tests). */ public Map.Entry groupIdAndArtifactId(CurateOutcomeBuildItem curateOutcomeBuildItem) { @@ -184,8 +181,7 @@ public Builder blockingHandler() { public DevConsoleRouteBuildItem build() { Class callerClass; if (groupId == null) { - String callerClassName = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE) - .getCallerClass() + String callerClassName = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass() .getCanonicalName(); try { callerClass = Thread.currentThread().getContextClassLoader().loadClass(callerClassName); @@ -195,8 +191,7 @@ public DevConsoleRouteBuildItem build() { } else { callerClass = null; } - return new DevConsoleRouteBuildItem(groupId, artifactId, path, method, callerClass, handler, - isBodyHandlerRequired, + return new DevConsoleRouteBuildItem(groupId, artifactId, path, method, callerClass, handler, isBodyHandlerRequired, isBlockingHandler); } From 88616ceaa6a3bdb80d861807ad6fb7ef097160f1 Mon Sep 17 00:00:00 2001 From: mert18 Date: Sat, 25 Nov 2023 14:16:23 +0300 Subject: [PATCH 9/9] DevConsoleRouteBuildItem.java dev-ui change reverted. --- .../io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java b/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java index e82ac2ece7dff..350d9e1a7a480 100644 --- a/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java +++ b/extensions/vertx-http/dev-console-spi/src/main/java/io/quarkus/devconsole/spi/DevConsoleRouteBuildItem.java @@ -14,7 +14,7 @@ /** * A route for handling requests in the dev console. *

    - * Routes are registered under /q/dev-ui/{groupId}.{artifactId}/ + * Routes are registered under /q/dev-v1/{groupId}.{artifactId}/ *

    * The route is registered: *