Nor is there a clear standards-based way to express that a method requiresno authentication at all (vs @PermitAll which means authenticated but with no role requirement).
Nor is there clarity on what happens if a client still provides a bearer token to a methodnot requiring one.
Not to mention the fact that the "groups" claim may or may not correspondto my @RolesAllowed annotations -- it says that a container must support a 1:1 group to rolemapping, but of course there is no articulation on how such policies are configured, noran API for how I might supply an alternative mapping.
Speaking as a frustrated user, and not a vendor, I would strongly push for ironing outthe many holes and infelicities in the initial core specs before adding any others.I'm sure I'm getting some of the details wrong below, but here are some of the thingsI've been battering my head against the past few weeks:- Implementations differ, and apparently experts disagree, about what default scope JAX-RSresources have without CDI. So since I do need to control that, I *have* to explicitlyhave CDI2 annotations on all my resources, and @Path isn't enough. For example,suppose I have an injected JsonWebToken or other member variable that is not applicationscoped. Or suppose I don't want something instantiated on every request.
- Then suppose I want to get my actual application object injected, thank you very much,and not some crippled proxy. So now I have to learn about the subtle differencebetween @Singleton and @ApplicationScoped that somebody thought was a good idea, andI have to use @Singleton in some places, or resort to vendor-specific unwrapping apis.
- So now I'm using 3 different DI annotations sets (@Context, CDI2, and CDI1) fora basic REST service -- what is "Micro" about this?
- And I also have to experiment with how implementing or not implementinggetClasses() in my Application interacts with any CDI scanning, not to mentionsome janky jandex incantations that might be done at build time, not run time.
- Oh and I have to be cognizant of the vital distinction between having no beans.xmlfile and having an *empty* beans.xml file. Because even though there is a "Configuration" spec,it doesn't include a clean way to configure Microprofile itself; instead I have toengage in epimestological inquiries concerning the existence of "beans.xml".
In general, there is little consistency among MP implementations in how to control which MP servicesI get. Some implementations use an external xml file.Some do it based on feature "esa" dependencies. Some just control it basedsolely on adding the provider dependency jars themselves.MP itself does not articulate a standard way for me to configure which MP services I want,let alone doing it using MP Configure.
- Now suppose I do want to get "health" and "metrics'. Where are those endpoint urlsgoing to be? Is it /health or /contextroot/health or /contextroot/app-path/health ?Who knows; each implementation seemingly does their own thing.And if my contextroot is "" are those services still going to get routed?What about access control? Are those MP services subject to the same filters (CORS etc)and access control (including MP JWT Auth) as the main app?Again, implementations vary. So now my monitoring and test scripts have to changeaccording to MP implementation.
- Speaking of JWT Auth, of course there is no standards-based way to supply the mandatoryconfiguration. Nor is there a clear standards-based way to express that a method requiresno authentication at all (vs @PermitAll which means authenticated but with no role requirement).Nor is there clarity on what happens if a client still provides a bearer token to a methodnot requiring one. Not to mention the fact that the "groups" claim may or may not correspondto my @RolesAllowed annotations -- it says that a container must support a 1:1 group to rolemapping, but of course there is no articulation on how such policies are configured, noran API for how I might supply an alternative mapping.
- And is it too much to ask that the /openapi yaml/json contenthas a "servers" section that represents where my app actually exists in thatvery same container, including any contextroot?So that consuming tools actually work out of the box?
- What if I might like to run multiple apps (microservices) in a single container?Is that even supposed to work? Because J2EE and servlets each obviously support it.But I wouldn't dream of trying that with MP.
Oh but maybe JDK 9+ modules might be part of the answer for multiple apps in a container?Nice idea, but MP says nothing about that, and at the moment it seems that nearly every MPimplementation requires JDK8 to function reliably -- even though realistically anyoneadopting MP is going to want it to work with JDK11.
- Despite the increased interest in cloud/docker/k8 deployments, MP does not articulatea golden path for deployable artifacts, akin to the "war" for servlet containers.Most implementations have some kind of support for the abominable executable uber jars.Some support thin jars. Some support thin wars.Some use nothing at all, and we are expected to copy the whole build tree over somewhere.But even though MP has a notion of a container, there is no expressed notion of whatfile format it must support for the things it can contain.
In summary: despite the many "starter" projects, and intro tutorials out on the internet, I haveyet to manage to make my basic app work the same way across two implementations -- evenworking at all has been a big challenge.
---mda
You received this message because you are subscribed to the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/425ae273-24d9-4ff4-b955-389e09620a70%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAKeeVe4bmLWYtF%3Dd8gvprZSbasV%2BvL3Ch31QwxFGjrTVf7QSnQ%40mail.gmail.com.
I do get frustrated that all the MP implementations out-of-the-boxseem oriented around uber jar abominations, which are not what I want to put into Docker.
But that is just for *my* stuff. What about the MP services or other non-standard providers thatcome with my MP container?I haven't found any portable way to control them, either via white list or black list.I can't white list them in my getClasses(), because that wouldn't be portable.(Jersey ResourceConfig has packages(String) but that isn't portable, and anyway Iwould have to track down all the packages/classes that each MP is using.)There is nothing in MP Config that seems to control it either.Instead, for "build up" containers like Quarkus, the selection is based on what dependenciesI pull. For "cut down" containers like Liberty, I would need to select based on a <features> elementin some non-portable xml file.
And then what about black listing? Most of the MP implementations include some sort of CORS filter and anexception filter, but IMHO these are typically poorly documented, not very configurable, anddon't do what I want out of the box. So then I want to disable these "builtin" Providers andjust use my own.
Regarding the endpoints for MP services, Ken says"Both the Health and Metrics specifications define the endpoints that must be provided"So who is wrong? Is it TomEE at /contextroot/apppath/health, or is it Liberty at /health ?
And are those endpoints like /health and /metrics supposed to be subject to the sameJWT Auth access control provisions as my app ?
How about all my other filter Providers?
Regarding /openapi/ui my point is that the builtin swagger ui is in general not going to beable to successfully call my service (in the same container!) nor will any external tool, becausethe yaml generated and returned at /openapi (assuming i didn't hard code it, but used openapiannotations) will typically not have any "servers" in it.Any container at runtime *totally* knows all routes.
I know some MP containers generate the openapi.* files at build time, and some at runtime.I know I don't want to hard-code the absolute path to my server in Java code.But so far I haven't found any way to automatically get an /openapi yaml to have a servers section thatcorresponds to what that container *knows* about the route to my app in that same server.Instead I've been forced to hardcode my deployment context root in Java codewith @OpenAPIDefinition (servers = @Server(url = "/contextroot/apppath"))As for format of deployable artifacts, I appreciate that there are scope issues in how muchMP wants to bite off. I do get frustrated that all the MP implementations out-of-the-boxseem oriented around uber jar abominations, which are not what I want to put into Docker.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/0b9b46bc-3ba6-4b1b-891c-e9840f393b33%40www.fastmail.com.
<SNIP>
In general, there is little consistency among MP implementations in how to control which MP servicesI get. Some implementations use an external xml file.Some do it based on feature "esa" dependencies. Some just control it basedsolely on adding the provider dependency jars themselves.MP itself does not articulate a standard way for me to configure which MP services I want,let alone doing it using MP Configure.One of the reasons MicroProfile hasn't defined anything around this, or packaging and deployment definitions, is because there are many ways that this can be achieved across different implementations. Trying to define a specification that caters to all the variants that implementations currently support would make such a specification extremely difficult and likely unworkable.MicroProfile aims for API and knowledge portability, not entire application portability.
</SNIP
Ken, I disagree with "MicroProfile aims for API and knowledge portability, not entire application portability.". We want application portability as much as possible within a MicroProfile [insert spec name] version. The caveat is that not all MicroProfile implementations support all specifications, which is part of the growing pain discussions.
Mark, and I'm agreeing with Ken here, specifications are about application portability. Defining application build/packaging are outside the scope of specs to give flexibility in how vendors implement the specs. It is fair to opine that a pom.xml file, xml config file, etc, can be considered application code, and it's a fair opinion the other way around. However, not formalizing this is via a specification a tradeoff that MicroProfile (and Jakarta EE / Java EE) makes.
On Tuesday, September 24, 2019 at 11:46:34 AM UTC-7, Ken Finnigan wrote:<SNIP>In general, there is little consistency among MP implementations in how to control which MP servicesI get. Some implementations use an external xml file.Some do it based on feature "esa" dependencies. Some just control it basedsolely on adding the provider dependency jars themselves.MP itself does not articulate a standard way for me to configure which MP services I want,let alone doing it using MP Configure.One of the reasons MicroProfile hasn't defined anything around this, or packaging and deployment definitions, is because there are many ways that this can be achieved across different implementations. Trying to define a specification that caters to all the variants that implementations currently support would make such a specification extremely difficult and likely unworkable.MicroProfile aims for API and knowledge portability, not entire application portability.</SNIP
--
You received this message because you are subscribed to the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/cca490bb-b007-467f-b5e9-a79193d2339d%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/425ae273-24d9-4ff4-b955-389e09620a70%40googlegroups.com.
--You received this message because you are subscribed to the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile+unsubscribe@googlegroups.com.
- Speaking of JWT Auth, of course there is no standards-based way to supply the mandatoryconfiguration.
Nor is there a clear standards-based way to express that a method requiresno authentication at all (vs @PermitAll which means authenticated but with no role requirement).
7.3. Using the Common Security Annotations for the Java Platform (JSR-250)
The expectations for use of the various security annotations described in sections 2.9 - 2.12 of JSR- 250 (@RolesAllowed, @PermitAll, @DenyAll), is that MP-JWT containers support the behavior as described in those sections. In particular, the interaction between the annotations should be as described in section 2.12 of JSR-250.
Nor is there clarity on what happens if a client still provides a bearer token to a methodnot requiring one.
Not to mention the fact that the "groups" claim may or may not correspondto my @RolesAllowed annotations -- it says that a container must support a 1:1 group to rolemapping, but of course there is no articulation on how such policies are configured, noran API for how I might supply an alternative mapping.
Hi,On Monday, September 23, 2019 at 11:31:50 PM UTC+2, Mark D. Anderson wrote:- Speaking of JWT Auth, of course there is no standards-based way to supply the mandatoryconfiguration.Are you sure you looked at JWT 1.1?The first version indeed missed this, but we added this in 1.1.
See this example:vsNor is there a clear standards-based way to express that a method requiresno authentication at all (vs @PermitAll which means authenticated but with no role requirement).@PermitAll is a bit confusing. Its Javadoc first speaks of "all security roles", but then clarifies by saying it's "unchecked".Unchecked means no check at all, i.e. free to everyone to access, authenticated or not.
SeeAuthenticated, but no role requirement, is expressed via the "any authenticated" pseudo-role "**"
SeeNo authentication at all would typically be expressed by simply not annotating the JAX-RS method with an @RolesAllowed, although if you want to override class level behaviour then @PermitAll can be used.
This is defined in the JWT spec in 7.3:7.3. Using the Common Security Annotations for the Java Platform (JSR-250)
The expectations for use of the various security annotations described in sections 2.9 - 2.12 of JSR- 250 (@RolesAllowed, @PermitAll, @DenyAll), is that MP-JWT containers support the behavior as described in those sections. In particular, the interaction between the annotations should be as described in section 2.12 of JSR-250.I remember handling it in my implementation, but tbh I'm not sure if the actual method level overrides are tested in the TCK, and glancing at my code it might indeed not:Nor is there clarity on what happens if a client still provides a bearer token to a methodnot requiring one.The issue here is that JWT Auth primarily defines an authentication mechanism, and somewhat adhoc assumes there's an underlying implied (but not specified) security system. Had JWT Auth simply depended on Java EE/Jakarta EE security this would have been far less of an issue, or no issue at all (but at the time this was not possible, as MP was based on EE 7).The problem here is that while JWT is only supposed to be an authentication mechanism, you quickly do get into details such as you mentioned. For that JWT would have to increasingly define this implied security system, eventually pretty much duplicating Java EE/Jakarta EE Security. This is a problem with @RolesAllowed/DenyAll/PermitAll as well. These annotations should not be solely defined to be applicable to JAX-RS methods in JWT Auth, but should be in JAX-RS and/or Jakarta Security. Those TCKs can exhaustively test all combinations, for all sorts of authentication mechanisms, not just JWT.Fyi though, this exact point about pre-emptive authentication was being brought up during one of the JWT meetings.Not to mention the fact that the "groups" claim may or may not correspondto my @RolesAllowed annotations -- it says that a container must support a 1:1 group to rolemapping, but of course there is no articulation on how such policies are configured, noran API for how I might supply an alternative mapping.Indeed. This partially comes back again to this dependency on the implied security system. I say partially, since even the standard Java/Jakarta Security system hasn't really standardised this and depends on the facilities of the underlying container. See step 7 here for examples for various containers:The plan is to, finally, standardise group to role mapping for Jakarta EE Security.Next, but for MicroProfile this will only really help if MP formally depends on that (practically speaking Payara and SmallRye already depend on it).Kind regards,Arjan Tijms
--You received this message because you are subscribed to the Google Groups "Eclipse MicroProfile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/5574a50f-0419-4153-b2f4-17d496d90ae7%40googlegroups.com.
Regarding different health endpoints, here is the relevant spec text:"These endpoints are expected to be associated with a configurable context, such as a web application deployment, that can be configured with settings such as port, virtual-host, security, etc."In other words, the behavior you are seeing is as expected. Now, you as a user seeing this as a negative experience is valuable feedback. It would be really helpful to continue to communicate here and perhaps join a MicroProfile Health call to see if this should change. Note that a change you desire, if approved, is a breaking change and would have to wait until a major new spec version release.
To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/c7c3ac60-2f62-440d-bb65-a9c7e20437d9%40googlegroups.com.
But that is just for *my* stuff. What about the MP services or other non-standard providers thatcome with my MP container?I haven't found any portable way to control them, either via white list or black list.I can't white list them in my getClasses(), because that wouldn't be portable.(Jersey ResourceConfig has packages(String) but that isn't portable, and anyway Iwould have to track down all the packages/classes that each MP is using.)There is nothing in MP Config that seems to control it either.Instead, for "build up" containers like Quarkus, the selection is based on what dependenciesI pull. For "cut down" containers like Liberty, I would need to select based on a <features> elementin some non-portable xml file.What exactly are you looking to control with respect to MP services? Their presence in an application or something else?
From discussions with those that are part of the OpenAPI specification work, it's been suggested that a static OpenAPI file containing the servers list is provided to the application runtime so that it can be merged with the annotation-based model.
I know some MP containers generate the openapi.* files at build time, and some at runtime.I know I don't want to hard-code the absolute path to my server in Java code.But so far I haven't found any way to automatically get an /openapi yaml to have a servers section thatcorresponds to what that container *knows* about the route to my app in that same server.Instead I've been forced to hardcode my deployment context root in Java codewith @OpenAPIDefinition (servers = @Server(url = "/contextroot/apppath"))As for format of deployable artifacts, I appreciate that there are scope issues in how muchMP wants to bite off. I do get frustrated that all the MP implementations out-of-the-boxseem oriented around uber jar abominations, which are not what I want to put into Docker.I know it's not the case that all MP implementations take an uber jar approach to packaging. Quarkus provides the ability to create Docker images whereby the dependent libs are in one layer and the application code is in its own layer.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/CAKeeVe7%3DkgwJCE0Bak8on5rPOtxWDsR7GZhOtPidXMz8fKAzOA%40mail.gmail.com.
I've found multiple opinions on the net, including these that say quite clearly that (in their opinion) PermitAll requires successful authentication:JSR250 says in part:The PermitAll annotation specifies that all security roles are allowed to invoke the specified method(s), that is, that the specified method(s) are “unchecked”.....The PermitAll, DenyAll and RolesAllowed annotations all define which security roles are allowed to access the methods on which they are applied.So i think it comes down to whether "all security roles" includes none at all (because unauthenticated).
There is zero use of @PermitAll in any of the java files in microprofile1.*-samplesSo I'm not sure what those samples would be able to show.
Is there some standard supporting * as the "any authenticated" role?Because if so, then that would be convincing evidence that PermitAll includes the unauthenticated state,because otherwise it would have the same meaning as "*".
That is *exactly* what I want to do -- have a class level @RolesAllowed, with a @PermitAll on a few methodswhich would mean "authenticated or unauthenticated, i don't care".But I guess I'm still not convinced that the MP specs support this interpretation.
--You received this message because you are subscribed to the Google Groups "Eclipse MicroProfile" group.To unsubscribe from this group and stop receiving emails from it, send an email to microprofile...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/microprofile/3fccd833-caba-4cba-9ddc-c4162048d27f%40googlegroups.com.
Thanks Arjan.I am reminded of the old poem Antigonish:Last night I saw upon the stair,A little man who wasn't there,He wasn't there again todayOh, how I wish he'd go away...So i guess the little man would have an "unauthenticated role" :)
To unsubscribe from this group and stop receiving emails from it, send an email to microp...@googlegroups.com.