eclipse / microprofile-jwt-auth

Apache License 2.0
108 stars 59 forks source link

Add OSGi metadata to API jar #95

Open rmannibucau opened 6 years ago

rmannibucau commented 6 years ago

At geronimo we have a set of OSGi users and to fulfill all their requirements the API jar should support OSGi metadata.

It is mainly about providing the following metadata:

  1. OSGi java contract (https://www.osgi.org/portable-java-contract-definitions/, example available at https://github.com/apache/geronimo-specs/commit/6718be8f735b0c50f0dc9b89da89c230b55cf166#diff-f75c44c910ca254b2b6eb71dee8a14e5R112)
  2. SpiFly metadata (http://aries.apache.org/modules/spi-fly.html, example available at https://github.com/apache/geronimo-specs/pull/6/files#diff-a665df1a7e55370409add2a70e3f10c7R101)

This will allow to avoid to fork the API and expose multiple coordinates for the same jar at the end.

Thanks, Romain

rotty3000 commented 6 years ago

I wish for this proposal to become a general practice for all MP APIs.

There is a long tradition of Java API repackaging for use in OSGi. This has lead not only to multiple disparate repackaging efforts but to outright forks in some cases (as was the need in Geronimo as shown above, but also in many others.)

The above suggestion uses OSGi specifications which are the culmination of years of analysis and real life use. It is the best way to handle OSGi compatibility and requires little to no code change w.r.t. the API code; specific use of the single argument ServiceLoader.load(String) is required for Service Loader Mediator to do it's work (SpiFly).

starksm64 commented 6 years ago

Agreed, we were just following what other MP projects were doing, so we must not have enough in general, or have fallen behind.

rmannibucau commented 6 years ago

@rotty3000 are you able to help and do a PR to fix this one and then we can propose it as a general solution for MP?

rotty3000 commented 6 years ago

I will do that in the coming weeks.

rotty3000 commented 6 years ago

All, I've sent the following PR https://github.com/eclipse/microprofile-jwt-auth/pull/108 (note I've done this for all official microprofile projects). Thoughts welcome.