resources =
+ AttestationResolver.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
+
+ while (resources.hasMoreElements()) {
+ final URL resource = resources.nextElement();
+ final Manifest manifest = new Manifest(resource.openStream());
+ if ("java-webauthn-server-attestation"
+ .equals(manifest.getMainAttributes().getValue("Implementation-Id"))) {
+ return manifest.getMainAttributes().getValue(key);
+ }
}
-
- @Test
- public void customImplementationPropertiesAreSet() throws IOException {
- assertTrue(lookup("Git-Commit").matches("^[a-f0-9]{40}$"));
- }
-
+ throw new NoSuchElementException("Could not find \"" + key + "\" in manifest.");
+ }
+
+ @Test
+ public void standardImplementationPropertiesAreSet() throws IOException {
+ assertTrue(lookup("Implementation-Title").contains("attestation"));
+ assertTrue(lookup("Implementation-Version").matches("^\\d+\\.\\d+\\.\\d+(-.*)?"));
+ assertEquals("Yubico", lookup("Implementation-Vendor"));
+ }
+
+ @Test
+ public void customImplementationPropertiesAreSet() throws IOException {
+ assertTrue(
+ lookup("Git-Commit").matches("^[a-f0-9]{40}$") || lookup("Git-Commit").equals("UNKNOWN"));
+ }
}
diff --git a/test-dependent-projects/java-dep-webauthn-server-core-minimal/src/test/java/com/yubico/webauthn/BouncyCastleProviderPresenceTest.java b/test-dependent-projects/java-dep-webauthn-server-core-minimal/src/test/java/com/yubico/webauthn/BouncyCastleProviderPresenceTest.java
index d9ca840d2..e3dc68d5a 100644
--- a/test-dependent-projects/java-dep-webauthn-server-core-minimal/src/test/java/com/yubico/webauthn/BouncyCastleProviderPresenceTest.java
+++ b/test-dependent-projects/java-dep-webauthn-server-core-minimal/src/test/java/com/yubico/webauthn/BouncyCastleProviderPresenceTest.java
@@ -1,78 +1,75 @@
package com.yubico.webauthn;
+import static org.junit.Assert.assertTrue;
+
import COSE.CoseException;
import com.yubico.webauthn.data.AttestationObject;
import com.yubico.webauthn.data.RelyingPartyIdentity;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
-import java.security.PublicKey;
+import java.security.Security;
import java.security.spec.InvalidKeySpecException;
+import java.util.Arrays;
import org.junit.Test;
import org.mockito.Mockito;
-import java.security.Security;
-import java.util.Arrays;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
/**
- * Test that the BouncyCastle provider is not loaded by default
- * when depending on the webauthn-server-core-minimal
package.
+ * Test that the BouncyCastle provider is not loaded by default when depending on the
+ * webauthn-server-core-minimal
package.
*
- * Motivation: https://github.com/Yubico/java-webauthn-server/issues/97
+ * Motivation: https://github.com/Yubico/java-webauthn-server/issues/97
*/
public class BouncyCastleProviderPresenceTest {
- @Test(expected = ClassNotFoundException.class)
- public void bouncyCastleProviderIsNotInClasspath() throws ClassNotFoundException {
- Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
- }
+ @Test(expected = ClassNotFoundException.class)
+ public void bouncyCastleProviderIsNotInClasspath() throws ClassNotFoundException {
+ Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
+ }
- @Test
- public void bouncyCastleProviderIsNotLoadedByDefault() {
- assertTrue(
- Arrays.stream(Security.getProviders())
- .noneMatch(prov -> prov.getName().toLowerCase().contains("bouncy"))
- );
- }
+ @Test
+ public void bouncyCastleProviderIsNotLoadedByDefault() {
+ assertTrue(
+ Arrays.stream(Security.getProviders())
+ .noneMatch(prov -> prov.getName().toLowerCase().contains("bouncy")));
+ }
- @Test
- public void bouncyCastleProviderIsNotLoadedAfterInstantiatingRelyingParty() {
- // The RelyingParty constructor has the possible side-effect of loading the BouncyCastle provider
- RelyingParty.builder()
- .identity(RelyingPartyIdentity.builder().id("foo").name("foo").build())
- .credentialRepository(Mockito.mock(CredentialRepository.class))
- .build();
+ @Test
+ public void bouncyCastleProviderIsNotLoadedAfterInstantiatingRelyingParty() {
+ // The RelyingParty constructor has the possible side-effect of loading the BouncyCastle
+ // provider
+ RelyingParty.builder()
+ .identity(RelyingPartyIdentity.builder().id("foo").name("foo").build())
+ .credentialRepository(Mockito.mock(CredentialRepository.class))
+ .build();
- assertTrue(
- Arrays.stream(Security.getProviders())
- .noneMatch(prov ->
+ assertTrue(
+ Arrays.stream(Security.getProviders())
+ .noneMatch(
+ prov ->
prov.getName().equals("BC")
- || prov.getClass().getCanonicalName().contains("bouncy")
- ));
- }
+ || prov.getClass().getCanonicalName().contains("bouncy")));
+ }
- @Test
- public void bouncyCastleProviderIsNotLoadedAfterAttemptingToLoadEddsaKey() throws IOException, CoseException, NoSuchAlgorithmException, InvalidKeySpecException {
- try {
- WebAuthnCodecs.importCosePublicKey(
- new AttestationObject(RegistrationTestData.Packed$.MODULE$.BasicAttestationEdDsa().attestationObject())
- .getAuthenticatorData()
- .getAttestedCredentialData()
- .get()
- .getCredentialPublicKey()
- );
- } catch (NoSuchAlgorithmException e) {
- // OK
- }
-
- assertTrue(
- Arrays.stream(Security.getProviders())
- .noneMatch(prov ->
- prov.getName().equals("BC")
- || prov.getClass().getCanonicalName().contains("bouncy")
- ));
+ @Test
+ public void bouncyCastleProviderIsNotLoadedAfterAttemptingToLoadEddsaKey()
+ throws IOException, CoseException, NoSuchAlgorithmException, InvalidKeySpecException {
+ try {
+ WebAuthnCodecs.importCosePublicKey(
+ new AttestationObject(
+ RegistrationTestData.Packed$.MODULE$.BasicAttestationEdDsa().attestationObject())
+ .getAuthenticatorData()
+ .getAttestedCredentialData()
+ .get()
+ .getCredentialPublicKey());
+ } catch (NoSuchAlgorithmException e) {
+ // OK
}
+ assertTrue(
+ Arrays.stream(Security.getProviders())
+ .noneMatch(
+ prov ->
+ prov.getName().equals("BC")
+ || prov.getClass().getCanonicalName().contains("bouncy")));
+ }
}
diff --git a/test-dependent-projects/java-dep-webauthn-server-core/src/main/java/com/yubico/test/compilability/ThisShouldCompile.java b/test-dependent-projects/java-dep-webauthn-server-core/src/main/java/com/yubico/test/compilability/ThisShouldCompile.java
index 4c1a8b761..5201a6409 100644
--- a/test-dependent-projects/java-dep-webauthn-server-core/src/main/java/com/yubico/test/compilability/ThisShouldCompile.java
+++ b/test-dependent-projects/java-dep-webauthn-server-core/src/main/java/com/yubico/test/compilability/ThisShouldCompile.java
@@ -12,33 +12,50 @@
public class ThisShouldCompile {
- public RelyingParty getRp() {
- return RelyingParty.builder()
- .identity(RelyingPartyIdentity.builder()
- .id("localhost")
- .name("Example RP")
- .build())
- .credentialRepository(new CredentialRepository() {
- @Override public Set getCredentialIdsForUsername(String username) { return null; }
- @Override public Optional getUserHandleForUsername(String username) { return Optional.empty(); }
- @Override public Optional getUsernameForUserHandle(ByteArray userHandle) { return Optional.empty(); }
- @Override public Optional lookup(ByteArray credentialId, ByteArray userHandle) { return Optional.empty(); }
- @Override public Set lookupAll(ByteArray credentialId) { return null; }
- })
- .build();
- }
-
- public ByteArray getByteArray() {
- ByteArray a = new ByteArray(new byte[] {1, 2, 3, 4});
- byte[] b = a.getBytes();
- return a;
- }
-
- public PublicKeyCredentialType getPublicKeyCredentialType() {
- PublicKeyCredentialType a = PublicKeyCredentialType.PUBLIC_KEY;
- String b = a.toJsonString();
- return a;
- }
+ public RelyingParty getRp() {
+ return RelyingParty.builder()
+ .identity(RelyingPartyIdentity.builder().id("localhost").name("Example RP").build())
+ .credentialRepository(
+ new CredentialRepository() {
+ @Override
+ public Set getCredentialIdsForUsername(
+ String username) {
+ return null;
+ }
+ @Override
+ public Optional getUserHandleForUsername(String username) {
+ return Optional.empty();
+ }
+ @Override
+ public Optional getUsernameForUserHandle(ByteArray userHandle) {
+ return Optional.empty();
+ }
+
+ @Override
+ public Optional lookup(
+ ByteArray credentialId, ByteArray userHandle) {
+ return Optional.empty();
+ }
+
+ @Override
+ public Set lookupAll(ByteArray credentialId) {
+ return null;
+ }
+ })
+ .build();
+ }
+
+ public ByteArray getByteArray() {
+ ByteArray a = new ByteArray(new byte[] {1, 2, 3, 4});
+ byte[] b = a.getBytes();
+ return a;
+ }
+
+ public PublicKeyCredentialType getPublicKeyCredentialType() {
+ PublicKeyCredentialType a = PublicKeyCredentialType.PUBLIC_KEY;
+ String b = a.toJsonString();
+ return a;
+ }
}
diff --git a/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/CryptoAlgorithmsTest.java b/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/CryptoAlgorithmsTest.java
index ef87ce9f3..d3b38f338 100644
--- a/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/CryptoAlgorithmsTest.java
+++ b/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/CryptoAlgorithmsTest.java
@@ -1,5 +1,8 @@
package com.yubico.webauthn;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import COSE.CoseException;
import com.yubico.webauthn.data.AttestationObject;
import com.yubico.webauthn.data.RelyingPartyIdentity;
@@ -17,66 +20,71 @@
import org.junit.Test;
import org.mockito.Mockito;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
public class CryptoAlgorithmsTest {
- private List providersBefore;
+ private List providersBefore;
- @Before
- public void setUp() {
- providersBefore = Stream.of(Security.getProviders()).collect(Collectors.toList());
+ @Before
+ public void setUp() {
+ providersBefore = Stream.of(Security.getProviders()).collect(Collectors.toList());
- // The RelyingParty constructor has the possible side-effect of loading the BouncyCastle provider
- RelyingParty.builder()
- .identity(RelyingPartyIdentity.builder().id("foo").name("foo").build())
- .credentialRepository(Mockito.mock(CredentialRepository.class))
- .build();
- }
+ // The RelyingParty constructor has the possible side-effect of loading the BouncyCastle
+ // provider
+ RelyingParty.builder()
+ .identity(RelyingPartyIdentity.builder().id("foo").name("foo").build())
+ .credentialRepository(Mockito.mock(CredentialRepository.class))
+ .build();
+ }
- @After
- public void tearDown() {
- for (Provider prov : Security.getProviders()) {
- Security.removeProvider(prov.getName());
- }
- providersBefore.forEach(Security::addProvider);
+ @After
+ public void tearDown() {
+ for (Provider prov : Security.getProviders()) {
+ Security.removeProvider(prov.getName());
}
+ providersBefore.forEach(Security::addProvider);
+ }
- @Test
- public void importRsa() throws IOException, CoseException, NoSuchAlgorithmException, InvalidKeySpecException {
- PublicKey key = WebAuthnCodecs.importCosePublicKey(
- new AttestationObject(RegistrationTestData.Packed$.MODULE$.BasicAttestationRsa().attestationObject())
+ @Test
+ public void importRsa()
+ throws IOException, CoseException, NoSuchAlgorithmException, InvalidKeySpecException {
+ PublicKey key =
+ WebAuthnCodecs.importCosePublicKey(
+ new AttestationObject(
+ RegistrationTestData.Packed$.MODULE$.BasicAttestationRsa().attestationObject())
.getAuthenticatorData()
.getAttestedCredentialData()
.get()
- .getCredentialPublicKey()
- );
- assertEquals(key.getAlgorithm(), "RSA");
- }
+ .getCredentialPublicKey());
+ assertEquals(key.getAlgorithm(), "RSA");
+ }
- @Test
- public void importEcdsa() throws IOException, CoseException, NoSuchAlgorithmException, InvalidKeySpecException {
- PublicKey key = WebAuthnCodecs.importCosePublicKey(
- new AttestationObject(RegistrationTestData.Packed$.MODULE$.BasicAttestation().attestationObject())
+ @Test
+ public void importEcdsa()
+ throws IOException, CoseException, NoSuchAlgorithmException, InvalidKeySpecException {
+ PublicKey key =
+ WebAuthnCodecs.importCosePublicKey(
+ new AttestationObject(
+ RegistrationTestData.Packed$.MODULE$.BasicAttestation().attestationObject())
.getAuthenticatorData()
.getAttestedCredentialData()
.get()
- .getCredentialPublicKey()
- );
- assertEquals(key.getAlgorithm(), "EC");
- }
+ .getCredentialPublicKey());
+ assertEquals(key.getAlgorithm(), "EC");
+ }
- @Test
- public void importEddsa() throws IOException, CoseException, NoSuchAlgorithmException, InvalidKeySpecException {
- PublicKey key = WebAuthnCodecs.importCosePublicKey(
- new AttestationObject(RegistrationTestData.Packed$.MODULE$.BasicAttestationEdDsa().attestationObject())
+ @Test
+ public void importEddsa()
+ throws IOException, CoseException, NoSuchAlgorithmException, InvalidKeySpecException {
+ PublicKey key =
+ WebAuthnCodecs.importCosePublicKey(
+ new AttestationObject(
+ RegistrationTestData.Packed$.MODULE$
+ .BasicAttestationEdDsa()
+ .attestationObject())
.getAuthenticatorData()
.getAttestedCredentialData()
.get()
- .getCredentialPublicKey()
- );
- assertTrue("EdDSA".equals(key.getAlgorithm()) || "Ed25519".equals(key.getAlgorithm()));
- }
-
+ .getCredentialPublicKey());
+ assertTrue("EdDSA".equals(key.getAlgorithm()) || "Ed25519".equals(key.getAlgorithm()));
+ }
}
diff --git a/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/meta/ManifestInfoTest.java b/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/meta/ManifestInfoTest.java
index 4a4aefd6b..2c7cad123 100644
--- a/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/meta/ManifestInfoTest.java
+++ b/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/meta/ManifestInfoTest.java
@@ -1,5 +1,8 @@
package com.yubico.webauthn.meta;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import com.yubico.webauthn.RelyingParty;
import java.io.IOException;
import java.net.URL;
@@ -9,50 +12,49 @@
import java.util.jar.Manifest;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
public class ManifestInfoTest {
- private static String lookup(String key) throws IOException {
- final Enumeration resources = RelyingParty.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
-
- while (resources.hasMoreElements()) {
- final URL resource = resources.nextElement();
- final Manifest manifest = new Manifest(resource.openStream());
- if ("java-webauthn-server".equals(manifest.getMainAttributes().getValue("Implementation-Id"))) {
- return manifest.getMainAttributes().getValue(key);
- }
- }
- throw new NoSuchElementException("Could not find \"" + key + "\" in manifest.");
- }
-
- @Test
- public void standardSpecPropertiesAreSet() throws IOException {
- assertTrue(lookup("Specification-Title").startsWith("Web Authentication"));
- assertTrue(lookup("Specification-Version").startsWith("Level"));
- assertEquals("World Wide Web Consortium", lookup("Specification-Vendor"));
+ private static String lookup(String key) throws IOException {
+ final Enumeration resources =
+ RelyingParty.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
+
+ while (resources.hasMoreElements()) {
+ final URL resource = resources.nextElement();
+ final Manifest manifest = new Manifest(resource.openStream());
+ if ("java-webauthn-server"
+ .equals(manifest.getMainAttributes().getValue("Implementation-Id"))) {
+ return manifest.getMainAttributes().getValue(key);
+ }
}
-
-
- @Test
- public void customSpecPropertiesAreSet() throws IOException {
- assertTrue(lookup("Specification-Url").startsWith("https://"));
- assertTrue(lookup("Specification-Url-Latest").startsWith("https://"));
- assertTrue(DocumentStatus.fromString(lookup("Specification-W3c-Status")).isPresent());
- assertTrue(LocalDate.parse(lookup("Specification-Release-Date")).isAfter(LocalDate.of(2019, 3, 3)));
- }
-
- @Test
- public void standardImplementationPropertiesAreSet() throws IOException {
- assertTrue(lookup("Implementation-Title").contains("Web Authentication"));
- assertTrue(lookup("Implementation-Version").matches("^\\d+\\.\\d+\\.\\d+(-.*)?"));
- assertEquals("Yubico", lookup("Implementation-Vendor"));
- }
-
- @Test
- public void customImplementationPropertiesAreSet() throws IOException {
- assertTrue(lookup("Git-Commit").matches("^[a-f0-9]{40}$"));
- }
-
+ throw new NoSuchElementException("Could not find \"" + key + "\" in manifest.");
+ }
+
+ @Test
+ public void standardSpecPropertiesAreSet() throws IOException {
+ assertTrue(lookup("Specification-Title").startsWith("Web Authentication"));
+ assertTrue(lookup("Specification-Version").startsWith("Level"));
+ assertEquals("World Wide Web Consortium", lookup("Specification-Vendor"));
+ }
+
+ @Test
+ public void customSpecPropertiesAreSet() throws IOException {
+ assertTrue(lookup("Specification-Url").startsWith("https://"));
+ assertTrue(lookup("Specification-Url-Latest").startsWith("https://"));
+ assertTrue(DocumentStatus.fromString(lookup("Specification-W3c-Status")).isPresent());
+ assertTrue(
+ LocalDate.parse(lookup("Specification-Release-Date")).isAfter(LocalDate.of(2019, 3, 3)));
+ }
+
+ @Test
+ public void standardImplementationPropertiesAreSet() throws IOException {
+ assertTrue(lookup("Implementation-Title").contains("Web Authentication"));
+ assertTrue(lookup("Implementation-Version").matches("^\\d+\\.\\d+\\.\\d+(-.*)?"));
+ assertEquals("Yubico", lookup("Implementation-Vendor"));
+ }
+
+ @Test
+ public void customImplementationPropertiesAreSet() throws IOException {
+ assertTrue(
+ lookup("Git-Commit").matches("^[a-f0-9]{40}$") || lookup("Git-Commit").equals("UNKNOWN"));
+ }
}
diff --git a/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/meta/VersionInfoTest.java b/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/meta/VersionInfoTest.java
index 3ef4f822c..e867eb214 100644
--- a/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/meta/VersionInfoTest.java
+++ b/test-dependent-projects/java-dep-webauthn-server-core/src/test/java/com/yubico/webauthn/meta/VersionInfoTest.java
@@ -1,42 +1,44 @@
package com.yubico.webauthn.meta;
-import java.time.LocalDate;
-import org.junit.Test;
-
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.time.LocalDate;
+import org.junit.Test;
+
/**
- * Since this depends on the manifest of the core jar, and the manifest is build by Gradle, this test is likely to fail
- * when run in an IDE. It works as expected when run via Gradle.
+ * Since this depends on the manifest of the core jar, and the manifest is build by Gradle, this
+ * test is likely to fail when run in an IDE. It works as expected when run via Gradle.
*/
public class VersionInfoTest {
- final VersionInfo versionInfo = VersionInfo.getInstance();
-
- @Test
- public void specPropertiesAreSet() {
- final Specification spec = versionInfo.getSpecification();
- assertTrue(spec.getLatestVersionUrl().toExternalForm().startsWith("https://"));
- assertTrue(spec.getUrl().toExternalForm().startsWith("https://"));
- assertTrue(spec.getReleaseDate().isAfter(LocalDate.of(2019, 3, 3)));
- assertNotNull(spec.getStatus());
- }
-
- @Test
- public void implementationPropertiesAreSet() {
- final Implementation impl = versionInfo.getImplementation();
- assertTrue(impl.getSourceCodeUrl().toExternalForm().startsWith("https://"));
- assertTrue(impl.getVersion().matches("^\\d+\\.\\d+\\.\\d+(-.*)?"));
- assertTrue(impl.getGitCommit().matches("^[a-f0-9]{40}$"));
+ final VersionInfo versionInfo = VersionInfo.getInstance();
+
+ @Test
+ public void specPropertiesAreSet() {
+ final Specification spec = versionInfo.getSpecification();
+ assertTrue(spec.getLatestVersionUrl().toExternalForm().startsWith("https://"));
+ assertTrue(spec.getUrl().toExternalForm().startsWith("https://"));
+ assertTrue(spec.getReleaseDate().isAfter(LocalDate.of(2019, 3, 3)));
+ assertNotNull(spec.getStatus());
+ }
+
+ @Test
+ public void implementationPropertiesAreSet() {
+ final Implementation impl = versionInfo.getImplementation();
+ assertTrue(impl.getSourceCodeUrl().toExternalForm().startsWith("https://"));
+ assertTrue(impl.getVersion().matches("^\\d+\\.\\d+\\.\\d+(-.*)?"));
+ assertTrue(
+ impl.getGitCommit().matches("^[a-f0-9]{40}$") || impl.getGitCommit().equals("UNKNOWN"));
+ }
+
+ @Test
+ public void majorVersionIsUnknownOrAtLeast1() {
+ final String version = versionInfo.getImplementation().getVersion();
+ if (!"0.1.0-SNAPSHOT".equals(version)) {
+ String[] splits = version.split("\\.");
+ final int majorVersion = Integer.parseInt(splits[0]);
+ assertTrue(majorVersion >= 1);
}
-
- @Test
- public void majorVersionIsAtLeast1() {
- final String version = versionInfo.getImplementation().getVersion();
- String[] splits = version.split("\\.");
- final int majorVersion = Integer.parseInt(splits[0]);
- assertTrue(majorVersion >= 1);
- }
-
+ }
}
diff --git a/test-dependent-projects/java-dep-yubico-util/src/main/java/com/yubico/test/compilability/ThisShouldCompile.java b/test-dependent-projects/java-dep-yubico-util/src/main/java/com/yubico/test/compilability/ThisShouldCompile.java
index 71f885e21..1a7effa38 100644
--- a/test-dependent-projects/java-dep-yubico-util/src/main/java/com/yubico/test/compilability/ThisShouldCompile.java
+++ b/test-dependent-projects/java-dep-yubico-util/src/main/java/com/yubico/test/compilability/ThisShouldCompile.java
@@ -5,8 +5,7 @@
public class ThisShouldCompile {
- public String getEncodedValue() throws JsonProcessingException {
- return JacksonCodecs.json().writeValueAsString("hej");
- }
-
+ public String getEncodedValue() throws JsonProcessingException {
+ return JacksonCodecs.json().writeValueAsString("hej");
+ }
}
diff --git a/webauthn-server-attestation/build.gradle b/webauthn-server-attestation/build.gradle
index c40388fdc..e59af0c86 100644
--- a/webauthn-server-attestation/build.gradle
+++ b/webauthn-server-attestation/build.gradle
@@ -1,12 +1,16 @@
plugins {
id 'java-library'
id 'scala'
+ id 'io.github.cosmicsilence.scalafix'
}
description = 'Yubico WebAuthn attestation subsystem'
project.ext.publishMe = true
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
+
evaluationDependsOn(':webauthn-server-core-minimal')
dependencies {
@@ -17,28 +21,32 @@ dependencies {
implementation(
project(':yubico-util'),
- addVersion('com.google.guava:guava'),
- addVersion('com.fasterxml.jackson.core:jackson-databind'),
- addVersion('org.bouncycastle:bcprov-jdk15on'),
- addVersion('org.slf4j:slf4j-api'),
+ 'com.google.guava:guava',
+ 'com.fasterxml.jackson.core:jackson-databind',
+ 'org.bouncycastle:bcprov-jdk15on',
+ 'org.slf4j:slf4j-api',
)
testImplementation(
project(':webauthn-server-core-minimal').sourceSets.test.output,
project(':yubico-util-scala'),
- addVersion('junit:junit'),
- addVersion('org.mockito:mockito-core'),
- addVersion('org.scala-lang:scala-library'),
- addVersion('org.scalacheck:scalacheck_2.13'),
- addVersion('org.scalatest:scalatest_2.13'),
+ 'junit:junit',
+ 'org.mockito:mockito-core',
+ 'org.scala-lang:scala-library',
+ 'org.scalacheck:scalacheck_2.13',
+ 'org.scalatest:scalatest_2.13',
)
testRuntimeOnly(
- addVersion('ch.qos.logback:logback-classic'),
+ 'ch.qos.logback:logback-classic',
)
testRuntimeOnly(
// Transitive dependency from :webauthn-server-core:test
- addVersion('org.bouncycastle:bcpkix-jdk15on'),
+ 'org.bouncycastle:bcpkix-jdk15on',
+ )
+
+ testRuntimeOnly(
+ 'ch.qos.logback:logback-classic',
)
}
@@ -50,7 +58,7 @@ jar {
'Implementation-Title': project.description,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Yubico',
- 'Git-Commit': getGitCommit(),
+ 'Git-Commit': getGitCommitOrUnknown(),
])
}
}
diff --git a/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/AttestationResolver.java b/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/AttestationResolver.java
index fb0d622a0..69a08efad 100644
--- a/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/AttestationResolver.java
+++ b/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/AttestationResolver.java
@@ -31,14 +31,13 @@
public interface AttestationResolver {
- /**
- * Alias of resolve(attestationCertificate, Collections.emptyList())
.
- */
- default Optional resolve(X509Certificate attestationCertificate) {
- return resolve(attestationCertificate, Collections.emptyList());
- }
+ /** Alias of resolve(attestationCertificate, Collections.emptyList())
. */
+ default Optional resolve(X509Certificate attestationCertificate) {
+ return resolve(attestationCertificate, Collections.emptyList());
+ }
- Optional resolve(X509Certificate attestationCertificate, List certificateChain);
- Attestation untrustedFromCertificate(X509Certificate attestationCertificate);
+ Optional resolve(
+ X509Certificate attestationCertificate, List certificateChain);
+ Attestation untrustedFromCertificate(X509Certificate attestationCertificate);
}
diff --git a/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/DeviceMatcher.java b/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/DeviceMatcher.java
index 163ebc14d..8fd5a8c3f 100644
--- a/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/DeviceMatcher.java
+++ b/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/DeviceMatcher.java
@@ -28,5 +28,5 @@
import java.security.cert.X509Certificate;
public interface DeviceMatcher {
- boolean matches(X509Certificate attestationCertificate, JsonNode parameters);
+ boolean matches(X509Certificate attestationCertificate, JsonNode parameters);
}
diff --git a/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/MetadataObject.java b/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/MetadataObject.java
index 1faeb7c68..7d75da901 100644
--- a/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/MetadataObject.java
+++ b/webauthn-server-attestation/src/main/java/com/yubico/webauthn/attestation/MetadataObject.java
@@ -48,79 +48,82 @@
@Slf4j
@JsonIgnoreProperties(ignoreUnknown = true)
-@EqualsAndHashCode(of = { "data" }, callSuper = false)
+@EqualsAndHashCode(
+ of = {"data"},
+ callSuper = false)
public final class MetadataObject {
- private static final ObjectMapper OBJECT_MAPPER = JacksonCodecs.json();
-
- private static final TypeReference