msa-event-market_service-auth service-auth
service-auth is the service responsible for user management and authentication/authorization in the msa-event-market Project. service-auth follows this considerations
Authentication/Authorization
service-auth uses simple authentication based on ID/Password. A user can get the access token and refresh token based on JWT required for authentication/authorization by entering ID/Password. Passwords are encrypted and stored using the PBKDF2 algorithm.
In JWT token contains the following information.
- User ID (UUID)
- Login ID
- Role (admin, user)
Used main external packages and tools
service-auth uses following external packages and tools.
- HTTP Server, Middleware : chi, HTTP, oapi-codegen
- GRPC Server, Intercepter : grpc, protoc-gen-go
- MySQL : GORM
- Kafka : kafka-go, Debezium Outbox
- Authorziation : Casbin
- Logging, Tracking : zerolog, Istio, OpenTracing, Jaeger
- Continuous Integration : Testify, sqlmock, Mockery, Github Actions
- Continuous Deployment : K8s, ArgoCD, ArgoCD Image Updater, Kustomize
Development Environment
Required CLI
// MacOS
$ go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.6.0
$ go install github.com/mikefarah/yq/v4
// MacOS
$ brew install protobuf
$ go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
// MacOS
$ brew install jq
$ brew install mockery
$ go install github.com/fullstorydev/grpcurl/cmd/grpcurl@v1.8.7
$ go install github.com/nektos/act@latest
Reference
- UUID for DB
- https://github.com/google/uuid/issues/20
- Istio GRPC
- https://stackoverflow.com/questions/62459006/how-to-route-multiple-grpc-services-based-on-path-in-istiokubernetes
- Casbin RBAC
- https://github.com/luk4z7/middleware-acl
- OpenTracing tracer
- https://github.com/jaegertracing/jaeger-client-go/blob/master/zipkin/README.md
- OpenTracing middleware
- https://github.com/go-chi/httptracer
- OpenTracing intercepter
- https://github.com/opentracing-contrib/go-grpc