Skip to content

Commit

Permalink
Added WebAuthn4J module
Browse files Browse the repository at this point in the history
Almost the same API as the WebAuthn module, but backed by WebAuthn4J
  • Loading branch information
FroMage committed Oct 10, 2024
1 parent 70abe97 commit f2fe958
Show file tree
Hide file tree
Showing 36 changed files with 4,871 additions and 5 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<module>vertx-auth-htdigest</module>
<module>vertx-auth-htpasswd</module>
<module>vertx-auth-webauthn</module>
<module>vertx-auth-webauthn4j</module>
<module>vertx-auth-properties</module>
<module>vertx-auth-sql-client</module>
<module>vertx-auth-otp</module>
Expand Down
10 changes: 5 additions & 5 deletions vertx-auth-common/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
io.vertx.ext.auth.impl.hash.SHA512,
io.vertx.ext.auth.impl.hash.PBKDF2;

exports io.vertx.ext.auth.impl to io.vertx.auth.htdigest, io.vertx.auth.htpasswd, io.vertx.auth.oauth2, io.vertx.auth.otp, io.vertx.auth.sqlclient, io.vertx.auth.webauthn;
exports io.vertx.ext.auth.impl.jose to io.vertx.auth.jwt, io.vertx.auth.oauth2, io.vertx.auth.webauthn, io.vertx.tests;
exports io.vertx.ext.auth.impl.cose to io.vertx.auth.webauthn, io.vertx.tests;
exports io.vertx.ext.auth.impl.asn to io.vertx.auth.webauthn;
exports io.vertx.ext.auth.impl to io.vertx.auth.htdigest, io.vertx.auth.htpasswd, io.vertx.auth.oauth2, io.vertx.auth.otp, io.vertx.auth.sqlclient, io.vertx.auth.webauthn, io.vertx.auth.webauthn4j;
exports io.vertx.ext.auth.impl.jose to io.vertx.auth.jwt, io.vertx.auth.oauth2, io.vertx.auth.webauthn, io.vertx.auth.webauthn4j, io.vertx.tests;
exports io.vertx.ext.auth.impl.cose to io.vertx.auth.webauthn, io.vertx.auth.webauthn4j, io.vertx.tests;
exports io.vertx.ext.auth.impl.asn to io.vertx.auth.webauthn, io.vertx.auth.webauthn4j;
exports io.vertx.ext.auth.authorization.impl to io.vertx.auth.abac;
exports io.vertx.ext.auth.impl.http to io.vertx.auth.oauth2, io.vertx.auth.webauthn;
exports io.vertx.ext.auth.impl.http to io.vertx.auth.oauth2, io.vertx.auth.webauthn, io.vertx.auth.webauthn4j;

}
2 changes: 2 additions & 0 deletions vertx-auth-webauthn4j/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vertx-auth-webauthn/
/.apt_generated_tests/
23 changes: 23 additions & 0 deletions vertx-auth-webauthn4j/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
= Vert.x WebAuthN4J Auth

This component contains a WebAuthn authentication mechanism using https://github.com/webauthn4j/webauthn4j[WebAuthn4J].
To use this project, add the following dependency to the _dependencies_ section of your build descriptor:

FIDO2 is a "passwordless" authentication mechanism and the JavaScript API is more known as WebAuthN.

WebAuthN allows users to authenticate using a secure device or token and no passwords are exchange between the browser and the server (also known as Relay Party).

The current implementation supports both authentication and device attestation.

Device attestation is a verification of the device itself.
Currently the following attestations are implemented:

