An exercise into how to create a HTTP service using Rust, similar to oauth-api-go and oauth-api.
- Rust 1.92
- (Windows only) Build Tools for Visual Studio with these individual components:
- https://rust-lang.github.io/rustup/installation/windows-msvc.html
- "Build Tools for Visual Studio" can be found via https://visualstudio.microsoft.com/downloads
- Using that install these components:
- MSVC Build Tools for x86/x64 (latest)
- Windows 11 SDK (10.0.22621.0)
├── src # Application source code
│ ├── token # Shared token logic
│ │ └── ...etc
│ ├── token_exchange # Token exchange endpoint
│ │ └── ...etc
│ ├── token_introspection # Token introspection endpoint
│ │ └── ...etc
│ └── main.rs # Application entry point
├── scripts
│ └── http # Jetbrains HTTP Client requests, with assertions.
└── README.md
The standard Cargo (Rust build tool) approach
cargo buildThe standard Cargo (Rust build tool) approach
cargo testThe standard Cargo (Rust build tool) approach
cargo runHit the token exchange endpoint with a password grant (yeah its deprecated; but it's a quick lazy way to start).
curl -vvv -X POST -H 'Content-Type: application/x-www-form-urlencoded' -u 'aardvark:badger' -d 'grant_type=password&scope=basic&username=aardvark&password=P%4055w0rd' http://127.0.0.1:8080/token- https://docs.rs/axum/latest/axum/index.html
- https://docs.rs/axum-extra/latest/axum_extra/index.html
- https://docs.rs/axum/latest/axum/extract/index.html
- https://docs.rs/axum/latest/axum/middleware/index.html
- https://docs.rs/axum/latest/axum/error_handling/index.html
- https://docs.rs/tower/latest/tower