https://github.com/ppcamp/go-user-crud
This project will be part of a microservice post that I'll make. This pkg will be responsible to handle with user's info (user's CRUD) using a "Shared Nothing" + "Saga" pattern
https://github.com/ppcamp/go-user-crud
Last synced: about 1 year ago
JSON representation
This project will be part of a microservice post that I'll make. This pkg will be responsible to handle with user's info (user's CRUD) using a "Shared Nothing" + "Saga" pattern
- Host: GitHub
- URL: https://github.com/ppcamp/go-user-crud
- Owner: ppcamp
- Archived: true
- Created: 2022-06-22T15:35:57.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-22T15:44:07.000Z (about 4 years ago)
- Last Synced: 2025-03-03T05:43:45.816Z (over 1 year ago)
- Language: Go
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# microservice: authentication
Responsible to:
- Login (Generate JWT token)
- Refresh (Update token basing with an old one)
- Validate sessions
- Invalidate sessions
It uses JWT under the hood. It alsos uses Go subpackages.
Basing this approach on https://curity.io/resources/learn/jwt-best-practices/
## How it works?
## Database
Note that users don't belong to current database and it's response depends on
the user's crud to remove them.
```mermaid
erDiagram
users {
uuid id
varchar_50 first_name
varchar_130 middle_name
varchar_20 last_name
varchar_20 nick
varchar_100 email
bool active
date birthdate
timestamp created_at
timestamp updated_at
}
```
## How to generate some key?
This project is currently using ECSDA P512 algorithm to auth the JWT token.
To generate a new key, type:
```bash
# Generates a new key, which should be in some var
ssh-keygen -t ecdsa -b 521
```
Install
```bash
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
```
## TODO
- [ ] Allow repositories the possibility to use NonTransaction connection
## See
- https://github.com/golang-migrate/migrate/tree/master/cmd/migrate