Skip to content

raymondgitonga/go-authentication-service

Repository files navigation

go-authentication-service

A sample go service for authenticating client requests

Stack

  1. Go
  2. Postgres
  3. Redis
  4. Docker and docker-compose
  5. Deps

Endpoints

BASE_URL localhost:8080/auth-gateway
  1. Register
GET {BASE_URL}/register

This endpoint registers a client service and gives it a secret to identify it during authentication

  1. Authorize
GET {BASE_URL}/authorize

This endpoint gives a client service a JWT token for authentication

  1. Validate Token
GET {BASE_URL}/validate

This endpoint validates a JWT token then authorises a client service

  1. Rotate Keys
GET {BASE_URL}/rotate

This endpoint rotates encryption keys used to generate JWT tokens

Flow

  1. Client service registers with the authentication service, details stored in the database and secret key is granted
  2. Using the secret key a client service requests for an authentication token, generated from an encryption key stored in cache
  3. Client service requests for validation of authentication token
  4. Encryption keys rotated through a cron every 24hrs, the cron triggers generation of new key and deletes any keys older than 48 hrs

Run Project

make {ROOT_DIR}/start

About

A sample go authentication gateway

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published