Skip to content

User + JWT Authentification micro-service, both gRPC and JSON API

Notifications You must be signed in to change notification settings

monkeydioude/GOAuTh

Repository files navigation

GOAuTh

Go

Auth provider web-sevice with user creation.

@DEVS!

make install once, first

HOW TO!

The following JSON API routes are available (details about the payload will follow):

  • /identity/v1/auth/signup (for user creation)
  • /identity/v1/auth/login (for user authentification)
  • /identity/v1/jwt/status (for jwt health status)
  • /identity/v1/jwt/refresh (for jwt refreshing)

The following RPCs are available:

  • Auth.Signup(UserRequest) returns (Response) (for user creation)
  • Auth.Login(UserRequest) returns (Response) (for user authentification)
  • JWT.Status(Empty) returns (Response) (for jwt health status)
  • JWT.Refresh(Empty) returns (Response) (for jwt refreshing)

CONFIG!

MANDATORY CONFIG ENV VARS:

  • DB_PATH=postgres://test:tedt@0.0.0.0:5454/test
  • DB_SCHEMA=users

OPTIONAL CONFIG ENV VARS:

  • API_PORT=
  • RPC_PORT=

DEFAULT COMFIG VARS (will be used if no env var was provided):

  • API_PORT: 8100
  • RPC_PORT: 9100

env vars can be provided through a .env file, in GOAuTh bin's directory.

PAYLOADS!

As a DDDish/Clean Codeish code architecture, each group of api/rpc use the same entity, thus have the same payload.

API/auth:

type User struct {
	Login        string         `json:"login"`
	Password     string         `json:"password,omitempty"`
	RealmName    string         `json:"realm_name"`
}

RPC/auth:

message UserRequest {
    string login = 1;
    string password = 2;
    string realm = 3;
}

API/jwt no payload, but a Authorization={JWT} cookie.

RPC/jwt, no payload, but a set-cookie metadata containing Authorization={JWT}.

About

User + JWT Authentification micro-service, both gRPC and JSON API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published