Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

124 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Rust based OAuth API

Rust CodeQL Advanced Dependabot Updates

An exercise into how to create a HTTP service using Rust, similar to oauth-api-go and oauth-api.

Requirements

Structure

├── src                     # Application source code
│   ├── token               # Shared token logic 
│   │   └── ...etc
│   ├── token_exchange      # Token exchange endpoint
│   │   └── ...etc
│   ├── token_introspection # Token introspection endpoint
│   │   └── ...etc
│   └── main.rs             # Application entry point
├── scripts
│   └── http                # Jetbrains HTTP Client requests, with assertions.
└── README.md

Building

The standard Cargo (Rust build tool) approach

cargo build

Linting

The standard rust linter, which is enforced by the GitHub Actions workflow

cargo clippy

Testing

Replaced the vanilla Cargo (Rust build tool) approach with cargo-nextest: https://nexte.st

cargo nextest run

Running

The standard Cargo (Rust build tool) approach

cargo run

Checking its running

Hit the token exchange endpoint with a password grant (yeah, it's deprecated; but it's a quick lazy way to start).

curl -v -X POST -H 'Content-Type: application/x-www-form-urlencoded' -u 'aardvark:badger' -d 'grant_type=password&scope=basic&username=aardvark&password=P%4055w0rd' http://127.0.0.1:8080/token

Hit the token introspection endpoint with the token just issued.

curl -v -X POST -H 'Content-Type: application/x-www-form-urlencoded' -u 'aardvark:badger' -d 'token=483d83dd-92a2-4d73-817f-8fd0e7203cb3' http://127.0.0.1:8080/introspect

Reading materials

About

A Rust project that re-implements my OAuth project

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages