- 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.
487 lines
14 KiB
Go
487 lines
14 KiB
Go
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-go v1.36.10
|
|
// protoc v6.30.2
|
|
// source: audit.proto
|
|
|
|
package auditv1
|
|
|
|
import (
|
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
reflect "reflect"
|
|
sync "sync"
|
|
unsafe "unsafe"
|
|
)
|
|
|
|
const (
|
|
// Verify that this generated code is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
|
)
|
|
|
|
// AuditLogEntry represents an audit log entry.
|
|
type AuditLogEntry struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
|
Action string `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"` // e.g., "user.create", "user.update"
|
|
Resource string `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` // e.g., "user", "role"
|
|
ResourceId string `protobuf:"bytes,4,opt,name=resource_id,json=resourceId,proto3" json:"resource_id,omitempty"`
|
|
IpAddress string `protobuf:"bytes,5,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"`
|
|
UserAgent string `protobuf:"bytes,6,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"`
|
|
Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
|
Timestamp int64 `protobuf:"varint,8,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *AuditLogEntry) Reset() {
|
|
*x = AuditLogEntry{}
|
|
mi := &file_audit_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *AuditLogEntry) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*AuditLogEntry) ProtoMessage() {}
|
|
|
|
func (x *AuditLogEntry) ProtoReflect() protoreflect.Message {
|
|
mi := &file_audit_proto_msgTypes[0]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use AuditLogEntry.ProtoReflect.Descriptor instead.
|
|
func (*AuditLogEntry) Descriptor() ([]byte, []int) {
|
|
return file_audit_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *AuditLogEntry) GetUserId() string {
|
|
if x != nil {
|
|
return x.UserId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AuditLogEntry) GetAction() string {
|
|
if x != nil {
|
|
return x.Action
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AuditLogEntry) GetResource() string {
|
|
if x != nil {
|
|
return x.Resource
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AuditLogEntry) GetResourceId() string {
|
|
if x != nil {
|
|
return x.ResourceId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AuditLogEntry) GetIpAddress() string {
|
|
if x != nil {
|
|
return x.IpAddress
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AuditLogEntry) GetUserAgent() string {
|
|
if x != nil {
|
|
return x.UserAgent
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AuditLogEntry) GetMetadata() map[string]string {
|
|
if x != nil {
|
|
return x.Metadata
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *AuditLogEntry) GetTimestamp() int64 {
|
|
if x != nil {
|
|
return x.Timestamp
|
|
}
|
|
return 0
|
|
}
|
|
|
|
// RecordRequest contains an audit log entry to record.
|
|
type RecordRequest struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Entry *AuditLogEntry `protobuf:"bytes,1,opt,name=entry,proto3" json:"entry,omitempty"`
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *RecordRequest) Reset() {
|
|
*x = RecordRequest{}
|
|
mi := &file_audit_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *RecordRequest) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*RecordRequest) ProtoMessage() {}
|
|
|
|
func (x *RecordRequest) ProtoReflect() protoreflect.Message {
|
|
mi := &file_audit_proto_msgTypes[1]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use RecordRequest.ProtoReflect.Descriptor instead.
|
|
func (*RecordRequest) Descriptor() ([]byte, []int) {
|
|
return file_audit_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *RecordRequest) GetEntry() *AuditLogEntry {
|
|
if x != nil {
|
|
return x.Entry
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// RecordResponse indicates success.
|
|
type RecordResponse struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
|
|
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` // Audit log entry ID
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *RecordResponse) Reset() {
|
|
*x = RecordResponse{}
|
|
mi := &file_audit_proto_msgTypes[2]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *RecordResponse) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*RecordResponse) ProtoMessage() {}
|
|
|
|
func (x *RecordResponse) ProtoReflect() protoreflect.Message {
|
|
mi := &file_audit_proto_msgTypes[2]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use RecordResponse.ProtoReflect.Descriptor instead.
|
|
func (*RecordResponse) Descriptor() ([]byte, []int) {
|
|
return file_audit_proto_rawDescGZIP(), []int{2}
|
|
}
|
|
|
|
func (x *RecordResponse) GetSuccess() bool {
|
|
if x != nil {
|
|
return x.Success
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (x *RecordResponse) GetId() string {
|
|
if x != nil {
|
|
return x.Id
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// QueryRequest contains filters for querying audit logs.
|
|
type QueryRequest struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
UserId *string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3,oneof" json:"user_id,omitempty"`
|
|
Action *string `protobuf:"bytes,2,opt,name=action,proto3,oneof" json:"action,omitempty"`
|
|
Resource *string `protobuf:"bytes,3,opt,name=resource,proto3,oneof" json:"resource,omitempty"`
|
|
ResourceId *string `protobuf:"bytes,4,opt,name=resource_id,json=resourceId,proto3,oneof" json:"resource_id,omitempty"`
|
|
StartTime *int64 `protobuf:"varint,5,opt,name=start_time,json=startTime,proto3,oneof" json:"start_time,omitempty"`
|
|
EndTime *int64 `protobuf:"varint,6,opt,name=end_time,json=endTime,proto3,oneof" json:"end_time,omitempty"`
|
|
Limit int32 `protobuf:"varint,7,opt,name=limit,proto3" json:"limit,omitempty"` // Max number of results
|
|
Offset int32 `protobuf:"varint,8,opt,name=offset,proto3" json:"offset,omitempty"` // Pagination offset
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *QueryRequest) Reset() {
|
|
*x = QueryRequest{}
|
|
mi := &file_audit_proto_msgTypes[3]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *QueryRequest) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*QueryRequest) ProtoMessage() {}
|
|
|
|
func (x *QueryRequest) ProtoReflect() protoreflect.Message {
|
|
mi := &file_audit_proto_msgTypes[3]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.
|
|
func (*QueryRequest) Descriptor() ([]byte, []int) {
|
|
return file_audit_proto_rawDescGZIP(), []int{3}
|
|
}
|
|
|
|
func (x *QueryRequest) GetUserId() string {
|
|
if x != nil && x.UserId != nil {
|
|
return *x.UserId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *QueryRequest) GetAction() string {
|
|
if x != nil && x.Action != nil {
|
|
return *x.Action
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *QueryRequest) GetResource() string {
|
|
if x != nil && x.Resource != nil {
|
|
return *x.Resource
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *QueryRequest) GetResourceId() string {
|
|
if x != nil && x.ResourceId != nil {
|
|
return *x.ResourceId
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *QueryRequest) GetStartTime() int64 {
|
|
if x != nil && x.StartTime != nil {
|
|
return *x.StartTime
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *QueryRequest) GetEndTime() int64 {
|
|
if x != nil && x.EndTime != nil {
|
|
return *x.EndTime
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *QueryRequest) GetLimit() int32 {
|
|
if x != nil {
|
|
return x.Limit
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *QueryRequest) GetOffset() int32 {
|
|
if x != nil {
|
|
return x.Offset
|
|
}
|
|
return 0
|
|
}
|
|
|
|
// QueryResponse contains audit log entries.
|
|
type QueryResponse struct {
|
|
state protoimpl.MessageState `protogen:"open.v1"`
|
|
Entries []*AuditLogEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"`
|
|
Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` // Total number of matching entries
|
|
unknownFields protoimpl.UnknownFields
|
|
sizeCache protoimpl.SizeCache
|
|
}
|
|
|
|
func (x *QueryResponse) Reset() {
|
|
*x = QueryResponse{}
|
|
mi := &file_audit_proto_msgTypes[4]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *QueryResponse) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*QueryResponse) ProtoMessage() {}
|
|
|
|
func (x *QueryResponse) ProtoReflect() protoreflect.Message {
|
|
mi := &file_audit_proto_msgTypes[4]
|
|
if x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use QueryResponse.ProtoReflect.Descriptor instead.
|
|
func (*QueryResponse) Descriptor() ([]byte, []int) {
|
|
return file_audit_proto_rawDescGZIP(), []int{4}
|
|
}
|
|
|
|
func (x *QueryResponse) GetEntries() []*AuditLogEntry {
|
|
if x != nil {
|
|
return x.Entries
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *QueryResponse) GetTotal() int32 {
|
|
if x != nil {
|
|
return x.Total
|
|
}
|
|
return 0
|
|
}
|
|
|
|
var File_audit_proto protoreflect.FileDescriptor
|
|
|
|
const file_audit_proto_rawDesc = "" +
|
|
"\n" +
|
|
"\vaudit.proto\x12\baudit.v1\"\xd9\x02\n" +
|
|
"\rAuditLogEntry\x12\x17\n" +
|
|
"\auser_id\x18\x01 \x01(\tR\x06userId\x12\x16\n" +
|
|
"\x06action\x18\x02 \x01(\tR\x06action\x12\x1a\n" +
|
|
"\bresource\x18\x03 \x01(\tR\bresource\x12\x1f\n" +
|
|
"\vresource_id\x18\x04 \x01(\tR\n" +
|
|
"resourceId\x12\x1d\n" +
|
|
"\n" +
|
|
"ip_address\x18\x05 \x01(\tR\tipAddress\x12\x1d\n" +
|
|
"\n" +
|
|
"user_agent\x18\x06 \x01(\tR\tuserAgent\x12A\n" +
|
|
"\bmetadata\x18\a \x03(\v2%.audit.v1.AuditLogEntry.MetadataEntryR\bmetadata\x12\x1c\n" +
|
|
"\ttimestamp\x18\b \x01(\x03R\ttimestamp\x1a;\n" +
|
|
"\rMetadataEntry\x12\x10\n" +
|
|
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
|
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\">\n" +
|
|
"\rRecordRequest\x12-\n" +
|
|
"\x05entry\x18\x01 \x01(\v2\x17.audit.v1.AuditLogEntryR\x05entry\":\n" +
|
|
"\x0eRecordResponse\x12\x18\n" +
|
|
"\asuccess\x18\x01 \x01(\bR\asuccess\x12\x0e\n" +
|
|
"\x02id\x18\x02 \x01(\tR\x02id\"\xd2\x02\n" +
|
|
"\fQueryRequest\x12\x1c\n" +
|
|
"\auser_id\x18\x01 \x01(\tH\x00R\x06userId\x88\x01\x01\x12\x1b\n" +
|
|
"\x06action\x18\x02 \x01(\tH\x01R\x06action\x88\x01\x01\x12\x1f\n" +
|
|
"\bresource\x18\x03 \x01(\tH\x02R\bresource\x88\x01\x01\x12$\n" +
|
|
"\vresource_id\x18\x04 \x01(\tH\x03R\n" +
|
|
"resourceId\x88\x01\x01\x12\"\n" +
|
|
"\n" +
|
|
"start_time\x18\x05 \x01(\x03H\x04R\tstartTime\x88\x01\x01\x12\x1e\n" +
|
|
"\bend_time\x18\x06 \x01(\x03H\x05R\aendTime\x88\x01\x01\x12\x14\n" +
|
|
"\x05limit\x18\a \x01(\x05R\x05limit\x12\x16\n" +
|
|
"\x06offset\x18\b \x01(\x05R\x06offsetB\n" +
|
|
"\n" +
|
|
"\b_user_idB\t\n" +
|
|
"\a_actionB\v\n" +
|
|
"\t_resourceB\x0e\n" +
|
|
"\f_resource_idB\r\n" +
|
|
"\v_start_timeB\v\n" +
|
|
"\t_end_time\"X\n" +
|
|
"\rQueryResponse\x121\n" +
|
|
"\aentries\x18\x01 \x03(\v2\x17.audit.v1.AuditLogEntryR\aentries\x12\x14\n" +
|
|
"\x05total\x18\x02 \x01(\x05R\x05total2\x85\x01\n" +
|
|
"\fAuditService\x12;\n" +
|
|
"\x06Record\x12\x17.audit.v1.RecordRequest\x1a\x18.audit.v1.RecordResponse\x128\n" +
|
|
"\x05Query\x12\x16.audit.v1.QueryRequest\x1a\x17.audit.v1.QueryResponseBGZEgit.dcentral.systems/toolz/goplt/api/proto/generated/audit/v1;auditv1b\x06proto3"
|
|
|
|
var (
|
|
file_audit_proto_rawDescOnce sync.Once
|
|
file_audit_proto_rawDescData []byte
|
|
)
|
|
|
|
func file_audit_proto_rawDescGZIP() []byte {
|
|
file_audit_proto_rawDescOnce.Do(func() {
|
|
file_audit_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_audit_proto_rawDesc), len(file_audit_proto_rawDesc)))
|
|
})
|
|
return file_audit_proto_rawDescData
|
|
}
|
|
|
|
var file_audit_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
|
var file_audit_proto_goTypes = []any{
|
|
(*AuditLogEntry)(nil), // 0: audit.v1.AuditLogEntry
|
|
(*RecordRequest)(nil), // 1: audit.v1.RecordRequest
|
|
(*RecordResponse)(nil), // 2: audit.v1.RecordResponse
|
|
(*QueryRequest)(nil), // 3: audit.v1.QueryRequest
|
|
(*QueryResponse)(nil), // 4: audit.v1.QueryResponse
|
|
nil, // 5: audit.v1.AuditLogEntry.MetadataEntry
|
|
}
|
|
var file_audit_proto_depIdxs = []int32{
|
|
5, // 0: audit.v1.AuditLogEntry.metadata:type_name -> audit.v1.AuditLogEntry.MetadataEntry
|
|
0, // 1: audit.v1.RecordRequest.entry:type_name -> audit.v1.AuditLogEntry
|
|
0, // 2: audit.v1.QueryResponse.entries:type_name -> audit.v1.AuditLogEntry
|
|
1, // 3: audit.v1.AuditService.Record:input_type -> audit.v1.RecordRequest
|
|
3, // 4: audit.v1.AuditService.Query:input_type -> audit.v1.QueryRequest
|
|
2, // 5: audit.v1.AuditService.Record:output_type -> audit.v1.RecordResponse
|
|
4, // 6: audit.v1.AuditService.Query:output_type -> audit.v1.QueryResponse
|
|
5, // [5:7] is the sub-list for method output_type
|
|
3, // [3:5] is the sub-list for method input_type
|
|
3, // [3:3] is the sub-list for extension type_name
|
|
3, // [3:3] is the sub-list for extension extendee
|
|
0, // [0:3] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_audit_proto_init() }
|
|
func file_audit_proto_init() {
|
|
if File_audit_proto != nil {
|
|
return
|
|
}
|
|
file_audit_proto_msgTypes[3].OneofWrappers = []any{}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_audit_proto_rawDesc), len(file_audit_proto_rawDesc)),
|
|
NumEnums: 0,
|
|
NumMessages: 6,
|
|
NumExtensions: 0,
|
|
NumServices: 1,
|
|
},
|
|
GoTypes: file_audit_proto_goTypes,
|
|
DependencyIndexes: file_audit_proto_depIdxs,
|
|
MessageInfos: file_audit_proto_msgTypes,
|
|
}.Build()
|
|
File_audit_proto = out.File
|
|
file_audit_proto_goTypes = nil
|
|
file_audit_proto_depIdxs = nil
|
|
}
|