Code Monkey home page Code Monkey logo

wpcodevo / rust-jwt-rs256 Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 2.0 63 KB

This guide will walk you through the process of implementing RS256 JWT authentication with Rust, using asymmetric keys (private and public keys) to ensure strong security. The API will be hosted on a high-performance Actix Web server and will store data in a PostgreSQL database.

Home Page: https://codevoweb.com/rust-actix-web-jwt-access-and-refresh-tokens/

Shell 30.52% Makefile 1.91% Rust 67.57%
access-token actix-web docker jwt jwt-middleware postgresql redis refresh-token rs256 rust

rust-jwt-rs256's Introduction

Rust and Actix Web - JWT Access and Refresh Tokens

This guide will walk you through the process of implementing RS256 JWT authentication with Rust, using asymmetric keys (private and public keys) to ensure strong security. The API will be hosted on a high-performance Actix Web server and will store data in a PostgreSQL database.

Rust and Actix Web - JWT Access and Refresh Tokens

Topics Covered

  • Run the Rust Actix Web Project Locally
  • Run the Rust API with a Frontend App
  • Setup the Rust Project
  • Setup PostgreSQL, Redis and pgAdmin with Docker
  • Database Migration with SQLX-CLI
  • Create the SQLX Database Model
  • Create the API Response Structs
  • Generate the RSA 256 Private and Public Keys
  • Load the Environment Variables into the App
  • Create Utility Functions to Sign and Verify the JWTs
    • Sign the JWT with the Private Key
    • Verify the JWT with the Public Key
  • Create a JWT Authentication Middleware
  • Create the Actix Web Route Handlers
    • Register User Route Function
    • Login User Route Function
    • Refresh JWT Route Function
    • Logout User Route Function
    • Get Authenticated User Route Function
    • Merge the Route Handlers
  • Connect to the Database and Register the Routes
  • Test the RSA 256 Rust Project
    • User Registration
    • User Login
    • Request Account Details
  • Conclusion

Read the entire article here: https://codevoweb.com/rust-actix-web-jwt-access-and-refresh-tokens/

rust-jwt-rs256's People

Contributors

wpcodevo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.