Bonjour François,

Is there a way for you to share the project?
I worked on the JWT implementation and the example, I might be able to help.
--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com


On Fri, Feb 22, 2019 at 4:56 PM COURTAULT Francois <
francois.courta...@gemalto.com> wrote:

> Hello,
>
> I try to build a simple sample using TomEE MP 7.1.0 but I get an error and
> I don't know what's going on or how I can fix that.
> For that, I have read the microprofile-jwt-auth-spec-1.0.pdf, so in my war
> application deployed:
>
> *         I have a public class MPJwtApplication extends Application
> annotated with @LoginConfig(authMethod = "MP-JWT", realmName = "TCK-MP-JWT")
>
> *         I have  a resource class  annotated @Path("resources")
> @RequestScoped where I have
>
> o    @Inject private JsonWebToken callerPrincipal;
>
> o    A @GET public Response test () { System.out.println("JsonWebToken:" +
> callerPrincipal + "."); return Response.ok().build();}
>
>
>
> In the war deployed, I also have a beans.xml with the following content:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee";
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
> http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd";
>        bean-discovery-mode="all">
>
> </beans>
>
>
>
> Using Soap UI, I send a GET HTTP request with an Authorization header:
> bearer <JWT Base 64 encoded>, the error I get is:
>
> 22-Feb-2019 15:32:43.729 WARNING [http-nio-8080-exec-20]
> org.apache.cxf.phase.PhaseInterceptorChain.doDefaultLogging Application {
> http://jwt.mp/}MPJwtResource has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: WebBeans producer : currentPrincipal
> return type in the component implementation class :
> org.apache.tomee.microprofile.jwt.cdi.MPJWTProducer scope type must be
> @Dependent to create null instance
>
>
>
> I was expecting to have the callerPrincipal set to null but why this CDI
> @Dependent scope error stuff ?
>
>
> Any idea ?
>
> Best Regards.
> ________________________________
> This message and any attachments are intended solely for the addressees
> and may contain confidential information. Any unauthorized use or
> disclosure, either whole or partial, is prohibited.
> E-mails are susceptible to alteration. Our company shall not be liable for
> the message if altered, changed or falsified. If you are not the intended
> recipient of this message, please delete it and notify the sender.
> Although all reasonable efforts have been made to keep this transmission
> free from viruses, the sender will not be liable for damages caused by a
> transmitted virus.
>

Reply via email to