[KEYCLOAK-11719] - Remove need for servlets/undertow from Quarkus dist#6600
[KEYCLOAK-11719] - Remove need for servlets/undertow from Quarkus dist#6600bb-matthewc wants to merge 1 commit intokeycloak:masterfrom
Conversation
| public class QuarkusFilter implements javax.ws.rs.container.ContainerRequestFilter, | ||
| javax.ws.rs.container.ContainerResponseFilter { | ||
|
|
||
| private static final Logger LOGGER = LoggerFactory.getLogger("QuarkusFilter"); |
There was a problem hiding this comment.
Maybe just use QuarkusFilter.class.getName() here ?
| String keycloakSession = ""; | ||
| for (String item: list) { | ||
| //NewCookie adds quotes around the cookie value for the KEYCLOAK_SESSION (due to /), so skipping this one. | ||
| if (item.contains("KEYCLOAK_SESSION")) { |
There was a problem hiding this comment.
We have this constant already with the cookie name org.keycloak.services.managers.AuthenticationManager#KEYCLOAK_SESSION_COOKIE.
I think same goes for Set-Cookie which can be grabbed from javax.ws.rs.core.HttpHeaders#SET_COOKIE.
There was a problem hiding this comment.
We should wait for fix in Quarkus here, as this stuff is not very nice
| @Provider | ||
| @Priority(1) | ||
| public class QuarkusFilter implements javax.ws.rs.container.ContainerRequestFilter, | ||
| javax.ws.rs.container.ContainerResponseFilter { |
There was a problem hiding this comment.
I'm not sure whether or not a ContainerResponseFilter is invoked if an exception is thrown by applications. If not, we won't be able to perform the ending aspects of this filter such as cleaning up sessions, transactions, etc.
There was a problem hiding this comment.
I think back in the early days I did try to use a JAX-RS filter instead of the servlet filter, but it didn't always work. Can't remember what the problems where though, just that I ended up with a servlet filter because I couldn't get JAX-RS filter to work fully
|
Two main comments:
Thanks. |
|
@jonm-bb, this change from Stuart should help with the cookie issue quarkusio/quarkus#6218. |
|
Hi @pedroigor, thanks for the review. Makes sense to wait as the code will be a lot cleaner! Will fix up the other comments and push the changes when the cookie fix is in place. |
| <modules> | ||
| <module>quarkus</module> | ||
| </modules> | ||
| <build> |
There was a problem hiding this comment.
I assume this adds jandex indexes for all modules. Is that needed? Or do we just need it on Hibernate entities and services?
I don't think it will have any side-effect on having jandex indexes included on WildFly, but we'd need to check that since we need to build everything in one go when doing releases.
There was a problem hiding this comment.
I remember it complained about a fair number missing from the index and I tried adding them individually. Will see if I can break it down into something more manageable than everything...
| public void filter(ContainerRequestContext containerRequestContext) throws IOException { | ||
|
|
||
| if (containerRequestContext.getMediaType() == null) { | ||
| containerRequestContext.getHeaders().add("Content-Type", MediaType.APPLICATION_FORM_URLENCODED); |
There was a problem hiding this comment.
This seems like it may have some unforeseen side-effects
| @Provider | ||
| @Priority(1) | ||
| public class QuarkusFilter implements javax.ws.rs.container.ContainerRequestFilter, | ||
| javax.ws.rs.container.ContainerResponseFilter { |
There was a problem hiding this comment.
I think back in the early days I did try to use a JAX-RS filter instead of the servlet filter, but it didn't always work. Can't remember what the problems where though, just that I ended up with a servlet filter because I couldn't get JAX-RS filter to work fully
| public class QuarkusFilter implements javax.ws.rs.container.ContainerRequestFilter, | ||
| javax.ws.rs.container.ContainerResponseFilter { | ||
|
|
||
| private static final Logger LOGGER = LoggerFactory.getLogger("QuarkusFilter"); |
| String keycloakSession = ""; | ||
| for (String item: list) { | ||
| //NewCookie adds quotes around the cookie value for the KEYCLOAK_SESSION (due to /), so skipping this one. | ||
| if (item.contains("KEYCLOAK_SESSION")) { |
There was a problem hiding this comment.
We should wait for fix in Quarkus here, as this stuff is not very nice
| </dependency> | ||
| <dependency> | ||
| <groupId>io.quarkus</groupId> | ||
| <artifactId>quarkus-vertx-web</artifactId> |
There was a problem hiding this comment.
Do we need quarkus-vertx-web? Not sure what it does, but I thought we only needed quarkus-verts and quarkus-resteasy
|
|
||
| # Required for jandex index | ||
| quarkus.index-dependency.MultivalueMap.group-id=org.jboss.spec.javax.ws.rs | ||
| quarkus.index-dependency.MultivalueMap.artifact-id=jboss-jaxrs-api_2.1_spec No newline at end of file |
There was a problem hiding this comment.
Seems a bit strange that this is needed and wouldn't then be handled by quarkus-resteasy automatically?
| public class ObjectMapperResolver implements ContextResolver<ObjectMapper> { | ||
| protected ObjectMapper mapper = new ObjectMapper(); | ||
|
|
||
| public ObjectMapperResolver() {} |
There was a problem hiding this comment.
Perhaps it would be better to just change the constructor below to use the system property directly instead of getting "indent" passed from somewhere else?
There was a problem hiding this comment.
If we just use the ObjectMapper instance from JsonSerialization instead of creating another instance, do we would have any collateral effect?
|
Merged in #7063. Thanks @bb-matthewc |
No description provided.