Skip to content

Commit

Permalink
Add WebAuthn route handlers for Axum Webauthn-rs application
Browse files Browse the repository at this point in the history
This commit introduces the main functionalities needed for a Webauthn-rs application using the Axum framework. The implemented functionalities are: start/register the request, finish/register the request, start/authentication, and finish/authentication. This commit also adds new GitHub workflows for 'Rust' and 'SonarCloud Scan', alongside other essential files required for a Rust application.
  • Loading branch information
arkavo-com committed Jul 13, 2024
1 parent 01823a5 commit 5637c3e
Show file tree
Hide file tree
Showing 7 changed files with 507 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Rust

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
target:
[
# aarch64-unknown-linux-gnu,
x86_64-unknown-linux-gnu,
]
include:
# - os: ubuntu-latest
# target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Install dependencies on Linux
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
- name: Install Rust and Build
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup target add ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }}
strip target/${{ matrix.target }}/release/backend-rust
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-build
path: target/${{ matrix.target }}/release/backend-rust
20 changes: 20 additions & 0 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Sonar
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


# Added by cargo

/target
/.idea
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# https://doc.rust-lang.org/cargo/reference/manifest.html
[package]
name = "authnz-rs"
version = "0.1.0"
edition = "2021"
license = "BSD-2"

[dependencies]
tokio = { version = "1.38.0", features = ["rt", "rt-multi-thread", "macros"] }
axum = { version="0.7.5", features = ["http2", "tokio"] }
webauthn-rs = { version="0.5.0", features = ["danger-allow-state-serialisation"] }
tower = { version="0.4.13", features = ["full"] }
tower-sessions = "0.12.2"
thiserror = "1.0.62"
log = "0.4.22"
serde = { version = "1.0.204", features = ["derive"] }
Loading

0 comments on commit 5637c3e

Please sign in to comment.