You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unused import in TokenSecuredResource class: import jakarta.inject.Inject;
And we should add the import import jakarta.enterprise.context.ApplicationScoped; because @ApplicationScoped annotation is there.
It would be good to have a link reference to show how to obtain the oAuth2 server up and get the token. I think, a more detailed explanation could be provided on using the OAuth2 introspection endpoint URL to validate the token and collect authentication information. This enhancement would contribute to a better user experience when following the guide.
Also, should be added the next dependency used in the TokenSecuredResourceTest: <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <scope>test</scope> </dependency>
Following all the guide and creating the classes from the guide if I execute: ./mvnw quarkus:dev and execute the tests [r] I got the next error trace:
2023-12-14 15:48:28,903 ERROR [io.qua.test] (Test runner thread) Test TokenSecuredResourceTest#testRolesAllowed() failed
: java.lang.RuntimeException: java.lang.RuntimeException: Unable to start Quarkus test resource class org.acme.security.oauth2.MockAuthorizationServerTestResource
at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:638)
at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:722)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.lang.RuntimeException: Unable to start Quarkus test resource class org.acme.security.oauth2.MockAuthorizationServerTestResource
at io.quarkus.test.common.TestResourceManager$TestResourceEntryRunnable.run(TestResourceManager.java:506)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Suppressed: java.lang.RuntimeException: Unable to stop Quarkus test resource org.acme.security.oauth2.MockAuthorizationServerTestResource@1c5c7fef
at io.quarkus.test.common.TestResourceManager.close(TestResourceManager.java:179)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:321)
at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:605)
at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:655)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: STOPPED
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
at org.eclipse.jetty.server.Server.doStop(Server.java:490)
at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:132)
at com.github.tomakehurst.wiremock.jetty.JettyHttpServer.stop(JettyHttpServer.java:228)
at com.github.tomakehurst.wiremock.WireMockServer.stop(WireMockServer.java:157)
at org.acme.security.oauth2.MockAuthorizationServerTestResource.stop(MockAuthorizationServerTestResource.java:31)
at io.quarkus.test.common.TestResourceManager.close(TestResourceManager.java:177)
... 4 more
Caused by: java.lang.IllegalStateException: STOPPED
at org.eclipse.jetty.server.handler.ContextHandler.shutdown(ContextHandler.java:774)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
at org.eclipse.jetty.util.component.Graceful.shutdown(Graceful.java:146)
... 10 more
Caused by: com.github.tomakehurst.wiremock.common.FatalStartupException: java.lang.RuntimeException: java.io.IOException: Failed to bind to /0.0.0.0:8080
at com.github.tomakehurst.wiremock.WireMockServer.start(WireMockServer.java:166)
at org.acme.security.oauth2.MockAuthorizationServerTestResource.start(MockAuthorizationServerTestResource.java:17)
at io.quarkus.test.common.TestResourceManager$TestResourceEntryRunnable.run(TestResourceManager.java:500)
... 4 more
Caused by: java.lang.RuntimeException: java.io.IOException: Failed to bind to /0.0.0.0:8080
at com.github.tomakehurst.wiremock.jetty.JettyHttpServer.start(JettyHttpServer.java:198)
at com.github.tomakehurst.wiremock.WireMockServer.start(WireMockServer.java:164)
... 6 more
Caused by: java.io.IOException: Failed to bind to /0.0.0.0:8080
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:304)
at org.eclipse.jetty.server.Server.lambda$doStart$0(Server.java:402)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.eclipse.jetty.server.Server.doStart(Server.java:398)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
at com.github.tomakehurst.wiremock.jetty.JettyHttpServer.start(JettyHttpServer.java:196)
... 7 more
Caused by: java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:555)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
... 22 more
2023-12-14 15:48:28,906 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> Summary: <<<<<<<<<<<<<<<<<<<<
TokenSecuredResourceTest#testRolesAllowed() java.lang.RuntimeException: Unable to start Quarkus test resource class org.acme.security.oauth2.MockAuthorizationServerTestResource
2023-12-14 15:48:28,909 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> 1 TEST FAILED <<<<<<<<<<<<<<<<<<<<
--
1 test failed (0 passing, 1 skipped), 1 test was run in 1343ms. Tests completed at 15:48:28.
Maybe I am missing something or how should be executed correctly to do it works?
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of uname -a or ver
No response
Output of java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of mvnw --version or gradlew --version)
No response
Additional information
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
I went through https://quarkus.io/version/main/guides/security-oauth2 guide and found the following issues:
Unused import in TokenSecuredResource class:
import jakarta.inject.Inject;
And we should add the import
import jakarta.enterprise.context.ApplicationScoped;
because @ApplicationScoped annotation is there.It would be good to have a link reference to show how to obtain the oAuth2 server up and get the token. I think, a more detailed explanation could be provided on using the OAuth2 introspection endpoint URL to validate the token and collect authentication information. This enhancement would contribute to a better user experience when following the guide.
Also, should be added the next dependency used in the TokenSecuredResourceTest:
<dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <scope>test</scope> </dependency>
Following all the guide and creating the classes from the guide if I execute:
./mvnw quarkus:dev
and execute the tests [r] I got the next error trace:Maybe I am missing something or how should be executed correctly to do it works?
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: