A demo API for a presentation on Rust/Axum Architecture and for the enterprise.
docker build -t rust-axum-jwt-postgresql-demo .
docker run -p 3000:3000 rust-axum-jwt-postgresql-demo -e JWT_SECRET=bar
- get an authorization token:
curl -s \
-w '\n' \
-H 'Content-Type: application/json' \
-d '{"client_id":"foo","client_secret":"bar"}' \
http:localhost:3000/authorize
- visit the protected area using the authorized token
curl -s \
-w '\n' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJiQGIuY29tIiwiY29tcGFueSI6IkFDTUUiLCJleHAiOjEwMDAwMDAwMDAwfQ.M3LAZmrzUkXDC1q5mSzFAs_kJrwuKz3jOoDmjJ0G4gM' \
http:localhost:3000/protected
- try to visit the protected area using an invalid token
curl -s \
-w '\n' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer blahblahblah' \
http:localhost:3000/protected
cargo build --target=i686-pc-windows-msvc
cargo run --target=i686-pc-windows-msvc