Skip to content

About

MicroTodoSuite authentication API: login and JWT issuance, in Go.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

68 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Authentication API

This part of the exercise is responsible for the users authentication.

  • POST /login - takes a JSON and returns an access token

The JSON structure is:

{
    "username": "admin",
    "password": "admin"
}

Configuration

The service scans environment for variables:

  • AUTH_API_PORT - the port the service takes.
  • USERS_API_ADDRESS - base URL of Users API.
  • JWT_SECRET - secret value for JWT token processing. Must be the same amongst all components.

Initial data

The following users are hardcoded:

Username Password
admin admin
johnd foo
janed ddd

Building

- export GO111MODULE=on
- go mod init github.com/bortizf/microservice-app-example/tree/master/auth-api
- go mod tidy
- go build

Running

 JWT_SECRET=PRFT AUTH_API_PORT=8000 USERS_API_ADDRESS=http://127.0.0.1:8083 ./auth-api

Usage

The API can be exercised as follows:

 curl -X POST  http://127.0.0.1:8000/login -d '{"username": "admin","password": "admin"}'

Dependencies

The software required to run this microservice, and the version that was tested:

Dependency Version
Go 1.18.2

About

MicroTodoSuite authentication API: login and JWT issuance, in Go.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages