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:
658
api/proto/generated/authz/v1/authz.pb.go
Normal file
658
api/proto/generated/authz/v1/authz.pb.go
Normal file
@@ -0,0 +1,658 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.10
|
||||
// protoc v6.30.2
|
||||
// source: authz.proto
|
||||
|
||||
package authzv1
|
||||
|
||||
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)
|
||||
)
|
||||
|
||||
// Permission represents a permission in the system.
|
||||
type Permission struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Permission) Reset() {
|
||||
*x = Permission{}
|
||||
mi := &file_authz_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Permission) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Permission) ProtoMessage() {}
|
||||
|
||||
func (x *Permission) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_authz_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 Permission.ProtoReflect.Descriptor instead.
|
||||
func (*Permission) Descriptor() ([]byte, []int) {
|
||||
return file_authz_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Permission) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Permission) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Permission) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Permission) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Role represents a role in the system.
|
||||
type Role struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Permissions []string `protobuf:"bytes,4,rep,name=permissions,proto3" json:"permissions,omitempty"` // Permission codes
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Role) Reset() {
|
||||
*x = Role{}
|
||||
mi := &file_authz_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Role) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Role) ProtoMessage() {}
|
||||
|
||||
func (x *Role) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_authz_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 Role.ProtoReflect.Descriptor instead.
|
||||
func (*Role) Descriptor() ([]byte, []int) {
|
||||
return file_authz_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *Role) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Role) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Role) GetDescription() string {
|
||||
if x != nil {
|
||||
return x.Description
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Role) GetPermissions() []string {
|
||||
if x != nil {
|
||||
return x.Permissions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AuthorizeRequest contains user ID and permission to check.
|
||||
type AuthorizeRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Permission string `protobuf:"bytes,2,opt,name=permission,proto3" json:"permission,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AuthorizeRequest) Reset() {
|
||||
*x = AuthorizeRequest{}
|
||||
mi := &file_authz_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AuthorizeRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AuthorizeRequest) ProtoMessage() {}
|
||||
|
||||
func (x *AuthorizeRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_authz_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 AuthorizeRequest.ProtoReflect.Descriptor instead.
|
||||
func (*AuthorizeRequest) Descriptor() ([]byte, []int) {
|
||||
return file_authz_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *AuthorizeRequest) GetUserId() string {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AuthorizeRequest) GetPermission() string {
|
||||
if x != nil {
|
||||
return x.Permission
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// AuthorizeResponse indicates authorization result.
|
||||
type AuthorizeResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"`
|
||||
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AuthorizeResponse) Reset() {
|
||||
*x = AuthorizeResponse{}
|
||||
mi := &file_authz_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AuthorizeResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AuthorizeResponse) ProtoMessage() {}
|
||||
|
||||
func (x *AuthorizeResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_authz_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 AuthorizeResponse.ProtoReflect.Descriptor instead.
|
||||
func (*AuthorizeResponse) Descriptor() ([]byte, []int) {
|
||||
return file_authz_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *AuthorizeResponse) GetAuthorized() bool {
|
||||
if x != nil {
|
||||
return x.Authorized
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *AuthorizeResponse) GetMessage() string {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// HasPermissionRequest contains user ID and permission to check.
|
||||
type HasPermissionRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Permission string `protobuf:"bytes,2,opt,name=permission,proto3" json:"permission,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *HasPermissionRequest) Reset() {
|
||||
*x = HasPermissionRequest{}
|
||||
mi := &file_authz_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *HasPermissionRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*HasPermissionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *HasPermissionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_authz_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 HasPermissionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*HasPermissionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_authz_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *HasPermissionRequest) GetUserId() string {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *HasPermissionRequest) GetPermission() string {
|
||||
if x != nil {
|
||||
return x.Permission
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// HasPermissionResponse indicates if the user has the permission.
|
||||
type HasPermissionResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
HasPermission bool `protobuf:"varint,1,opt,name=has_permission,json=hasPermission,proto3" json:"has_permission,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *HasPermissionResponse) Reset() {
|
||||
*x = HasPermissionResponse{}
|
||||
mi := &file_authz_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *HasPermissionResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*HasPermissionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *HasPermissionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_authz_proto_msgTypes[5]
|
||||
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 HasPermissionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*HasPermissionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_authz_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *HasPermissionResponse) GetHasPermission() bool {
|
||||
if x != nil {
|
||||
return x.HasPermission
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetUserPermissionsRequest contains a user ID.
|
||||
type GetUserPermissionsRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetUserPermissionsRequest) Reset() {
|
||||
*x = GetUserPermissionsRequest{}
|
||||
mi := &file_authz_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetUserPermissionsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserPermissionsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserPermissionsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_authz_proto_msgTypes[6]
|
||||
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 GetUserPermissionsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserPermissionsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_authz_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *GetUserPermissionsRequest) GetUserId() string {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetUserPermissionsResponse contains all permissions for the user.
|
||||
type GetUserPermissionsResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Permissions []*Permission `protobuf:"bytes,1,rep,name=permissions,proto3" json:"permissions,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetUserPermissionsResponse) Reset() {
|
||||
*x = GetUserPermissionsResponse{}
|
||||
mi := &file_authz_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetUserPermissionsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserPermissionsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserPermissionsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_authz_proto_msgTypes[7]
|
||||
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 GetUserPermissionsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserPermissionsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_authz_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *GetUserPermissionsResponse) GetPermissions() []*Permission {
|
||||
if x != nil {
|
||||
return x.Permissions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetUserRolesRequest contains a user ID.
|
||||
type GetUserRolesRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetUserRolesRequest) Reset() {
|
||||
*x = GetUserRolesRequest{}
|
||||
mi := &file_authz_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetUserRolesRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserRolesRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserRolesRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_authz_proto_msgTypes[8]
|
||||
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 GetUserRolesRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserRolesRequest) Descriptor() ([]byte, []int) {
|
||||
return file_authz_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *GetUserRolesRequest) GetUserId() string {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetUserRolesResponse contains all roles for the user.
|
||||
type GetUserRolesResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Roles []*Role `protobuf:"bytes,1,rep,name=roles,proto3" json:"roles,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetUserRolesResponse) Reset() {
|
||||
*x = GetUserRolesResponse{}
|
||||
mi := &file_authz_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetUserRolesResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetUserRolesResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetUserRolesResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_authz_proto_msgTypes[9]
|
||||
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 GetUserRolesResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetUserRolesResponse) Descriptor() ([]byte, []int) {
|
||||
return file_authz_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *GetUserRolesResponse) GetRoles() []*Role {
|
||||
if x != nil {
|
||||
return x.Roles
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_authz_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_authz_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\vauthz.proto\x12\bauthz.v1\"f\n" +
|
||||
"\n" +
|
||||
"Permission\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" +
|
||||
"\x04code\x18\x02 \x01(\tR\x04code\x12\x12\n" +
|
||||
"\x04name\x18\x03 \x01(\tR\x04name\x12 \n" +
|
||||
"\vdescription\x18\x04 \x01(\tR\vdescription\"n\n" +
|
||||
"\x04Role\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" +
|
||||
"\x04name\x18\x02 \x01(\tR\x04name\x12 \n" +
|
||||
"\vdescription\x18\x03 \x01(\tR\vdescription\x12 \n" +
|
||||
"\vpermissions\x18\x04 \x03(\tR\vpermissions\"K\n" +
|
||||
"\x10AuthorizeRequest\x12\x17\n" +
|
||||
"\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1e\n" +
|
||||
"\n" +
|
||||
"permission\x18\x02 \x01(\tR\n" +
|
||||
"permission\"M\n" +
|
||||
"\x11AuthorizeResponse\x12\x1e\n" +
|
||||
"\n" +
|
||||
"authorized\x18\x01 \x01(\bR\n" +
|
||||
"authorized\x12\x18\n" +
|
||||
"\amessage\x18\x02 \x01(\tR\amessage\"O\n" +
|
||||
"\x14HasPermissionRequest\x12\x17\n" +
|
||||
"\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1e\n" +
|
||||
"\n" +
|
||||
"permission\x18\x02 \x01(\tR\n" +
|
||||
"permission\">\n" +
|
||||
"\x15HasPermissionResponse\x12%\n" +
|
||||
"\x0ehas_permission\x18\x01 \x01(\bR\rhasPermission\"4\n" +
|
||||
"\x19GetUserPermissionsRequest\x12\x17\n" +
|
||||
"\auser_id\x18\x01 \x01(\tR\x06userId\"T\n" +
|
||||
"\x1aGetUserPermissionsResponse\x126\n" +
|
||||
"\vpermissions\x18\x01 \x03(\v2\x14.authz.v1.PermissionR\vpermissions\".\n" +
|
||||
"\x13GetUserRolesRequest\x12\x17\n" +
|
||||
"\auser_id\x18\x01 \x01(\tR\x06userId\"<\n" +
|
||||
"\x14GetUserRolesResponse\x12$\n" +
|
||||
"\x05roles\x18\x01 \x03(\v2\x0e.authz.v1.RoleR\x05roles2\xd6\x02\n" +
|
||||
"\fAuthzService\x12D\n" +
|
||||
"\tAuthorize\x12\x1a.authz.v1.AuthorizeRequest\x1a\x1b.authz.v1.AuthorizeResponse\x12P\n" +
|
||||
"\rHasPermission\x12\x1e.authz.v1.HasPermissionRequest\x1a\x1f.authz.v1.HasPermissionResponse\x12_\n" +
|
||||
"\x12GetUserPermissions\x12#.authz.v1.GetUserPermissionsRequest\x1a$.authz.v1.GetUserPermissionsResponse\x12M\n" +
|
||||
"\fGetUserRoles\x12\x1d.authz.v1.GetUserRolesRequest\x1a\x1e.authz.v1.GetUserRolesResponseBGZEgit.dcentral.systems/toolz/goplt/api/proto/generated/authz/v1;authzv1b\x06proto3"
|
||||
|
||||
var (
|
||||
file_authz_proto_rawDescOnce sync.Once
|
||||
file_authz_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_authz_proto_rawDescGZIP() []byte {
|
||||
file_authz_proto_rawDescOnce.Do(func() {
|
||||
file_authz_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_authz_proto_rawDesc), len(file_authz_proto_rawDesc)))
|
||||
})
|
||||
return file_authz_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_authz_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_authz_proto_goTypes = []any{
|
||||
(*Permission)(nil), // 0: authz.v1.Permission
|
||||
(*Role)(nil), // 1: authz.v1.Role
|
||||
(*AuthorizeRequest)(nil), // 2: authz.v1.AuthorizeRequest
|
||||
(*AuthorizeResponse)(nil), // 3: authz.v1.AuthorizeResponse
|
||||
(*HasPermissionRequest)(nil), // 4: authz.v1.HasPermissionRequest
|
||||
(*HasPermissionResponse)(nil), // 5: authz.v1.HasPermissionResponse
|
||||
(*GetUserPermissionsRequest)(nil), // 6: authz.v1.GetUserPermissionsRequest
|
||||
(*GetUserPermissionsResponse)(nil), // 7: authz.v1.GetUserPermissionsResponse
|
||||
(*GetUserRolesRequest)(nil), // 8: authz.v1.GetUserRolesRequest
|
||||
(*GetUserRolesResponse)(nil), // 9: authz.v1.GetUserRolesResponse
|
||||
}
|
||||
var file_authz_proto_depIdxs = []int32{
|
||||
0, // 0: authz.v1.GetUserPermissionsResponse.permissions:type_name -> authz.v1.Permission
|
||||
1, // 1: authz.v1.GetUserRolesResponse.roles:type_name -> authz.v1.Role
|
||||
2, // 2: authz.v1.AuthzService.Authorize:input_type -> authz.v1.AuthorizeRequest
|
||||
4, // 3: authz.v1.AuthzService.HasPermission:input_type -> authz.v1.HasPermissionRequest
|
||||
6, // 4: authz.v1.AuthzService.GetUserPermissions:input_type -> authz.v1.GetUserPermissionsRequest
|
||||
8, // 5: authz.v1.AuthzService.GetUserRoles:input_type -> authz.v1.GetUserRolesRequest
|
||||
3, // 6: authz.v1.AuthzService.Authorize:output_type -> authz.v1.AuthorizeResponse
|
||||
5, // 7: authz.v1.AuthzService.HasPermission:output_type -> authz.v1.HasPermissionResponse
|
||||
7, // 8: authz.v1.AuthzService.GetUserPermissions:output_type -> authz.v1.GetUserPermissionsResponse
|
||||
9, // 9: authz.v1.AuthzService.GetUserRoles:output_type -> authz.v1.GetUserRolesResponse
|
||||
6, // [6:10] is the sub-list for method output_type
|
||||
2, // [2:6] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_authz_proto_init() }
|
||||
func file_authz_proto_init() {
|
||||
if File_authz_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_authz_proto_rawDesc), len(file_authz_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_authz_proto_goTypes,
|
||||
DependencyIndexes: file_authz_proto_depIdxs,
|
||||
MessageInfos: file_authz_proto_msgTypes,
|
||||
}.Build()
|
||||
File_authz_proto = out.File
|
||||
file_authz_proto_goTypes = nil
|
||||
file_authz_proto_depIdxs = nil
|
||||
}
|
||||
247
api/proto/generated/authz/v1/authz_grpc.pb.go
Normal file
247
api/proto/generated/authz/v1/authz_grpc.pb.go
Normal file
@@ -0,0 +1,247 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v6.30.2
|
||||
// source: authz.proto
|
||||
|
||||
package authzv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
AuthzService_Authorize_FullMethodName = "/authz.v1.AuthzService/Authorize"
|
||||
AuthzService_HasPermission_FullMethodName = "/authz.v1.AuthzService/HasPermission"
|
||||
AuthzService_GetUserPermissions_FullMethodName = "/authz.v1.AuthzService/GetUserPermissions"
|
||||
AuthzService_GetUserRoles_FullMethodName = "/authz.v1.AuthzService/GetUserRoles"
|
||||
)
|
||||
|
||||
// AuthzServiceClient is the client API for AuthzService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
//
|
||||
// AuthzService provides authorization operations.
|
||||
type AuthzServiceClient interface {
|
||||
// Authorize checks if a user has a specific permission and returns an error if not.
|
||||
Authorize(ctx context.Context, in *AuthorizeRequest, opts ...grpc.CallOption) (*AuthorizeResponse, error)
|
||||
// HasPermission checks if a user has a specific permission.
|
||||
HasPermission(ctx context.Context, in *HasPermissionRequest, opts ...grpc.CallOption) (*HasPermissionResponse, error)
|
||||
// GetUserPermissions returns all permissions for a user.
|
||||
GetUserPermissions(ctx context.Context, in *GetUserPermissionsRequest, opts ...grpc.CallOption) (*GetUserPermissionsResponse, error)
|
||||
// GetUserRoles returns all roles for a user.
|
||||
GetUserRoles(ctx context.Context, in *GetUserRolesRequest, opts ...grpc.CallOption) (*GetUserRolesResponse, error)
|
||||
}
|
||||
|
||||
type authzServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewAuthzServiceClient(cc grpc.ClientConnInterface) AuthzServiceClient {
|
||||
return &authzServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *authzServiceClient) Authorize(ctx context.Context, in *AuthorizeRequest, opts ...grpc.CallOption) (*AuthorizeResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(AuthorizeResponse)
|
||||
err := c.cc.Invoke(ctx, AuthzService_Authorize_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *authzServiceClient) HasPermission(ctx context.Context, in *HasPermissionRequest, opts ...grpc.CallOption) (*HasPermissionResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(HasPermissionResponse)
|
||||
err := c.cc.Invoke(ctx, AuthzService_HasPermission_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *authzServiceClient) GetUserPermissions(ctx context.Context, in *GetUserPermissionsRequest, opts ...grpc.CallOption) (*GetUserPermissionsResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetUserPermissionsResponse)
|
||||
err := c.cc.Invoke(ctx, AuthzService_GetUserPermissions_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *authzServiceClient) GetUserRoles(ctx context.Context, in *GetUserRolesRequest, opts ...grpc.CallOption) (*GetUserRolesResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetUserRolesResponse)
|
||||
err := c.cc.Invoke(ctx, AuthzService_GetUserRoles_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// AuthzServiceServer is the server API for AuthzService service.
|
||||
// All implementations must embed UnimplementedAuthzServiceServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// AuthzService provides authorization operations.
|
||||
type AuthzServiceServer interface {
|
||||
// Authorize checks if a user has a specific permission and returns an error if not.
|
||||
Authorize(context.Context, *AuthorizeRequest) (*AuthorizeResponse, error)
|
||||
// HasPermission checks if a user has a specific permission.
|
||||
HasPermission(context.Context, *HasPermissionRequest) (*HasPermissionResponse, error)
|
||||
// GetUserPermissions returns all permissions for a user.
|
||||
GetUserPermissions(context.Context, *GetUserPermissionsRequest) (*GetUserPermissionsResponse, error)
|
||||
// GetUserRoles returns all roles for a user.
|
||||
GetUserRoles(context.Context, *GetUserRolesRequest) (*GetUserRolesResponse, error)
|
||||
mustEmbedUnimplementedAuthzServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedAuthzServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedAuthzServiceServer struct{}
|
||||
|
||||
func (UnimplementedAuthzServiceServer) Authorize(context.Context, *AuthorizeRequest) (*AuthorizeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Authorize not implemented")
|
||||
}
|
||||
func (UnimplementedAuthzServiceServer) HasPermission(context.Context, *HasPermissionRequest) (*HasPermissionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method HasPermission not implemented")
|
||||
}
|
||||
func (UnimplementedAuthzServiceServer) GetUserPermissions(context.Context, *GetUserPermissionsRequest) (*GetUserPermissionsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserPermissions not implemented")
|
||||
}
|
||||
func (UnimplementedAuthzServiceServer) GetUserRoles(context.Context, *GetUserRolesRequest) (*GetUserRolesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetUserRoles not implemented")
|
||||
}
|
||||
func (UnimplementedAuthzServiceServer) mustEmbedUnimplementedAuthzServiceServer() {}
|
||||
func (UnimplementedAuthzServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeAuthzServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to AuthzServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeAuthzServiceServer interface {
|
||||
mustEmbedUnimplementedAuthzServiceServer()
|
||||
}
|
||||
|
||||
func RegisterAuthzServiceServer(s grpc.ServiceRegistrar, srv AuthzServiceServer) {
|
||||
// If the following call pancis, it indicates UnimplementedAuthzServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&AuthzService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _AuthzService_Authorize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AuthorizeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthzServiceServer).Authorize(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthzService_Authorize_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthzServiceServer).Authorize(ctx, req.(*AuthorizeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AuthzService_HasPermission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(HasPermissionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthzServiceServer).HasPermission(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthzService_HasPermission_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthzServiceServer).HasPermission(ctx, req.(*HasPermissionRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AuthzService_GetUserPermissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetUserPermissionsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthzServiceServer).GetUserPermissions(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthzService_GetUserPermissions_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthzServiceServer).GetUserPermissions(ctx, req.(*GetUserPermissionsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AuthzService_GetUserRoles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetUserRolesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthzServiceServer).GetUserRoles(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthzService_GetUserRoles_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthzServiceServer).GetUserRoles(ctx, req.(*GetUserRolesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// AuthzService_ServiceDesc is the grpc.ServiceDesc for AuthzService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var AuthzService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "authz.v1.AuthzService",
|
||||
HandlerType: (*AuthzServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Authorize",
|
||||
Handler: _AuthzService_Authorize_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "HasPermission",
|
||||
Handler: _AuthzService_HasPermission_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUserPermissions",
|
||||
Handler: _AuthzService_GetUserPermissions_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetUserRoles",
|
||||
Handler: _AuthzService_GetUserRoles_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "authz.proto",
|
||||
}
|
||||
Reference in New Issue
Block a user