diff --git a/src/main/java/com/ysoft/geecon/IndexResource.java b/src/main/java/com/ysoft/geecon/IndexResource.java new file mode 100644 index 0000000..612b187 --- /dev/null +++ b/src/main/java/com/ysoft/geecon/IndexResource.java @@ -0,0 +1,30 @@ +package com.ysoft.geecon; + +import io.quarkus.qute.CheckedTemplate; +import io.quarkus.qute.TemplateInstance; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +@Path("/") +public class IndexResource { + + @GET + @Produces(MediaType.TEXT_HTML) + public TemplateInstance index() { + return Templates.index(); + } + + + @CheckedTemplate + public static class Templates { + public static native TemplateInstance index(); + } +} + + + + + + diff --git a/src/main/java/com/ysoft/geecon/webauthn/LoginResource.java b/src/main/java/com/ysoft/geecon/webauthn/LoginResource.java deleted file mode 100644 index c60ce5b..0000000 --- a/src/main/java/com/ysoft/geecon/webauthn/LoginResource.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.ysoft.geecon.webauthn; - -import com.ysoft.geecon.repo.UsersRepo; -import io.quarkus.security.webauthn.WebAuthnLoginResponse; -import io.quarkus.security.webauthn.WebAuthnRegisterResponse; -import io.quarkus.security.webauthn.WebAuthnSecurity; -import io.vertx.ext.auth.webauthn.Authenticator; -import io.vertx.ext.web.RoutingContext; -import jakarta.inject.Inject; -import jakarta.ws.rs.BeanParam; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; - -import java.net.URI; - -@Path("webauthn") -public class LoginResource { - - @Inject - WebAuthnSecurity webAuthnSecurity; - @Inject - UsersRepo usersRepo; - - @Path("/login") - @POST - public Response login(@BeanParam WebAuthnLoginResponse webAuthnResponse, - RoutingContext ctx) { - // Input validation - if (!webAuthnResponse.isSet() - || !webAuthnResponse.isValid()) { - return Response.status(Status.BAD_REQUEST).build(); - } - - Authenticator authenticator = this.webAuthnSecurity.login(webAuthnResponse, ctx) - .await().indefinitely(); - - return Response.seeOther(URI.create("/")).build(); - } - - @Path("/register") - @POST - public Response register(@BeanParam WebAuthnRegisterResponse webAuthnResponse, - RoutingContext ctx) { - // Input validation - if (!webAuthnResponse.isSet() || !webAuthnResponse.isValid()) { - return Response.status(Status.BAD_REQUEST).build(); - } - - Authenticator authenticator = this.webAuthnSecurity.register(webAuthnResponse, ctx) - .await().indefinitely(); - - return Response.seeOther(URI.create("/")).build(); - } -} \ No newline at end of file diff --git a/src/main/resources/META-INF/resources/index.html b/src/main/resources/META-INF/resources/index.html deleted file mode 100644 index d8a2134..0000000 --- a/src/main/resources/META-INF/resources/index.html +++ /dev/null @@ -1,254 +0,0 @@ - - -
- -