Skip to content

xyzd0/rust-authentication-microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-authentication-microservice

An authentication microservice built in Rust. This is one of my first Rust projects so there will be things to improve, and I will go back and do when I get some spare time!

Implements the ability to register new users, and authenticate existing users. No authoristion (e.g. RBAC) has been implemented, this would be done in a separate microservice.

This has been imported from another side-project, it is intended to be a demo of how Rust could be used to build a gRPC microservice. It is not ready for production use in its current state, particularly security-wise.

Technologies Used

TODOs

Rough list of things that could be improved (time permitted)!

  • Implement Certificate Authority with JWK support
  • Remove JWT_SECRET from .env. Sign and validate with a key issued from ^
  • More unit tests
  • More system tests (authentication_test crate)
  • Logging
  • Refactoring to reduce the size of files such as database.rs and repository.rs. Look to separate these out into modules for different types of data to reduce coupling.

Setup

  • Refer to the Skaffold Quickstart to details on how to set up your environment.
  • Start a local Docker registry instance.
docker run -d -p 5000:5000 --restart=always --name registry registry:2
  • Run skaffold
skaffold dev
  • Wait for it to build, the first one will be quite slow.

Notes

Postgres Port Forwarding

Run the following command to port forward the Postgres instance to your host.

kubectl port-forward $(kubectl get pods|awk '/^authentication-postgres.*Running/{print$1}'|head) 5432:5432

About

Example authentication microservice using gRPC with Tonic and SQLx.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published