Skip to content

Authentication and authorization service, written in Rust

License

Notifications You must be signed in to change notification settings

Opserva-io/auth-rs

Repository files navigation

auth-rs

GitHub top language GitHub GitHub release (with filter) Test

auth-rs provides a simple authentication and authorization service for use in other services. The service is written in Rust and uses the actix-web framework.

Users, when authenticated, will be given a JWT token which can be used to access other services.

A React-based frontend for auth-rs is also available here.

Table of Contents

Features

  • Authentication
  • Authorization
  • Audit trail
  • Password hashing
  • JWT generation
  • JWT verification
  • Pagination
  • OpenAPI / Swagger UI
  • CORS support
  • Docker support
  • MongoDB integration
  • MongoDB Atlas integration

Usage

Development

  1. Clone the repository
  2. Copy .env.example to .env in the root of the project and fill in / adjust the values
  3. Execute cargo run to start the service

Docker

You can execute auth-rs using Docker:

docker run -d -p 8080:8080 --env-file .env opserva/auth-rs

Configuration

auth-rs can be configured using environment variables to fit your environment and requirements.

For more information about the environment variables, see the Configuration documentation.

API

auth-rs exposes a REST API that can be used to interact with the service using Create, Read, Update and Delete (CRUD) requests. Other (micro)services can use this API to authenticate and authorize users (and generate and verify JWT tokens).

See the full API documentation for more information.

Building

In order to build auth-rs, you will need to have Rust installed. You can install Rust by following the instructions here.

cargo

You can build auth-rs using cargo:

cargo build

You can build an optimized release version of auth-rs using cargo:

cargo build --release

Docker

You can build a docker image of auth-rs using the provided Dockerfile:

docker build -t auth-rs .

Dependencies

A couple of dependencies are required in order to build auth-rs:

About

This library is maintained by CodeDead. You can find more about us using the following links:

Copyright © 2023 CodeDead