Skip to content

CursedBoat/axum-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Axum Auth

A collection of authentication processes for Axum.

Todo

Below you can find which authentication processes are implemented, and what is planned for the future.

  • Session Auth ✔
  • JWT Auth ❌
  • OAuth2 ❌
  • Passkeys ❌

Session Auth

I have implemented session auth using tower_http by creating a custom middleware function.
On login/register, the server generates and writes a session id to the database, and appends it to the client's cookies.

By default, the session expires in 2 days, and it gets deleted from the database when a user tries to access the protected route after expiration.

In an actual usecase, it is advised to refresh and generate a new session everytime the user accesses a protected route, so that the user only gets logged out when they are inactive.

License

None, do whatever you want with the code, no need to credit me.

Note

Rename database.sqlite.example to database.sqlite & run cargo sqlx prepare if you want to test the repository.

Releases

No releases published

Packages

No packages published

Languages