* none
* U2F (FIDO-U2F tokens, e.g.: Yubikey's)
* Packed
* Android Key
* Android Safetynet
* TPM
* Apple
128 changes: 128 additions & 0 deletions vertx-auth-webauthn4j/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2014 Red Hat, Inc.
~
~ All rights reserved. This program and the accompanying materials
~ are made available under the terms of the Eclipse Public License v1.0
~ and Apache License v2.0 which accompanies this distribution.
~
~ The Eclipse Public License is available at
~ http://www.eclipse.org/legal/epl-v10.html
~
~ The Apache License v2.0 is available at
~ http://www.opensource.org/licenses/apache2.0.php
~
~ You may elect to redistribute this code under either of these licenses.
-->

<project xmlns="https://maven.apache.org/POM/4.0.0"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>vertx-auth-parent</artifactId>
<groupId>io.vertx</groupId>
<version>5.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>vertx-auth-webauthn4j</artifactId>

<properties>
<doc.skip>false</doc.skip>
<webauthn4j.version>0.27.0.RELEASE</webauthn4j.version>
</properties>


<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-auth-common</artifactId>
</dependency>
<dependency>
<groupId>com.webauthn4j</groupId>
<artifactId>webauthn4j-core-async</artifactId>
<version>${webauthn4j.version}</version>
</dependency>
<dependency>
<groupId>com.webauthn4j</groupId>
<artifactId>webauthn4j-metadata-async</artifactId>
<version>${webauthn4j.version}</version>
</dependency>
<dependency>
<groupId>com.webauthn4j</groupId>
<artifactId>webauthn4j-test</artifactId>
<scope>test</scope>
<version>${webauthn4j.version}</version>
<exclusions>
<!--Causes double module import by different paths otherwise-->
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-unit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${basedir}/src/main/js/vertx-auth-webauthn4j.js</file>
<classifier>client</classifier>
<type>js</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>IT</id>
<activation>
<property>
<name>env.CI</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<useModulePath>false</useModulePath>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
125 changes: 125 additions & 0 deletions vertx-auth-webauthn4j/src/main/asciidoc/enums.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
= Enums

[[Attestation]]
== Attestation

++++
AttestationConveyancePreference
https://www.w3.org/TR/webauthn/#attestation-convey
++++
'''

[cols=">25%,75%"]
[frame="topbot"]
|===
^|Name | Description
|
[[NONE]]`NONE`|-
|
[[INDIRECT]]`INDIRECT`|-
|
[[DIRECT]]`DIRECT`|-
|===

[[AuthenticatorAttachment]]
== AuthenticatorAttachment

++++
AuthenticatorAttachment
https://www.w3.org/TR/webauthn/#enumdef-authenticatorattachment
++++
'''

[cols=">25%,75%"]
[frame="topbot"]
|===
^|Name | Description
|
[[PLATFORM]]`PLATFORM`|-
|
[[CROSS_PLATFORM]]`CROSS_PLATFORM`|-
|===

[[AuthenticatorTransport]]
== AuthenticatorTransport

++++
AuthenticatorTransport
https://www.w3.org/TR/webauthn/#enumdef-authenticatortransport
++++
'''

[cols=">25%,75%"]
[frame="topbot"]
|===
^|Name | Description
|
[[USB]]`USB`|-
|
[[NFC]]`NFC`|-
|
[[BLE]]`BLE`|-
|
[[INTERNAL]]`INTERNAL`|-
|===

[[PublicKeyCredential]]
== PublicKeyCredential

++++
PublicKeyCredential
https://www.iana.org/assignments/cose/cose.xhtml#algorithms
++++
'''

[cols=">25%,75%"]
[frame="topbot"]
|===
^|Name | Description
|
[[ES256]]`ES256`|-
|
[[ES384]]`ES384`|-
|
[[ES512]]`ES512`|-
|
[[PS256]]`PS256`|-
|
[[PS384]]`PS384`|-
|
[[PS512]]`PS512`|-
|
[[ES256K]]`ES256K`|-
|
[[RS256]]`RS256`|-
|
[[RS384]]`RS384`|-
|
[[RS512]]`RS512`|-
|
[[RS1]]`RS1`|-
|
[[EdDSA]]`EdDSA`|-
|===

[[UserVerification]]
== UserVerification

++++
UserVerificationRequirement
https://www.w3.org/TR/webauthn/#enumdef-userverificationrequirement
++++
'''

[cols=">25%,75%"]
[frame="topbot"]
|===
^|Name | Description
|
[[REQUIRED]]`REQUIRED`|-
|
[[PREFERRED]]`PREFERRED`|-
|
[[DISCOURAGED]]`DISCOURAGED`|-
|===

Loading

0 comments on commit f2fe958

Please sign in to comment.