quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.53k stars 2.61k forks source link

Security WebAuthn quickstart has no code #32376

Closed starksm64 closed 2 weeks ago

starksm64 commented 1 year ago

Describe the bug

If I go to https://code.quarkus.io and select the Security WebAuthn extension and then generate the app, the resulting bundle has not java code:

└> jar -tf /tmp/code-with-quarkus.zip 
code-with-quarkus/
code-with-quarkus/src/
code-with-quarkus/src/main/
code-with-quarkus/src/main/java/
code-with-quarkus/src/main/resources/
code-with-quarkus/src/main/resources/application.properties
code-with-quarkus/src/main/docker/
code-with-quarkus/src/main/docker/Dockerfile.legacy-jar
code-with-quarkus/src/main/docker/Dockerfile.jvm
code-with-quarkus/src/main/docker/Dockerfile.native-micro
code-with-quarkus/src/main/docker/Dockerfile.native
code-with-quarkus/.mvn/
code-with-quarkus/.mvn/wrapper/
code-with-quarkus/.mvn/wrapper/.gitignore
code-with-quarkus/.mvn/wrapper/maven-wrapper.properties
code-with-quarkus/.mvn/wrapper/MavenWrapperDownloader.java
code-with-quarkus/.gitignore
code-with-quarkus/pom.xml
code-with-quarkus/README.md
code-with-quarkus/.dockerignore
code-with-quarkus/mvnw
code-with-quarkus/mvnw.cmd

The entire https://github.com/quarkusio/quarkus-quickstarts/tree/main/security-webauthn-quickstart/src/main/java/org/acme/security/webauthn directory from the quarkus-quickstarts repo is missing.

Expected behavior

Content exists and building the app package succeeds.

Actual behavior

Content is missing and building the app package fails with:

[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.16.5.Final:build (default) on project code-with-quarkus: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]     [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 2 deployment problems: 
[ERROR] [1] Unsatisfied dependency for type io.quarkus.security.webauthn.WebAuthnUserProvider and qualifiers [@Default]
[ERROR]     - java member: io.quarkus.security.webauthn.WebAuthnTrustedIdentityProvider#userProvider
[ERROR]     - declared on CLASS bean [types=[io.quarkus.security.identity.IdentityProvider<io.quarkus.security.identity.request.TrustedAuthenticationRequest>, io.quarkus.security.webauthn.WebAuthnTrustedIdentityProvider, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.security.webauthn.WebAuthnTrustedIdentityProvider]
[ERROR] [2] Unsatisfied dependency for type io.quarkus.security.webauthn.WebAuthnUserProvider and qualifiers [@Default]
[ERROR]     - java member: io.quarkus.security.webauthn.WebAuthnAuthenticatorStorage#userProvider
[ERROR]     - declared on CLASS bean [types=[io.quarkus.security.webauthn.WebAuthnAuthenticatorStorage, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.security.webauthn.WebAuthnAuthenticatorStorage]
[ERROR]     at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1231)
[ERROR]     at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:288)
[ERROR]     at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:148)
[ERROR]     at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:526)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR]     at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
[ERROR]     at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
[ERROR]     at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR]     at java.base/java.lang.Thread.run(Thread.java:833)
[ERROR]     at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR]     Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type io.quarkus.security.webauthn.WebAuthnUserProvider and qualifiers [@Default]
[ERROR]     - java member: io.quarkus.security.webauthn.WebAuthnTrustedIdentityProvider#userProvider
[ERROR]     - declared on CLASS bean [types=[io.quarkus.security.identity.IdentityProvider<io.quarkus.security.identity.request.TrustedAuthenticationRequest>, io.quarkus.security.webauthn.WebAuthnTrustedIdentityProvider, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.security.webauthn.WebAuthnTrustedIdentityProvider]
[ERROR]         at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:440)
[ERROR]         at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
[ERROR]         at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
[ERROR]         ... 13 more
[ERROR]     Suppressed: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type io.quarkus.security.webauthn.WebAuthnUserProvider and qualifiers [@Default]
[ERROR]     - java member: io.quarkus.security.webauthn.WebAuthnAuthenticatorStorage#userProvider
[ERROR]     - declared on CLASS bean [types=[io.quarkus.security.webauthn.WebAuthnAuthenticatorStorage, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.security.webauthn.WebAuthnAuthenticatorStorage]
[ERROR]         at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:440)
[ERROR]         at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:539)
[ERROR]         at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:276)
[ERROR]         ... 13 more
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

How to Reproduce?

  1. Go to https://code.quarkus.io/?e=security-webauthn
  2. Click the Generate your application button
  3. Download the zip file
  4. Unzip and try to build

Output of uname -a or ver

Darwin Scotts-iMacPro 21.6.0 Darwin Kernel Version 21.6.0: Mon Dec 19 20:44:01 PST 2022; root:xnu-8020.240.18~2/RELEASE_X86_64 x86_64

Output of java -version

java version "17.0.3" 2022-04-19 LTS Java(TM) SE Runtime Environment (build 17.0.3+8-LTS-111) Java HotSpot(TM) 64-Bit Server VM (build 17.0.3+8-LTS-111, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.16.5.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63) Maven home: /Users/starksm/.m2/wrapper/dists/apache-maven-3.8.6-bin/67568434/apache-maven-3.8.6 Java version: 17.0.3, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-17.0.3.jdk/Contents/Home Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "12.6.3", arch: "x86_64", family: "mac"

Additional information

No response

quarkus-bot[bot] commented 1 year ago

/cc @sberyozkin (security)

geoand commented 1 year ago

cc @ia3andy for the codestart part

ia3andy commented 1 year ago

This behavior is expected:

sberyozkin commented 1 year ago

CC @FroMage Hi Steph, please comment as well

starksm64 commented 1 year ago

The with starter-code is selected in the view I have that is attached. Playing with the filtering option, unless an extension includes the starter-code label next to it, it will not be able to include code?

ia3andy commented 1 year ago

The with starter-code is selected in the view I have that is attached. Playing with the filtering option, unless an extension includes the starter-code label next to it, it will not be able to include code?

unless you pick another extension with code, or we add a codestart for WebAuthn

FroMage commented 7 months ago

I could add a codestart, but that'd be the only security extension to have one. Not sure it's worth it, if the other extensions didn't add one there must be a reason.

Perhaps your issue is that the build terminates with an ugly error, and it should just go on with a default bean that doesn't let you authenticate? This way the app starts, and you can add the required bean later to make it work?

gsmet commented 2 weeks ago

Closing this one as it's the expected behavior. We don't ship the quickstart code when creating an app, you have to follow the tutorial.

If you think Stéphane's proposal has value, please create a PR.