Skip to content

Instantly share code, notes, and snippets.

@marcofanti
Created August 26, 2023 10:25
Show Gist options
  • Save marcofanti/4255424f95f66e89cbbd70d8b8ea3bee to your computer and use it in GitHub Desktop.
Save marcofanti/4255424f95f66e89cbbd70d8b8ea3bee to your computer and use it in GitHub Desktop.
How to Create Your Own Test Site for Testing Passkeys using `java-webauthn-server`

How to Create Your Own Test Site for Testing Passkeys using java-webauthn-server

Below is a step-by-step guide on setting up a test site to test passkeys. This will involve setting up Java, signing up for ngrok.com, cloning a repository, and running a Gradle wrapper.

**1. Installing Java 17**

**NOTE**: Java 20 is not supported for this guide.

1.1. Visit the Java download page: [https://adoptium.net/temurin/releases/)

1.2. Select "OpenJDK 17" from the dropdown menu.

1.3. Download the installer appropriate for your operating system.

1.4. Once downloaded, run the installer and follow the on-screen instructions to install Java 17.

**To verify your installation**:

Open a terminal or command prompt and run:
```
java -version
```
You should see `OpenJDK version "17"` or similar in the output.

2. Sign up for ngrok.com

2.2. Click on "Sign Up" or "Get Started for Free".

2.3. Follow the on-screen instructions to create an account.

**3. Cloning the Git Repository**

3.1. Open a terminal or command prompt.

3.2. Navigate to the directory where you want to clone the repository.

3.3. Run the following command:
```
git clone https://github.com/Yubico/java-webauthn-server.git
```

3.4. Once the cloning is done, navigate to the cloned directory:
```
cd java-webauthn-server
```

4. Running gradlew

4.1. In the root directory of the cloned repository (java-webauthn-server), you’ll find a file named gradlew (or gradlew.bat for Windows).

4.2. To run the Gradle wrapper, execute the following command for UNIX-like systems:

./gradlew tasks

or for Windows:

gradlew.bat tasks

4.3. This will list all available tasks. You can replace tasks with the specific task you want to run based on the project’s documentation.

**5. Testing with ngrok**

After setting up your test site, you might want to expose it to the internet for testing purposes. Ngrok can help with that.

5.1. Download and setup ngrok based on instructions in your ngrok account.

5.2. Once ngrok is set up, in the terminal, navigate to where ngrok is installed and execute:
```
ngrok http 8080
```
Replace `8080` with the port your test site runs on if it's different.

5.3. ngrok will provide you with a public URL. Use this URL to access your test site from any location.

With these steps completed, you should have a working test site to try out passkeys. Remember to consult the official documentation of each tool for detailed configuration options and further reading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment