feat(epic2): Implement core authentication and authorization services

- Implement Audit Service (2.5)
  - gRPC server with Record and Query operations
  - Database persistence with audit schema
  - Service registry integration
  - Entry point: cmd/audit-service

- Implement Identity Service (2.2)
  - User CRUD operations
  - Password hashing with argon2id
  - Email verification and password reset flows
  - Entry point: cmd/identity-service
  - Fix package naming conflicts in user_service.go

- Implement Auth Service (2.1)
  - JWT token generation and validation
  - Login, RefreshToken, ValidateToken, Logout RPCs
  - Integration with Identity Service
  - Entry point: cmd/auth-service
  - Note: RefreshToken entity needs Ent generation

- Implement Authz Service (2.3, 2.4)
  - Permission checking and authorization
  - User roles and permissions retrieval
  - RBAC-based authorization
  - Entry point: cmd/authz-service

- Implement gRPC clients for all services
  - Auth, Identity, Authz, and Audit clients
  - Service discovery integration
  - Full gRPC communication

- Add service configurations to config/default.yaml
- Create SUMMARY.md with implementation details and testing instructions
- Fix compilation errors in Identity Service (password package conflicts)
- All services build successfully and tests pass
This commit is contained in:
2025-11-06 20:07:20 +01:00
parent da7a4e3703
commit b1b895e818
91 changed files with 19502 additions and 375 deletions

View File

@@ -18,16 +18,16 @@ import (
func init() {
auditlogFields := schema.AuditLog{}.Fields()
_ = auditlogFields
// auditlogDescActorID is the schema descriptor for actor_id field.
auditlogDescActorID := auditlogFields[1].Descriptor()
// auditlog.ActorIDValidator is a validator for the "actor_id" field. It is called by the builders before save.
auditlog.ActorIDValidator = auditlogDescActorID.Validators[0].(func(string) error)
// auditlogDescUserID is the schema descriptor for user_id field.
auditlogDescUserID := auditlogFields[1].Descriptor()
// auditlog.UserIDValidator is a validator for the "user_id" field. It is called by the builders before save.
auditlog.UserIDValidator = auditlogDescUserID.Validators[0].(func(string) error)
// auditlogDescAction is the schema descriptor for action field.
auditlogDescAction := auditlogFields[2].Descriptor()
// auditlog.ActionValidator is a validator for the "action" field. It is called by the builders before save.
auditlog.ActionValidator = auditlogDescAction.Validators[0].(func(string) error)
// auditlogDescTimestamp is the schema descriptor for timestamp field.
auditlogDescTimestamp := auditlogFields[5].Descriptor()
auditlogDescTimestamp := auditlogFields[8].Descriptor()
// auditlog.DefaultTimestamp holds the default value on creation for the timestamp field.
auditlog.DefaultTimestamp = auditlogDescTimestamp.Default.(func() time.Time)
permissionFields := schema.Permission{}.Fields()
@@ -53,19 +53,19 @@ func init() {
// user.EmailValidator is a validator for the "email" field. It is called by the builders before save.
user.EmailValidator = userDescEmail.Validators[0].(func(string) error)
// userDescPasswordHash is the schema descriptor for password_hash field.
userDescPasswordHash := userFields[2].Descriptor()
userDescPasswordHash := userFields[5].Descriptor()
// user.PasswordHashValidator is a validator for the "password_hash" field. It is called by the builders before save.
user.PasswordHashValidator = userDescPasswordHash.Validators[0].(func(string) error)
// userDescVerified is the schema descriptor for verified field.
userDescVerified := userFields[3].Descriptor()
userDescVerified := userFields[6].Descriptor()
// user.DefaultVerified holds the default value on creation for the verified field.
user.DefaultVerified = userDescVerified.Default.(bool)
// userDescCreatedAt is the schema descriptor for created_at field.
userDescCreatedAt := userFields[4].Descriptor()
userDescCreatedAt := userFields[10].Descriptor()
// user.DefaultCreatedAt holds the default value on creation for the created_at field.
user.DefaultCreatedAt = userDescCreatedAt.Default.(func() time.Time)
// userDescUpdatedAt is the schema descriptor for updated_at field.
userDescUpdatedAt := userFields[5].Descriptor()
userDescUpdatedAt := userFields[11].Descriptor()
// user.DefaultUpdatedAt holds the default value on creation for the updated_at field.
user.DefaultUpdatedAt = userDescUpdatedAt.Default.(func() time.Time)
// user.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.