go-auth

command module
v0.0.0-...-524bf5b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 1 Imported by: 0

README

Go-Auth

This project is only for learning purposes. A simple microservice for storing user credentials and authenticating them.

The REST api is documented and generated with OpenApi spec. The tool for generation is deepmap/oapi-codegen.

Setup

Prerequisites
  • Golang 1.18 or higher

  • running MySQL Database instance

    • use files in /SQL to setup the db
    • dsn for the database is setup in app.go at 24th line
Actions to run
  1. git clone https://github.com/Nesquiko/go-auth.git
  2. cd go-auth
  3. go run .

Interact

To interact with running Go-Auth service, either go through the OpenApi spec and use a client of your choice. Or use Postman, you can import the collection and environment in /postman dir.

Interaction flow
  1. signup new user
  2. log in with credentials, and get unauthenticated token
  3. setup 2FA
  4. verify 2FA TOTP password, and get fully authenticated token
  5. use test endpoint test endpoint if you are correctly authenticated

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
app
Package app is provides functions for starting the Go-Auth application.
Package app is provides functions for starting the Go-Auth application.
db
Package db provides functions for interacting with a database.
Package db provides functions for interacting with a database.
security
Package security provides functions for encryption of passwords and JWT token handling.
Package security provides functions for encryption of passwords and JWT token handling.
server
Package server provides functions for handling different API endpoints of the Go-Auth application.
Package server provides functions for handling different API endpoints of the Go-Auth application.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL