-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.8] Backports for 3.8.5+Update to 3.8.5 (#1826)
* Coverage for JSON tokens https://issues.redhat.com/browse/QUARKUS-4179 * Cover client handling server failures https://issues.redhat.com/browse/QQE-692 quarkusio/quarkus#37323 * Cover case of failing security tests They were failing in a presence of a router filter and resteasy-reactive dependency quarkusio/quarkus#40307 https://issues.redhat.com/browse/QQE-692 * Add coverage for max parameters of multipart tweak mulripart tests fix for loop initial from 0 * Update to 3.8.5 --------- Co-authored-by: jcarranzan <jcarranz@redhat.com>
- Loading branch information
1 parent
74de3e6
commit 5e8bd17
Showing
14 changed files
with
225 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
.../src/main/java/io/quarkus/ts/http/restclient/reactive/failures/FailingClientResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.quarkus.ts.http.restclient.reactive.failures; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
import org.eclipse.microprofile.rest.client.inject.RestClient; | ||
|
||
import io.smallrye.mutiny.Uni; | ||
|
||
@Path("/client/failing") | ||
public class FailingClientResource { | ||
@RestClient | ||
FailureClient client; | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
@Path("/straight") | ||
public String getStraightResult() { | ||
return client.getVisitor(); | ||
} | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
@Path("/reactive") | ||
public Uni<String> getReactiveResult() { | ||
return client.getVisitorReactively() | ||
.onFailure().retry().atMost(5); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...active/src/main/java/io/quarkus/ts/http/restclient/reactive/failures/FailingResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package io.quarkus.ts.http.restclient.reactive.failures; | ||
|
||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
@Path("/fail") | ||
public class FailingResource { | ||
private static final AtomicInteger counter = new AtomicInteger(0); | ||
private static final boolean[] fail = { true, true, true, true, false }; | ||
// in earlier versions, connection was closed after three errors. We need to ensure, that this is not the case. | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
@Path("/cyclic") | ||
public String fail() { | ||
int visit = counter.getAndIncrement(); | ||
int index = visit % fail.length; | ||
if (fail[index]) { | ||
throw new RuntimeException("Whoops, we encountered a problem!"); | ||
} else { | ||
return "You're the " + (visit + 1) + "th visitor of this page"; | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...reactive/src/main/java/io/quarkus/ts/http/restclient/reactive/failures/FailureClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.quarkus.ts.http.restclient.reactive.failures; | ||
|
||
import java.time.temporal.ChronoUnit; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
|
||
import org.eclipse.microprofile.faulttolerance.Retry; | ||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; | ||
|
||
import io.smallrye.mutiny.Uni; | ||
|
||
@RegisterRestClient(baseUri = "http://localhost:8080/") | ||
@Path("/fail") | ||
public interface FailureClient { | ||
|
||
@GET | ||
@Retry(delay = 1, delayUnit = ChronoUnit.SECONDS, maxRetries = 5) | ||
@Path("/cyclic") | ||
String getVisitor(); | ||
|
||
@GET | ||
@Path("/cyclic") | ||
Uni<String> getVisitorReactively(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
security/basic/src/main/java/io/quarkus/ts/openshift/security/basic/SecurityFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.quarkus.ts.openshift.security.basic; | ||
|
||
import jakarta.inject.Singleton; | ||
|
||
import io.quarkus.vertx.web.RouteFilter; | ||
import io.vertx.ext.web.RoutingContext; | ||
|
||
@Singleton | ||
// if https://github.com/quarkusio/quarkus/issues/40307 is not fixed, then presence of a filter leads to 500 error | ||
public class SecurityFilter { | ||
|
||
@RouteFilter(401) | ||
void filter(RoutingContext routingContext) { | ||
routingContext.next(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...rkus/ts/security/keycloak/oidcclient/extended/restclient/principal/JsonTokenResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.quarkus.ts.security.keycloak.oidcclient.extended.restclient.principal; | ||
|
||
import jakarta.inject.Inject; | ||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
|
||
import org.eclipse.microprofile.rest.client.inject.RestClient; | ||
|
||
import io.quarkus.ts.security.keycloak.oidcclient.extended.restclient.principal.clients.JsonTokenClient; | ||
|
||
@Path("/json-propagation-filter") | ||
public class JsonTokenResource { | ||
|
||
@Inject | ||
@RestClient | ||
JsonTokenClient jsonClient; | ||
|
||
@GET | ||
public String getUserNameThroughJson() { | ||
return jsonClient.getUserName(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...s/security/keycloak/oidcclient/extended/restclient/principal/clients/JsonTokenClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package io.quarkus.ts.security.keycloak.oidcclient.extended.restclient.principal.clients; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
|
||
import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders; | ||
import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; | ||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; | ||
|
||
import io.quarkus.oidc.token.propagation.JsonWebTokenRequestFilter; | ||
|
||
@RegisterRestClient | ||
@RegisterClientHeaders | ||
@Path("/principal") | ||
@RegisterProvider(JsonWebTokenRequestFilter.class) | ||
public interface JsonTokenClient { | ||
|
||
@GET | ||
String getUserName(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters