- Add VerifyPassword RPC to Identity Service - Added to proto file and generated code - Implemented in Identity Service gRPC server - Added to Identity Service client interface and gRPC client - Complete RefreshToken implementation - Store refresh tokens in database using RefreshToken entity - Validate refresh tokens with expiration checking - Revoke refresh tokens on logout and token rotation - Integrate Authz Service for role retrieval - Added AuthzServiceClient to Auth Service - Get user roles during login and token refresh - Gracefully handle Authz Service failures - Require JWT secret in configuration - Removed default secret fallback - Service fails to start if JWT secret is not configured - Fix Consul health checks for Docker - Services now register with Docker service names (e.g., audit-service) - Allows Consul (in Docker) to reach services via Docker DNS - Health checks use gRPC service names instead of localhost This completes all TODOs in auth_service_fx.go and fixes the Consul health check failures in Docker environments.
89 lines
5.2 KiB
Go
89 lines
5.2 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.dcentral.systems/toolz/goplt/internal/ent/auditlog"
|
|
"git.dcentral.systems/toolz/goplt/internal/ent/permission"
|
|
"git.dcentral.systems/toolz/goplt/internal/ent/refreshtoken"
|
|
"git.dcentral.systems/toolz/goplt/internal/ent/role"
|
|
"git.dcentral.systems/toolz/goplt/internal/ent/schema"
|
|
"git.dcentral.systems/toolz/goplt/internal/ent/user"
|
|
)
|
|
|
|
// The init function reads all schema descriptors with runtime code
|
|
// (default values, validators, hooks and policies) and stitches it
|
|
// to their package variables.
|
|
func init() {
|
|
auditlogFields := schema.AuditLog{}.Fields()
|
|
_ = auditlogFields
|
|
// 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[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()
|
|
_ = permissionFields
|
|
// permissionDescName is the schema descriptor for name field.
|
|
permissionDescName := permissionFields[1].Descriptor()
|
|
// permission.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
permission.NameValidator = permissionDescName.Validators[0].(func(string) error)
|
|
refreshtokenFields := schema.RefreshToken{}.Fields()
|
|
_ = refreshtokenFields
|
|
// refreshtokenDescUserID is the schema descriptor for user_id field.
|
|
refreshtokenDescUserID := refreshtokenFields[1].Descriptor()
|
|
// refreshtoken.UserIDValidator is a validator for the "user_id" field. It is called by the builders before save.
|
|
refreshtoken.UserIDValidator = refreshtokenDescUserID.Validators[0].(func(string) error)
|
|
// refreshtokenDescTokenHash is the schema descriptor for token_hash field.
|
|
refreshtokenDescTokenHash := refreshtokenFields[2].Descriptor()
|
|
// refreshtoken.TokenHashValidator is a validator for the "token_hash" field. It is called by the builders before save.
|
|
refreshtoken.TokenHashValidator = refreshtokenDescTokenHash.Validators[0].(func(string) error)
|
|
// refreshtokenDescCreatedAt is the schema descriptor for created_at field.
|
|
refreshtokenDescCreatedAt := refreshtokenFields[4].Descriptor()
|
|
// refreshtoken.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
refreshtoken.DefaultCreatedAt = refreshtokenDescCreatedAt.Default.(func() time.Time)
|
|
roleFields := schema.Role{}.Fields()
|
|
_ = roleFields
|
|
// roleDescName is the schema descriptor for name field.
|
|
roleDescName := roleFields[1].Descriptor()
|
|
// role.NameValidator is a validator for the "name" field. It is called by the builders before save.
|
|
role.NameValidator = roleDescName.Validators[0].(func(string) error)
|
|
// roleDescCreatedAt is the schema descriptor for created_at field.
|
|
roleDescCreatedAt := roleFields[3].Descriptor()
|
|
// role.DefaultCreatedAt holds the default value on creation for the created_at field.
|
|
role.DefaultCreatedAt = roleDescCreatedAt.Default.(func() time.Time)
|
|
userFields := schema.User{}.Fields()
|
|
_ = userFields
|
|
// userDescEmail is the schema descriptor for email field.
|
|
userDescEmail := userFields[1].Descriptor()
|
|
// 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[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[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[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[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.
|
|
user.UpdateDefaultUpdatedAt = userDescUpdatedAt.UpdateDefault.(func() time.Time)
|
|
}
|