Skip to content

A demo API for a presentation on Rust/Rocket Architecture and for the enterprise.

License

Notifications You must be signed in to change notification settings

UsiDiamond/rust-axum-jwt-postgresql-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-axum-jwt-postgresql-demo Unit Tests

A demo API for a presentation on Rust/Axum Architecture and for the enterprise.

Run example with Doocker

Build a Docker image

docker build -t rust-axum-jwt-postgresql-demo .

Run a Docker container

docker run -p 3000:3000 rust-axum-jwt-postgresql-demo -e JWT_SECRET=bar

Trying it out

  • 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

Developer Notes

Build locally on Windows by command line

cargo build --target=i686-pc-windows-msvc

Run on Windows by command line

cargo run --target=i686-pc-windows-msvc

About

A demo API for a presentation on Rust/Rocket Architecture and for the enterprise.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published