Skip to content

Commit

Permalink
fix: add webauth4jn-test dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
tamassoltesz committed Feb 18, 2025
1 parent 96796c9 commit e3bcc00
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ dependencies {
implementation group: 'com.googlecode.libphonenumber', name: 'libphonenumber', version: '8.13.25'

// https://mvnrepository.com/artifact/com.webauthn4j/webauthn4j-core
implementation group: 'com.webauthn4j', name: 'webauthn4j-core', version: '0.28.3.RELEASE'
implementation group: 'com.webauthn4j', name: 'webauthn4j-core', version: '0.28.5.RELEASE'

// https://mvnrepository.com/artifact/com.webauthn4j/webauthn4j-test
implementation group: 'com.webauthn4j', name: 'webauthn4j-test', version: '0.28.5.RELEASE'

compileOnly project(":supertokens-plugin-interface")
testImplementation project(":supertokens-plugin-interface")
Expand All @@ -89,7 +92,6 @@ dependencies {
testImplementation group: 'org.reflections', name: 'reflections', version: '0.9.10'

testImplementation 'com.tngtech.archunit:archunit-junit4:0.22.0'

}

application {
Expand Down
9 changes: 7 additions & 2 deletions implementationDependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@
"src": "https://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber/8.13.25/libphonenumber-8.13.25-sources.jar"
},
{
"jar": "https://repo1.maven.org/maven2/com/webauthn4j/webauthn4j-core/0.28.3.RELEASE/webauthn4j-core-0.28.3.RELEASE.jar",
"jar": "https://repo1.maven.org/maven2/com/webauthn4j/webauthn4j-core/0.28.3.RELEASE/webauthn4j-core-0.28.5.RELEASE.jar",
"name": "webauthn4j-core 0.28.3.RELEASE",
"src": "https://repo1.maven.org/maven2/com/webauthn4j/webauthn4j-core/0.28.3.RELEASE/webauthn4j-core-0.28.3.RELEASE-sources.jar"
"src": "https://repo1.maven.org/maven2/com/webauthn4j/webauthn4j-core/0.28.3.RELEASE/webauthn4j-core-0.28.5.RELEASE-sources.jar"
},
{
"jar": "https://repo1.maven.org/maven2/com/webauthn4j/webauthn4j-test/0.28.5.RELEASE/webauthn4j-test-0.28.5.RELEASE.jar",
"name": "webauthn4j-test 0.28.5.RELEASE",
"src": "https://repo1.maven.org/maven2/com/webauthn4j/webauthn4j-test/0.28.5.RELEASE/webauthn4j-test-0.28.5.RELEASE-sources.jar"
}
]
}
29 changes: 29 additions & 0 deletions src/test/java/io/supertokens/test/webauthn/WebAuthNFlowTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
package io.supertokens.test.webauthn;

import com.google.gson.JsonObject;
import com.webauthn4j.test.EmulatorUtil;
import com.webauthn4j.test.client.ClientPlatform;
import io.supertokens.Main;
import io.supertokens.ProcessState;
import io.supertokens.emailpassword.EmailPassword;
import io.supertokens.featureflag.EE_FEATURES;
Expand All @@ -28,20 +31,29 @@
import io.supertokens.test.TestingProcessManager;
import io.supertokens.test.Utils;
import io.supertokens.test.httpRequest.HttpRequestForTesting;
import io.supertokens.test.httpRequest.HttpResponseException;
import io.supertokens.utils.SemVer;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;

import static org.junit.Assert.assertNotNull;

public class WebAuthNFlowTest {


// },
// {
// "jar": "https://repo1.maven.org/maven2/com/webauthn4j/webauthn4j-test/0.28.5.RELEASE/webauthn4j-test-0.28.5.RELEASE.jar",
// "name": "webauthn4j-test 0.28.5.RELEASE",
// "src": "https://repo1.maven.org/maven2/com/webauthn4j/webauthn4j-test/0.28.5.RELEASE/webauthn4j-test-0.28.5.RELEASE-sources.jar"

@Rule
public TestRule watchman = Utils.getOnFailure();

Expand Down Expand Up @@ -129,6 +141,21 @@ public void optionsRegisterAPITest() throws Exception {
System.out.println(signupResponse.toString());
}

private JsonObject registerOptions(Main main, String email) throws HttpResponseException, IOException {
JsonObject requestBody = new JsonObject();
requestBody.addProperty("email",email);
requestBody.addProperty("relyingPartyName","supertokens.com");
requestBody.addProperty("relyingPartyId","supertokens.com");
requestBody.addProperty("origin","supertokens.com");
requestBody.addProperty("timeout",10000);

JsonObject response = HttpRequestForTesting.sendJsonPOSTRequest(main, "",
"http://localhost:3567/recipe/webauthn/options/register",
requestBody, 10000, 10000, null, SemVer.v5_2.get(), null);

return response;
}

@Test
public void signUpFlow() throws Exception {
String[] args = {"../"};
Expand All @@ -139,5 +166,7 @@ public void signUpFlow() throws Exception {
process.startProcess();
assertNotNull(process.checkOrWaitForEvent(ProcessState.PROCESS_STATE.STARTED));

ClientPlatform clientPlatform = EmulatorUtil.createClientPlatform();

}
}

0 comments on commit e3bcc00

Please sign in to comment.