quarkus: Quarkus 0.27 - JWT role validation does not work
Hi,
I have just migrated my small project from Quarkus 0.25 to 0.27 and I ran into an issue.
Let’s image we have the SmallRye JWT extension configured and the following class:
@Path("/hello")
@RequestScoped
open class GreetingResource {
@GET
@Path("/protected")
@Produces(MediaType.TEXT_PLAIN)
@RolesAllowed(value = ["Echoer", "Subscriber"])
fun helloProtected(@Context ctx: SecurityContext): String {
val callerName = ctx.userPrincipal?.name ?: "unknown"
return "hello $callerName"
}
}
Corresponding test:
@Test
fun testHelloEndpoint_protectedAsUnknown() {
given()
.`when`().get("/hello/protected")
.then()
.statusCode(401)
}
Everything works fine with 0.25. Unfortunately on Quarkus 0.27 my test fails because a request ends with HTTP 200 (helloProtected method gets called).
I started looking into the problem and I found that in Quarkus 0.27:
RolesFilterRegistrar#configureis not called and does not registerRolesAllowedFilterResteasyDeploymentImplcontains a list (providerClasses) that in previous version containsio.quarkus.resteasy.runtime.RolesFilterRegistrarbut in 0.27 this class is not there
in Quarkus 0.25 RolesFilterRegistrar and RolesAllowedFilter are in quarkus-resteasy module, but 0.27 does not contain them.
It looks that due to the fact that io.quarkus.resteasy.runtime.RolesFilterRegistrar is not registered (present on the providerClasses list) JWT RBAC does not work. If there is a new way how RolesAllowedFilter is configured then maybe it is not enabled by default. RolesAllowedFilter class is also present in smallrye-jwt-2.0.9.jar).
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (17 by maintainers)
Commits related to this issue
- Ensure that Security annotation are always places on non-final methods We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The defau... — committed to geoand/quarkus by geoand 5 years ago
- Ensure that Security annotation are always places on non-final methods We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solut... — committed to geoand/quarkus by geoand 5 years ago
- Ensure that Security annotation are always places on non-final methods We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solut... — committed to geoand/quarkus by geoand 5 years ago
- Ensure that Security annotation are always places on non-final methods We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solut... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to geoand/quarkus by geoand 5 years ago
- Merge pull request #5104 from geoand/#5051-take2 Ensure that final methods don't prevent CDI interceptors from being applied — committed to quarkusio/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to dmlloyd/quarkus by geoand 5 years ago
- Provide the ability to remove final flag from methods of CDI beans We need security annotations to result in the creation of an interceptor which is not possible when a method is final. The solution ... — committed to mmusgrov/quarkus by geoand 5 years ago
Is someone working on the deployment error approach? I think we should have it in 0.28.0.