Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWT-security has errors when used with opentracing extension. #369

Closed
sean-scott-lr opened this issue Nov 12, 2019 · 11 comments
Closed

JWT-security has errors when used with opentracing extension. #369

sean-scott-lr opened this issue Nov 12, 2019 · 11 comments

Comments

@sean-scott-lr
Copy link

sean-scott-lr commented Nov 12, 2019

  1. Follow the security-jwt guide link
  2. Add opentracing extension ( add to pom.xml )
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-opentracing</artifactId>
    </dependency> 
  1. Send a GET request to http://localhost:8080/secured/roles-allowed with no Authorization Header ( or with a bogus value for the Bearer token )
  2. Observe log message
Caused by: java.io.IOException: UT000034: Stream is closed
        at io.undertow.servlet.spec.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:126)
        at io.undertow.servlet.spec.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:115)
        at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseWrapper$DeferredOutputStream.write(HttpServletResponseWrapper.java:39)
        at org.jboss.resteasy.util.CommitHeaderOutputStream.write(CommitHeaderOutputStream.java:64)
        at org.jboss.resteasy.plugins.providers.StringTextStar.writeTo(StringTextStar.java:65)
        at org.jboss.resteasy.plugins.providers.StringTextStar.writeTo(StringTextStar.java:24)
        at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.writeTo(AbstractWriterInterceptorContext.java:193)
        at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.writeTo(ServerWriterInterceptorContext.java:64)
        at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:155)
        at org.jboss.resteasy.core.ServerResponseWriter.lambda$writeNomapResponse$2(ServerResponseWriter.java:156)
        at org.jboss.resteasy.core.interception.jaxrs.ContainerResponseContextImpl.filter(ContainerResponseContextImpl.java:404)
        at org.jboss.resteasy.core.ServerResponseWriter.executeFilters(ServerResponseWriter.java:232)
        at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:97)
        at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:70)
        at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:217)
        ... 57 more
@sean-scott-lr
Copy link
Author

Version 1.0.0.CR1

@cescoffier
Copy link
Member

@sberyozkin ?

@sberyozkin
Copy link
Member

@sean-scott-lr @cescoffier quarkus-smallrye-jwt works with Vertx HTTP, right ? Just noticed the Undertow exception

@cescoffier
Copy link
Member

You can still add quarkus-undertow as a dependency, and deploy your servlets.

@sberyozkin
Copy link
Member

@cescoffier thanks, but here we have a JAX-RS app. Should the fix be about removing this dependency ? Otherwise I guess it has to be excluded in this case in the demo ?

@sberyozkin
Copy link
Member

I will try to exclude

@sberyozkin
Copy link
Member

Going to open a quarkus issue

@sean-scott-lr
Copy link
Author

@sberyozkin Correct, I am not trying to use servlets or undertow. ( I have not added quarkus-undertow as a dependency) I am just using JAX-RS.

@sberyozkin
Copy link
Member

@sean-scott-lr can you please exclude quarkus-undertow from quarkus-smallrye-opentracing ?
I'm getting

Caused by: java.lang.NoClassDefFoundError: io/quarkus/undertow/runtime/UndertowDeploymentRecorder

But the build itself passes when I remove this dependency in Quarkus master

@sean-scott-lr
Copy link
Author

sean-scott-lr commented Nov 12, 2019

I tried changing the dependency in my pom.xml to

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-smallrye-opentracing</artifactId>
      <exclusions>
        <exclusion>
          <groupId>io.quarkus</groupId>
          <artifactId>quarkus-undertow</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

Still see this in the logs.

Caused by: java.io.IOException: UT000034: Stream is closed
        at io.undertow.servlet.spec.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:126)
        at io.undertow.servlet.spec.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:115)
        at org.jboss.resteasy.plugins.server.servlet.HttpServletResponseWrapper$DeferredOutputStream.write(HttpServletResponseWrapper.java:39)
        at org.jboss.resteasy.util.CommitHeaderOutputStream.write(CommitHeaderOutputStream.java:64)
        at org.jboss.resteasy.plugins.providers.StringTextStar.writeTo(StringTextStar.java:66)
        at org.jboss.resteasy.plugins.providers.StringTextStar.writeTo(StringTextStar.java:24)
        at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.writeTo(AbstractWriterInterceptorContext.java:193)
        at org.jboss.resteasy.core.interception.jaxrs.ServerWriterInterceptorContext.writeTo(ServerWriterInterceptorContext.java:64)
        at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:155)
        at org.jboss.resteasy.core.ServerResponseWriter.lambda$writeNomapResponse$2(ServerResponseWriter.java:156)
        at org.jboss.resteasy.core.interception.jaxrs.ContainerResponseContextImpl.filter(ContainerResponseContextImpl.java:404)
        at org.jboss.resteasy.core.ServerResponseWriter.executeFilters(ServerResponseWriter.java:232)
        at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:97)
        at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:70)
        at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:217)
        ... 57 more

Edit:
I should note that I see the result above using quarkus:dev... it appears that it is because the quarkus:dev maven extension is pulling in the undertow dependency itself. When I run the test target, I see the same result as @sberyozkin

@sberyozkin
Copy link
Member

Opened quarkusio/quarkus#5419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants