Re: TomEE 11 - Examples & MP JWT TCK Failures with CXF 4.2.0
Richard Zowalla <[email protected]> Tue, 17 Feb 2026 15:18:42 +0100
| Newsgroups | gmane.comp.java.openejb.devel |
|---|---|
| Message-ID | <[email protected]> |
I believe the actual issue is related to the caching mechanism in CXF's =
updated code. Due to this caching, the token validation now happens as =
soon as getPrincipal() is called, which occurs much earlier in CXF 4.2.0 =
than in previous versions.
As a result, our current TomEE code fails because at that point in the =
request lifecycle, no Authorization header may be present (e.g., for =
@PermitAll endpoints), and the token validation simply fails.
Additionally, I couldn't find clear guidance in the MP JWT specification =
regarding the default behavior for non-annotated JAX-RS methods, i.e., =
methods without @RolesAllowed, @PermitAll, or @DenyAll.
It appears this may be vendor-specific. Should the default be:
=E2=80=A2 @PermitAll (allow unauthenticated access)?
=E2=80=A2 @DenyAll (require authentication)?
=E2=80=A2 Something else?
Gru=C3=9F
Richard
> Am 17.02.2026 um 14:54 schrieb Richard Zowalla <[email protected]>:
>=20
> Hi all,
>=20
> Due to a change in CXF 4.2.0 [1], specifically caching the principal =
instead of looking it up on demand, we are seeing several test failures =
in the MP JWT area - I am now wondering if this a thing CXF needs to =
address or if we need to update our integration. For this reason and =
after some debugging, I would like to get some additional context from =
the past regarding the architecture of our CXF/MP JWT integration :)
>=20
> The failure in question can be reproduced by running =
OrderTest#shouldBeRunning() from the main branch in =
examples/mp-rest-jwt-principal, or by executing parts of the MP JWT TCK, =
which are also failing.
>=20
> The test calls an endpoint that, according to the test assumptions, =
shouldn=E2=80=99t be protected. It passes on TomEE 10 / CXF 4.1.5 (which =
does not cache the principal). The relevant code on our side is mainly =
in MPJWTFilter, especially the MPJWTServletRequestWrapper and its use of =
validate(=E2=80=A6).
>=20
> Since I=E2=80=99m not an active MP JWT user, I have some (maybe dumb?) =
questions:
>=20
> According to [2], an application annotated with =
@LoginConfig(authMethod =3D "MP-JWT") requires MP-JWT Access Control =
(potentially for all endpoints?).
>=20
> If that is the case, the status() method of OrderRestin =
https://github.com/apache/tomee/blob/main/examples/mp-rest-jwt-principal/s=
rc/main/java/org/superbiz/store/rest/OrderRest.java should require a =
JWT, no?
>=20
> However, we don=E2=80=99t add a token to the REST client in =
https://github.com/apache/tomee/blob/main/examples/mp-rest-jwt-principal/s=
rc/test/java/org/superbiz/store/OrderRestClient.java#L35, so the request =
is sent without a bearer token and fails with a 401.=20
>=20
> This worked on TomEE 10 / CXF 4.1.5 and earlier.
>=20
> I suspect some MP JWT TCK failures are caused by the same issue. See =
the build here: =
https://ci-builds.apache.org/job/TomEe/job/master-build-full/org.apache.to=
mee$microprofile-jwt-tck/2071/
>=20
> Question:
>=20
> What is the expected behavior? =46rom my reading of the spec, it seems =
this endpoint shouldn=E2=80=99t be invocable without a valid token?
>=20
> Could anyone with more experience in this area (David, JL, anyone?) =
provide some insight?
>=20
> Thanks and Gru=C3=9F
> Richard
>=20
> [1] =
https://github.com/apache/cxf/pull/2807/changes#diff-eddf423fac99200bd14e1=
15467dc35809e1855cefdf3bae77f9394b8c050fc94L419
> [2] =
https://download.eclipse.org/microprofile/microprofile-jwt-auth-2.1/microp=
rofile-jwt-auth-spec-2.1.html#_marking_a_jax_rs_application_as_requiring_m=
p_jwt_access_control
>=20