Compare commits

...

6 Commits

Author SHA1 Message Date
Bobo
2aeb7b823e feat: api. 2025-06-16 22:02:56 +08:00
Bobo
569df2b7bd Merge pull request #5 from gozbq/main
nacos做配置中心时,通常也需要指定用户名、密码、命令空间id
2025-06-16 21:56:35 +08:00
baoqiang
b7f9fa5807 nacos做配置中心时,通常也需要指定用户名、密码、命令空间id 2025-06-13 11:34:55 +08:00
Bobo
bda9c5e6bb feat: redis. 2025-06-09 16:26:15 +08:00
Bobo
c88687b033 feat: config. 2025-06-09 15:56:09 +08:00
Bobo
f3dbfdea77 feat: config. 2025-06-05 15:04:22 +08:00
13 changed files with 1355 additions and 687 deletions

View File

@@ -24,8 +24,11 @@ const (
// 认证
type Authentication struct {
state protoimpl.MessageState `protogen:"open.v1"`
Jwt *Authentication_Jwt `protobuf:"bytes,1,opt,name=jwt,proto3,oneof" json:"jwt,omitempty"`
state protoimpl.MessageState `protogen:"open.v1"`
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Jwt *Authentication_Jwt `protobuf:"bytes,2,opt,name=jwt,proto3,oneof" json:"jwt,omitempty"` // JWT 认证
Oidc *Authentication_OIDC `protobuf:"bytes,3,opt,name=oidc,proto3,oneof" json:"oidc,omitempty"` // OIDC
PresharedKey *Authentication_PresharedKey `protobuf:"bytes,4,opt,name=preshared_key,json=presharedKey,proto3,oneof" json:"preshared_key,omitempty"` // 预共享密钥
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -60,6 +63,13 @@ func (*Authentication) Descriptor() ([]byte, []int) {
return file_conf_v1_kratos_conf_authn_proto_rawDescGZIP(), []int{0}
}
func (x *Authentication) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *Authentication) GetJwt() *Authentication_Jwt {
if x != nil {
return x.Jwt
@@ -67,6 +77,20 @@ func (x *Authentication) GetJwt() *Authentication_Jwt {
return nil
}
func (x *Authentication) GetOidc() *Authentication_OIDC {
if x != nil {
return x.Oidc
}
return nil
}
func (x *Authentication) GetPresharedKey() *Authentication_PresharedKey {
if x != nil {
return x.PresharedKey
}
return nil
}
// JWT
type Authentication_Jwt struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -120,6 +144,110 @@ func (x *Authentication_Jwt) GetKey() string {
return ""
}
type Authentication_OIDC struct {
state protoimpl.MessageState `protogen:"open.v1"`
IssuerUrl string `protobuf:"bytes,1,opt,name=issuer_url,json=issuerUrl,proto3" json:"issuer_url,omitempty"`
Audience string `protobuf:"bytes,2,opt,name=audience,proto3" json:"audience,omitempty"`
Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"` // JWT签名的算法支持算法HS256
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Authentication_OIDC) Reset() {
*x = Authentication_OIDC{}
mi := &file_conf_v1_kratos_conf_authn_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Authentication_OIDC) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Authentication_OIDC) ProtoMessage() {}
func (x *Authentication_OIDC) ProtoReflect() protoreflect.Message {
mi := &file_conf_v1_kratos_conf_authn_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 Authentication_OIDC.ProtoReflect.Descriptor instead.
func (*Authentication_OIDC) Descriptor() ([]byte, []int) {
return file_conf_v1_kratos_conf_authn_proto_rawDescGZIP(), []int{0, 1}
}
func (x *Authentication_OIDC) GetIssuerUrl() string {
if x != nil {
return x.IssuerUrl
}
return ""
}
func (x *Authentication_OIDC) GetAudience() string {
if x != nil {
return x.Audience
}
return ""
}
func (x *Authentication_OIDC) GetMethod() string {
if x != nil {
return x.Method
}
return ""
}
type Authentication_PresharedKey struct {
state protoimpl.MessageState `protogen:"open.v1"`
ValidKeys []string `protobuf:"bytes,1,rep,name=valid_keys,json=validKeys,proto3" json:"valid_keys,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Authentication_PresharedKey) Reset() {
*x = Authentication_PresharedKey{}
mi := &file_conf_v1_kratos_conf_authn_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Authentication_PresharedKey) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Authentication_PresharedKey) ProtoMessage() {}
func (x *Authentication_PresharedKey) ProtoReflect() protoreflect.Message {
mi := &file_conf_v1_kratos_conf_authn_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 Authentication_PresharedKey.ProtoReflect.Descriptor instead.
func (*Authentication_PresharedKey) Descriptor() ([]byte, []int) {
return file_conf_v1_kratos_conf_authn_proto_rawDescGZIP(), []int{0, 2}
}
func (x *Authentication_PresharedKey) GetValidKeys() []string {
if x != nil {
return x.ValidKeys
}
return nil
}
var File_conf_v1_kratos_conf_authn_proto protoreflect.FileDescriptor
var file_conf_v1_kratos_conf_authn_proto_rawDesc = string([]byte{
@@ -127,24 +255,43 @@ var file_conf_v1_kratos_conf_authn_proto_rawDesc = string([]byte{
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7a, 0x0a, 0x0e, 0x41, 0x75, 0x74, 0x68, 0x65,
0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x03, 0x6a, 0x77, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75,
0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4a, 0x77, 0x74,
0x48, 0x00, 0x52, 0x03, 0x6a, 0x77, 0x74, 0x88, 0x01, 0x01, 0x1a, 0x2f, 0x0a, 0x03, 0x4a, 0x77,
0x74, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x5f,
0x6a, 0x77, 0x74, 0x42, 0x86, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66,
0x42, 0x14, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x41, 0x75, 0x74, 0x68,
0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f,
0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02,
0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f,
0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb4, 0x03, 0x0a, 0x0e, 0x41, 0x75, 0x74, 0x68,
0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79,
0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2f,
0x0a, 0x03, 0x6a, 0x77, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f,
0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x2e, 0x4a, 0x77, 0x74, 0x48, 0x00, 0x52, 0x03, 0x6a, 0x77, 0x74, 0x88, 0x01, 0x01, 0x12,
0x32, 0x0a, 0x04, 0x6f, 0x69, 0x64, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x49, 0x44, 0x43, 0x48, 0x01, 0x52, 0x04, 0x6f, 0x69, 0x64, 0x63,
0x88, 0x01, 0x01, 0x12, 0x4b, 0x0a, 0x0d, 0x70, 0x72, 0x65, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64,
0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x6e,
0x66, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x2e, 0x50, 0x72, 0x65, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x48, 0x02, 0x52,
0x0c, 0x70, 0x72, 0x65, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x88, 0x01, 0x01,
0x1a, 0x2f, 0x0a, 0x03, 0x4a, 0x77, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12,
0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65,
0x79, 0x1a, 0x59, 0x0a, 0x04, 0x4f, 0x49, 0x44, 0x43, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x73,
0x75, 0x65, 0x72, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69,
0x73, 0x73, 0x75, 0x65, 0x72, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x75, 0x64, 0x69,
0x65, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x75, 0x64, 0x69,
0x65, 0x6e, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x1a, 0x2d, 0x0a, 0x0c,
0x50, 0x72, 0x65, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a,
0x76, 0x61, 0x6c, 0x69, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09,
0x52, 0x09, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x06, 0x0a, 0x04, 0x5f,
0x6a, 0x77, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6f, 0x69, 0x64, 0x63, 0x42, 0x10, 0x0a, 0x0e,
0x5f, 0x70, 0x72, 0x65, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x42, 0x86,
0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x14, 0x4b, 0x72, 0x61,
0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x41, 0x75, 0x74, 0x68, 0x6e, 0x50, 0x72, 0x6f, 0x74,
0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f,
0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67,
0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa,
0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10,
0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
})
var (
@@ -159,18 +306,22 @@ func file_conf_v1_kratos_conf_authn_proto_rawDescGZIP() []byte {
return file_conf_v1_kratos_conf_authn_proto_rawDescData
}
var file_conf_v1_kratos_conf_authn_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_conf_v1_kratos_conf_authn_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_conf_v1_kratos_conf_authn_proto_goTypes = []any{
(*Authentication)(nil), // 0: conf.Authentication
(*Authentication_Jwt)(nil), // 1: conf.Authentication.Jwt
(*Authentication)(nil), // 0: conf.Authentication
(*Authentication_Jwt)(nil), // 1: conf.Authentication.Jwt
(*Authentication_OIDC)(nil), // 2: conf.Authentication.OIDC
(*Authentication_PresharedKey)(nil), // 3: conf.Authentication.PresharedKey
}
var file_conf_v1_kratos_conf_authn_proto_depIdxs = []int32{
1, // 0: conf.Authentication.jwt:type_name -> conf.Authentication.Jwt
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
2, // 1: conf.Authentication.oidc:type_name -> conf.Authentication.OIDC
3, // 2: conf.Authentication.preshared_key:type_name -> conf.Authentication.PresharedKey
3, // [3:3] is the sub-list for method output_type
3, // [3:3] 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_conf_v1_kratos_conf_authn_proto_init() }
@@ -185,7 +336,7 @@ func file_conf_v1_kratos_conf_authn_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_conf_v1_kratos_conf_authn_proto_rawDesc), len(file_conf_v1_kratos_conf_authn_proto_rawDesc)),
NumEnums: 0,
NumMessages: 2,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},

View File

@@ -24,7 +24,11 @@ const (
// 授权
type Authorization struct {
state protoimpl.MessageState `protogen:"open.v1"`
state protoimpl.MessageState `protogen:"open.v1"`
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
Casbin *Authorization_Casbin `protobuf:"bytes,2,opt,name=casbin,proto3" json:"casbin,omitempty"` // casbin
Opa *Authorization_OPA `protobuf:"bytes,3,opt,name=opa,proto3" json:"opa,omitempty"` // OPA
Zanzibar *Authorization_Zanzibar `protobuf:"bytes,4,opt,name=zanzibar,proto3" json:"zanzibar,omitempty"` // zanzibar
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -59,6 +63,386 @@ func (*Authorization) Descriptor() ([]byte, []int) {
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0}
}
func (x *Authorization) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *Authorization) GetCasbin() *Authorization_Casbin {
if x != nil {
return x.Casbin
}
return nil
}
func (x *Authorization) GetOpa() *Authorization_OPA {
if x != nil {
return x.Opa
}
return nil
}
func (x *Authorization) GetZanzibar() *Authorization_Zanzibar {
if x != nil {
return x.Zanzibar
}
return nil
}
type Authorization_Casbin struct {
state protoimpl.MessageState `protogen:"open.v1"`
ModelPath *string `protobuf:"bytes,1,opt,name=model_path,json=modelPath,proto3,oneof" json:"model_path,omitempty"` // casbin 模型文件路径
PolicyPath *string `protobuf:"bytes,2,opt,name=policy_path,json=policyPath,proto3,oneof" json:"policy_path,omitempty"` // casbin 策略文件路径
Policies []string `protobuf:"bytes,10,rep,name=policies,proto3" json:"policies,omitempty"` // 策略列表
Model *string `protobuf:"bytes,11,opt,name=model,proto3,oneof" json:"model,omitempty"` // 模型内容
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Authorization_Casbin) Reset() {
*x = Authorization_Casbin{}
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Authorization_Casbin) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Authorization_Casbin) ProtoMessage() {}
func (x *Authorization_Casbin) ProtoReflect() protoreflect.Message {
mi := &file_conf_v1_kratos_conf_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 Authorization_Casbin.ProtoReflect.Descriptor instead.
func (*Authorization_Casbin) Descriptor() ([]byte, []int) {
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 0}
}
func (x *Authorization_Casbin) GetModelPath() string {
if x != nil && x.ModelPath != nil {
return *x.ModelPath
}
return ""
}
func (x *Authorization_Casbin) GetPolicyPath() string {
if x != nil && x.PolicyPath != nil {
return *x.PolicyPath
}
return ""
}
func (x *Authorization_Casbin) GetPolicies() []string {
if x != nil {
return x.Policies
}
return nil
}
func (x *Authorization_Casbin) GetModel() string {
if x != nil && x.Model != nil {
return *x.Model
}
return ""
}
type Authorization_OPA struct {
state protoimpl.MessageState `protogen:"open.v1"`
Policies map[string]string `protobuf:"bytes,1,rep,name=policies,proto3" json:"policies,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // OPA 策略列表
Roles map[string]*Authorization_OPA_RoleActions `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` //
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Authorization_OPA) Reset() {
*x = Authorization_OPA{}
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Authorization_OPA) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Authorization_OPA) ProtoMessage() {}
func (x *Authorization_OPA) ProtoReflect() protoreflect.Message {
mi := &file_conf_v1_kratos_conf_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 Authorization_OPA.ProtoReflect.Descriptor instead.
func (*Authorization_OPA) Descriptor() ([]byte, []int) {
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 1}
}
func (x *Authorization_OPA) GetPolicies() map[string]string {
if x != nil {
return x.Policies
}
return nil
}
func (x *Authorization_OPA) GetRoles() map[string]*Authorization_OPA_RoleActions {
if x != nil {
return x.Roles
}
return nil
}
type Authorization_Zanzibar struct {
state protoimpl.MessageState `protogen:"open.v1"`
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // zanzibar 类型
Keto *Authorization_Zanzibar_Keto `protobuf:"bytes,2,opt,name=keto,proto3,oneof" json:"keto,omitempty"` // Keto 配置
OpenFga *Authorization_Zanzibar_OpenFga `protobuf:"bytes,3,opt,name=open_fga,json=openFga,proto3,oneof" json:"open_fga,omitempty"` // OpenFGA 配置
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Authorization_Zanzibar) Reset() {
*x = Authorization_Zanzibar{}
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Authorization_Zanzibar) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Authorization_Zanzibar) ProtoMessage() {}
func (x *Authorization_Zanzibar) ProtoReflect() protoreflect.Message {
mi := &file_conf_v1_kratos_conf_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 Authorization_Zanzibar.ProtoReflect.Descriptor instead.
func (*Authorization_Zanzibar) Descriptor() ([]byte, []int) {
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 2}
}
func (x *Authorization_Zanzibar) GetType() string {
if x != nil {
return x.Type
}
return ""
}
func (x *Authorization_Zanzibar) GetKeto() *Authorization_Zanzibar_Keto {
if x != nil {
return x.Keto
}
return nil
}
func (x *Authorization_Zanzibar) GetOpenFga() *Authorization_Zanzibar_OpenFga {
if x != nil {
return x.OpenFga
}
return nil
}
type Authorization_OPA_RoleActions struct {
state protoimpl.MessageState `protogen:"open.v1"`
Actions []string `protobuf:"bytes,1,rep,name=actions,proto3" json:"actions,omitempty"` // 角色对应的操作列表 {
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Authorization_OPA_RoleActions) Reset() {
*x = Authorization_OPA_RoleActions{}
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Authorization_OPA_RoleActions) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Authorization_OPA_RoleActions) ProtoMessage() {}
func (x *Authorization_OPA_RoleActions) ProtoReflect() protoreflect.Message {
mi := &file_conf_v1_kratos_conf_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 Authorization_OPA_RoleActions.ProtoReflect.Descriptor instead.
func (*Authorization_OPA_RoleActions) Descriptor() ([]byte, []int) {
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 1, 0}
}
func (x *Authorization_OPA_RoleActions) GetActions() []string {
if x != nil {
return x.Actions
}
return nil
}
type Authorization_Zanzibar_Keto struct {
state protoimpl.MessageState `protogen:"open.v1"`
WriteUrl string `protobuf:"bytes,1,opt,name=write_url,json=writeUrl,proto3" json:"write_url,omitempty"` // 写入 URL
ReadUrl string `protobuf:"bytes,2,opt,name=read_url,json=readUrl,proto3" json:"read_url,omitempty"` // 读取 URL
UseGrpc bool `protobuf:"varint,3,opt,name=use_grpc,json=useGrpc,proto3" json:"use_grpc,omitempty"` // 是否使用 gRPC
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Authorization_Zanzibar_Keto) Reset() {
*x = Authorization_Zanzibar_Keto{}
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Authorization_Zanzibar_Keto) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Authorization_Zanzibar_Keto) ProtoMessage() {}
func (x *Authorization_Zanzibar_Keto) ProtoReflect() protoreflect.Message {
mi := &file_conf_v1_kratos_conf_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 Authorization_Zanzibar_Keto.ProtoReflect.Descriptor instead.
func (*Authorization_Zanzibar_Keto) Descriptor() ([]byte, []int) {
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 2, 0}
}
func (x *Authorization_Zanzibar_Keto) GetWriteUrl() string {
if x != nil {
return x.WriteUrl
}
return ""
}
func (x *Authorization_Zanzibar_Keto) GetReadUrl() string {
if x != nil {
return x.ReadUrl
}
return ""
}
func (x *Authorization_Zanzibar_Keto) GetUseGrpc() bool {
if x != nil {
return x.UseGrpc
}
return false
}
type Authorization_Zanzibar_OpenFga struct {
state protoimpl.MessageState `protogen:"open.v1"`
ApiUrl string `protobuf:"bytes,1,opt,name=api_url,json=apiUrl,proto3" json:"api_url,omitempty"` // OpenFGA API URL
StoreId string `protobuf:"bytes,2,opt,name=store_id,json=storeId,proto3" json:"store_id,omitempty"` // OpenFGA 存储 ID
Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` // OpenFGA 访问令牌
ClientId string `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // OpenFGA 客户端 ID
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Authorization_Zanzibar_OpenFga) Reset() {
*x = Authorization_Zanzibar_OpenFga{}
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Authorization_Zanzibar_OpenFga) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Authorization_Zanzibar_OpenFga) ProtoMessage() {}
func (x *Authorization_Zanzibar_OpenFga) ProtoReflect() protoreflect.Message {
mi := &file_conf_v1_kratos_conf_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 Authorization_Zanzibar_OpenFga.ProtoReflect.Descriptor instead.
func (*Authorization_Zanzibar_OpenFga) Descriptor() ([]byte, []int) {
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 2, 1}
}
func (x *Authorization_Zanzibar_OpenFga) GetApiUrl() string {
if x != nil {
return x.ApiUrl
}
return ""
}
func (x *Authorization_Zanzibar_OpenFga) GetStoreId() string {
if x != nil {
return x.StoreId
}
return ""
}
func (x *Authorization_Zanzibar_OpenFga) GetToken() string {
if x != nil {
return x.Token
}
return ""
}
func (x *Authorization_Zanzibar_OpenFga) GetClientId() string {
if x != nil {
return x.ClientId
}
return ""
}
var File_conf_v1_kratos_conf_authz_proto protoreflect.FileDescriptor
var file_conf_v1_kratos_conf_authz_proto_rawDesc = string([]byte{
@@ -66,17 +450,84 @@ var file_conf_v1_kratos_conf_authz_proto_rawDesc = string([]byte{
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f,
0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x86, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d,
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x14, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e,
0x66, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f,
0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70,
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66,
0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66,
0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47,
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e,
0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc1, 0x08, 0x0a, 0x0d, 0x41, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x32, 0x0a,
0x06, 0x63, 0x61, 0x73, 0x62, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x43, 0x61, 0x73, 0x62, 0x69, 0x6e, 0x52, 0x06, 0x63, 0x61, 0x73, 0x62, 0x69,
0x6e, 0x12, 0x29, 0x0a, 0x03, 0x6f, 0x70, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17,
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x50, 0x41, 0x52, 0x03, 0x6f, 0x70, 0x61, 0x12, 0x38, 0x0a, 0x08,
0x7a, 0x61, 0x6e, 0x7a, 0x69, 0x62, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c,
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x2e, 0x5a, 0x61, 0x6e, 0x7a, 0x69, 0x62, 0x61, 0x72, 0x52, 0x08, 0x7a, 0x61,
0x6e, 0x7a, 0x69, 0x62, 0x61, 0x72, 0x1a, 0xb2, 0x01, 0x0a, 0x06, 0x43, 0x61, 0x73, 0x62, 0x69,
0x6e, 0x12, 0x22, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x50, 0x61,
0x74, 0x68, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f,
0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0a, 0x70, 0x6f,
0x6c, 0x69, 0x63, 0x79, 0x50, 0x61, 0x74, 0x68, 0x88, 0x01, 0x01, 0x12, 0x1a, 0x0a, 0x08, 0x70,
0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70,
0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c,
0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x88,
0x01, 0x01, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x70, 0x61, 0x74,
0x68, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x74,
0x68, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x1a, 0xc7, 0x02, 0x0a, 0x03,
0x4f, 0x50, 0x41, 0x12, 0x41, 0x0a, 0x08, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74,
0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x50, 0x41, 0x2e, 0x50,
0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x6f,
0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74,
0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x50, 0x41, 0x2e, 0x52,
0x6f, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x72, 0x6f, 0x6c, 0x65, 0x73,
0x1a, 0x27, 0x0a, 0x0b, 0x52, 0x6f, 0x6c, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12,
0x18, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09,
0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x6f, 0x6c,
0x69, 0x63, 0x69, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5d, 0x0a, 0x0a, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x45,
0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x39, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74,
0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4f, 0x50, 0x41, 0x2e, 0x52,
0x6f, 0x6c, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x83, 0x03, 0x0a, 0x08, 0x5a, 0x61, 0x6e, 0x7a, 0x69, 0x62,
0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3a, 0x0a, 0x04, 0x6b, 0x65, 0x74, 0x6f, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x5a, 0x61, 0x6e, 0x7a, 0x69, 0x62,
0x61, 0x72, 0x2e, 0x4b, 0x65, 0x74, 0x6f, 0x48, 0x00, 0x52, 0x04, 0x6b, 0x65, 0x74, 0x6f, 0x88,
0x01, 0x01, 0x12, 0x44, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x66, 0x67, 0x61, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x5a, 0x61, 0x6e, 0x7a, 0x69, 0x62,
0x61, 0x72, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x46, 0x67, 0x61, 0x48, 0x01, 0x52, 0x07, 0x6f, 0x70,
0x65, 0x6e, 0x46, 0x67, 0x61, 0x88, 0x01, 0x01, 0x1a, 0x59, 0x0a, 0x04, 0x4b, 0x65, 0x74, 0x6f,
0x12, 0x1b, 0x0a, 0x09, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x77, 0x72, 0x69, 0x74, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x19, 0x0a,
0x08, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x72, 0x65, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x5f,
0x67, 0x72, 0x70, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x75, 0x73, 0x65, 0x47,
0x72, 0x70, 0x63, 0x1a, 0x70, 0x0a, 0x07, 0x4f, 0x70, 0x65, 0x6e, 0x46, 0x67, 0x61, 0x12, 0x17,
0x0a, 0x07, 0x61, 0x70, 0x69, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x06, 0x61, 0x70, 0x69, 0x55, 0x72, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65,
0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69,
0x65, 0x6e, 0x74, 0x49, 0x64, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6b, 0x65, 0x74, 0x6f, 0x42, 0x0b,
0x0a, 0x09, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x66, 0x67, 0x61, 0x42, 0x86, 0x01, 0x0a, 0x08,
0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x14, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73,
0x43, 0x6f, 0x6e, 0x66, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37,
0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74,
0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63,
0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43,
0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e,
0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04,
0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
})
var (
@@ -91,16 +542,32 @@ func file_conf_v1_kratos_conf_authz_proto_rawDescGZIP() []byte {
return file_conf_v1_kratos_conf_authz_proto_rawDescData
}
var file_conf_v1_kratos_conf_authz_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_conf_v1_kratos_conf_authz_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_conf_v1_kratos_conf_authz_proto_goTypes = []any{
(*Authorization)(nil), // 0: conf.Authorization
(*Authorization)(nil), // 0: conf.Authorization
(*Authorization_Casbin)(nil), // 1: conf.Authorization.Casbin
(*Authorization_OPA)(nil), // 2: conf.Authorization.OPA
(*Authorization_Zanzibar)(nil), // 3: conf.Authorization.Zanzibar
(*Authorization_OPA_RoleActions)(nil), // 4: conf.Authorization.OPA.RoleActions
nil, // 5: conf.Authorization.OPA.PoliciesEntry
nil, // 6: conf.Authorization.OPA.RolesEntry
(*Authorization_Zanzibar_Keto)(nil), // 7: conf.Authorization.Zanzibar.Keto
(*Authorization_Zanzibar_OpenFga)(nil), // 8: conf.Authorization.Zanzibar.OpenFga
}
var file_conf_v1_kratos_conf_authz_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
1, // 0: conf.Authorization.casbin:type_name -> conf.Authorization.Casbin
2, // 1: conf.Authorization.opa:type_name -> conf.Authorization.OPA
3, // 2: conf.Authorization.zanzibar:type_name -> conf.Authorization.Zanzibar
5, // 3: conf.Authorization.OPA.policies:type_name -> conf.Authorization.OPA.PoliciesEntry
6, // 4: conf.Authorization.OPA.roles:type_name -> conf.Authorization.OPA.RolesEntry
7, // 5: conf.Authorization.Zanzibar.keto:type_name -> conf.Authorization.Zanzibar.Keto
8, // 6: conf.Authorization.Zanzibar.open_fga:type_name -> conf.Authorization.Zanzibar.OpenFga
4, // 7: conf.Authorization.OPA.RolesEntry.value:type_name -> conf.Authorization.OPA.RoleActions
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_conf_v1_kratos_conf_authz_proto_init() }
@@ -108,13 +575,15 @@ func file_conf_v1_kratos_conf_authz_proto_init() {
if File_conf_v1_kratos_conf_authz_proto != nil {
return
}
file_conf_v1_kratos_conf_authz_proto_msgTypes[1].OneofWrappers = []any{}
file_conf_v1_kratos_conf_authz_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_conf_v1_kratos_conf_authz_proto_rawDesc), len(file_conf_v1_kratos_conf_authz_proto_rawDesc)),
NumEnums: 0,
NumMessages: 1,
NumMessages: 9,
NumExtensions: 0,
NumServices: 0,
},

View File

@@ -117,9 +117,12 @@ func (x *RemoteConfig) GetPolaris() *RemoteConfig_Polaris {
type RemoteConfig_Nacos struct {
state protoimpl.MessageState `protogen:"open.v1"`
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 服务端地址
Port uint64 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` // 服务端端口
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // 配置键
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 服务端地址
Port uint64 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` // 服务端端口
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // 配置键
Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` // 用户名
Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"` // 密码
NamespaceId string `protobuf:"bytes,6,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` // 命名空间ID
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -175,6 +178,27 @@ func (x *RemoteConfig_Nacos) GetKey() string {
return ""
}
func (x *RemoteConfig_Nacos) GetUsername() string {
if x != nil {
return x.Username
}
return ""
}
func (x *RemoteConfig_Nacos) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
func (x *RemoteConfig_Nacos) GetNamespaceId() string {
if x != nil {
return x.NamespaceId
}
return ""
}
type RemoteConfig_Etcd struct {
state protoimpl.MessageState `protogen:"open.v1"`
Endpoints []string `protobuf:"bytes,1,rep,name=endpoints,proto3" json:"endpoints,omitempty"` // 服务端地址
@@ -458,7 +482,7 @@ var file_conf_v1_kratos_conf_config_proto_rawDesc = string([]byte{
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x07, 0x0a, 0x0c, 0x52, 0x65, 0x6d,
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe1, 0x07, 0x0a, 0x0c, 0x52, 0x65, 0x6d,
0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a,
0x04, 0x65, 0x74, 0x63, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f,
@@ -482,49 +506,54 @@ var file_conf_v1_kratos_conf_config_proto_rawDesc = string([]byte{
0x72, 0x69, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x66,
0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x6f,
0x6c, 0x61, 0x72, 0x69, 0x73, 0x48, 0x05, 0x52, 0x07, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73,
0x88, 0x01, 0x01, 0x1a, 0x47, 0x0a, 0x05, 0x4e, 0x61, 0x63, 0x6f, 0x73, 0x12, 0x18, 0x0a, 0x07,
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02,
0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x6b, 0x0a, 0x04,
0x45, 0x74, 0x63, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
0x74, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07,
0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x4c, 0x0a, 0x06, 0x43, 0x6f, 0x6e,
0x73, 0x75, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61,
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64,
0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x8b, 0x01, 0x0a, 0x06, 0x41, 0x70, 0x6f, 0x6c,
0x6c, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x15,
0x0a, 0x06, 0x61, 0x70, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12,
0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a,
0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
0x65, 0x63, 0x72, 0x65, 0x74, 0x1a, 0x2a, 0x0a, 0x0a, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65,
0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63,
0x65, 0x1a, 0x09, 0x0a, 0x07, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x42, 0x07, 0x0a, 0x05,
0x5f, 0x65, 0x74, 0x63, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6e, 0x61, 0x63, 0x6f, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x61,
0x70, 0x6f, 0x6c, 0x6c, 0x6f, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e,
0x65, 0x74, 0x65, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73,
0x42, 0x87, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15, 0x4b,
0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50,
0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d,
0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65,
0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43,
0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66,
0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x88, 0x01, 0x01, 0x1a, 0xa2, 0x01, 0x0a, 0x05, 0x4e, 0x61, 0x63, 0x6f, 0x73, 0x12, 0x18, 0x0a,
0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18,
0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b,
0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1a, 0x0a,
0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73,
0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73,
0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x61, 0x6d,
0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x1a, 0x6b, 0x0a, 0x04, 0x45, 0x74, 0x63, 0x64,
0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20,
0x03, 0x28, 0x09, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x33,
0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65,
0x6f, 0x75, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x4c, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x12,
0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65,
0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73,
0x73, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x6b, 0x65, 0x79, 0x1a, 0x8b, 0x01, 0x0a, 0x06, 0x41, 0x70, 0x6f, 0x6c, 0x6c, 0x6f, 0x12, 0x1a,
0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x61, 0x70,
0x70, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49,
0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x6e,
0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63,
0x72, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65,
0x74, 0x1a, 0x2a, 0x0a, 0x0a, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x12,
0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x1a, 0x09, 0x0a,
0x07, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x65, 0x74, 0x63,
0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x42, 0x08, 0x0a, 0x06,
0x5f, 0x6e, 0x61, 0x63, 0x6f, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x61, 0x70, 0x6f, 0x6c, 0x6c,
0x6f, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73,
0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x42, 0x87, 0x01, 0x0a,
0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15, 0x4b, 0x72, 0x61, 0x74, 0x6f,
0x73, 0x43, 0x6f, 0x6e, 0x66, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74,
0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74,
0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f,
0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02,
0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43,
0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
})
var (

File diff suppressed because it is too large Load Diff

View File

@@ -14,6 +14,19 @@ message Authentication {
string key = 2; // JWT 秘钥
}
message OIDC {
string issuer_url = 1;
string audience = 2;
string method = 3; // JWT签名的算法支持算法HS256
}
optional Jwt jwt = 1;
message PresharedKey {
repeated string valid_keys = 1;
}
string type = 1;
optional Jwt jwt = 2; // JWT 认证
optional OIDC oidc = 3; // OIDC
optional PresharedKey preshared_key = 4; // 预共享密钥
}

View File

@@ -8,4 +8,46 @@ import "google/protobuf/duration.proto";
// 授权
message Authorization {
message Casbin {
optional string model_path = 1; // casbin 模型文件路径
optional string policy_path = 2; // casbin 策略文件路径
repeated string policies = 10; // 策略列表
optional string model = 11; // 模型内容
}
message OPA {
message RoleActions {
repeated string actions = 1; // 角色对应的操作列表 {
}
map<string, string> policies = 1; // OPA 策略列表
map<string, RoleActions> roles = 2; //
}
message Zanzibar {
message Keto {
string write_url = 1; // 写入 URL
string read_url = 2; // 读取 URL
bool use_grpc = 3; // 是否使用 gRPC
}
message OpenFga {
string api_url = 1; // OpenFGA API URL
string store_id = 2; // OpenFGA 存储 ID
string token = 3; // OpenFGA 访问令牌
string client_id = 4; // OpenFGA 客户端 ID
}
string type = 1; // zanzibar 类型
optional Keto keto = 2; // Keto 配置
optional OpenFga open_fga = 3; // OpenFGA 配置
}
string type = 1;
Casbin casbin = 2; // casbin
OPA opa = 3; // OPA
Zanzibar zanzibar = 4; // zanzibar
}

View File

@@ -12,6 +12,9 @@ message RemoteConfig {
string address = 1; // 服务端地址
uint64 port = 2; // 服务端端口
string key = 3; // 配置键
string username = 4; // 用户名
string password = 5; // 密码
string namespace_id = 6; // 命名空间ID
}
message Etcd {

View File

@@ -62,7 +62,6 @@ message Server {
string password = 5; // 密码
string client_id = 6; // 客户端ID
bool clean_session = 7; // 清除会话
bool enable_keep_alive = 8; // 启用心跳
}
// Kafka
@@ -70,7 +69,6 @@ message Server {
repeated string endpoints = 1; // 对端网络地址
string codec = 2; // 编解码器: json,xml,yaml...
TLS tls = 3; // TLS配置
bool enable_keep_alive = 4; // 启用心跳
}
// RabbitMQ
@@ -78,42 +76,36 @@ message Server {
repeated string endpoints = 1; // 对端网络地址
string codec = 2; // 编解码器: json,xml,yaml...
TLS tls = 3; // TLS配置
bool enable_keep_alive = 4; // 启用心跳
}
message ActiveMQ {
string endpoint = 1; // 对端网络地址
string codec = 2; // 编解码器: json,xml,yaml...
TLS tls = 3; // TLS配置
bool enable_keep_alive = 4; // 启用心跳
}
message NATS {
string endpoint = 1; // 对端网络地址
string codec = 2; // 编解码器: json,xml,yaml...
TLS tls = 3; // TLS配置
bool enable_keep_alive = 4; // 启用心跳
}
message NSQ {
string endpoint = 1; // 对端网络地址
string codec = 2; // 编解码器: json,xml,yaml...
TLS tls = 3; // TLS配置
bool enable_keep_alive = 4; // 启用心跳
}
message Pulsar {
string endpoint = 1; // 对端网络地址
string codec = 2; // 编解码器: json,xml,yaml...
TLS tls = 3; // TLS配置
bool enable_keep_alive = 4; // 启用心跳
}
message Redis {
string endpoint = 1; // 对端网络地址
string codec = 2; // 编解码器: json,xml,yaml...
TLS tls = 3; // TLS配置
bool enable_keep_alive = 4; // 启用心跳
}
message RocketMQ {
@@ -134,7 +126,6 @@ message Server {
TLS tls = 11; // TLS配置
bool enable_trace = 100;
bool enable_keep_alive = 101; // 启用心跳
}
// Asynq
@@ -154,9 +145,8 @@ message Server {
int32 group_max_size = 12; // 组最大大小
map<string, int32> queues = 13; // 队列
bool enable_keep_alive = 20; // 启用心跳
bool enable_gracefully_shutdown = 21; // 优雅关闭
bool enable_strict_priority = 22; // 严格优先级
bool enable_gracefully_shutdown = 20; // 优雅关闭
bool enable_strict_priority = 21; // 严格优先级
google.protobuf.Duration shutdown_timeout = 30; // 关闭超时时间
google.protobuf.Duration dial_timeout = 31; // 拨号超时时间
@@ -188,10 +178,9 @@ message Server {
string consumer_queue = 32; // 消费者队列
TLS tls = 50; // TLS配置
bool enable_keep_alive = 51; // 启用心跳
string default_queue = 52; // 默认队列
int32 results_expire_in = 53; // 结果过期时间
bool no_unix_signals = 54; // 禁用Unix信号
string default_queue = 51; // 默认队列
int32 results_expire_in = 52; // 结果过期时间
bool no_unix_signals = 53; // 禁用Unix信号
message Redis {
int32 max_idle = 1;
@@ -305,12 +294,19 @@ message Server {
TLS tls = 7; // TLS配置
}
message KeepAlive {
string network = 1; // 网络
string addr = 2; // 服务监听地址
TLS tls = 3; // TLS配置
}
// RPC
optional REST rest = 1; // REST服务
optional GRPC grpc = 2; // gRPC服务
optional GraphQL graphql = 3; // GraphQL服务
optional Thrift thrift = 4; // Thrift服务
optional KeepAlive keepalive = 5; // 保活服务
// Message Queue

8
cache/redis/go.mod vendored
View File

@@ -8,9 +8,9 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
require (
github.com/go-kratos/kratos/v2 v2.8.4
github.com/redis/go-redis/extra/redisotel/v9 v9.9.0
github.com/redis/go-redis/v9 v9.9.0
github.com/tx7do/kratos-bootstrap/api v0.0.21
github.com/redis/go-redis/extra/redisotel/v9 v9.10.0
github.com/redis/go-redis/v9 v9.10.0
github.com/tx7do/kratos-bootstrap/api v0.0.23
)
require (
@@ -18,7 +18,7 @@ require (
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/redis/go-redis/extra/rediscmd/v9 v9.9.0 // indirect
github.com/redis/go-redis/extra/rediscmd/v9 v9.10.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel v1.36.0 // indirect
go.opentelemetry.io/otel/metric v1.36.0 // indirect

12
cache/redis/go.sum vendored
View File

@@ -19,12 +19,12 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/redis/go-redis/extra/rediscmd/v9 v9.9.0 h1:fhZTCKxHb3jlFYktf+ReLzEMrt58NHpmoZsky+8Xz3s=
github.com/redis/go-redis/extra/rediscmd/v9 v9.9.0/go.mod h1:UmKU2NxlGJSED8CBkZftTpwke0Tg144MKAu/d/r4L0I=
github.com/redis/go-redis/extra/redisotel/v9 v9.9.0 h1:trEhEKFu8qKSNl+7TRvUKcsoAEsPUsrO0HBf00mBSbg=
github.com/redis/go-redis/extra/redisotel/v9 v9.9.0/go.mod h1:gz3iYRb85Y8cXhuZKCvwZBH9rS+VS6ZCMItCRdMA+NU=
github.com/redis/go-redis/v9 v9.9.0 h1:URbPQ4xVQSQhZ27WMQVmZSo3uT3pL+4IdHVcYq2nVfM=
github.com/redis/go-redis/v9 v9.9.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
github.com/redis/go-redis/extra/rediscmd/v9 v9.10.0 h1:uTiEyEyfLhkw678n6EulHVto8AkcXVr8zUcBJNZ0ark=
github.com/redis/go-redis/extra/rediscmd/v9 v9.10.0/go.mod h1:eFYL/99JvdLP4T9/3FZ5t2pClnv7mMskc+WstTcyVr4=
github.com/redis/go-redis/extra/redisotel/v9 v9.10.0 h1:4z7/hCJ9Jft8EBb2tDmK38p2WjyIEJ1ShhhwAhjOCps=
github.com/redis/go-redis/extra/redisotel/v9 v9.10.0/go.mod h1:B0thqLh4hB8MvvcUKSwyP5YiIcCCp8UrQ0cA9gEqyjk=
github.com/redis/go-redis/v9 v9.10.0 h1:FxwK3eV8p/CQa0Ch276C7u2d0eNC9kCmAYQ7mCXCzVs=
github.com/redis/go-redis/v9 v9.10.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=

12
cache/redis/redis.go vendored
View File

@@ -10,7 +10,7 @@ import (
)
// NewClient create go-redis client
func NewClient(conf *conf.Data) (rdb *redis.Client) {
func NewClient(conf *conf.Data, logger *log.Helper) (rdb *redis.Client) {
if rdb = redis.NewClient(&redis.Options{
Addr: conf.GetRedis().GetAddr(),
Password: conf.GetRedis().GetPassword(),
@@ -19,23 +19,23 @@ func NewClient(conf *conf.Data) (rdb *redis.Client) {
WriteTimeout: conf.GetRedis().GetWriteTimeout().AsDuration(),
ReadTimeout: conf.GetRedis().GetReadTimeout().AsDuration(),
}); rdb == nil {
log.Fatalf("failed opening connection to redis")
logger.Fatalf("failed opening connection to redis")
return nil
}
// open tracing instrumentation.
if conf.GetRedis().GetEnableTracing() {
if err := redisotel.InstrumentTracing(rdb); err != nil {
log.Fatalf("failed open tracing: %s", err.Error())
panic(err)
logger.Fatalf("failed open tracing: %s", err.Error())
return nil
}
}
// open metrics instrumentation.
if conf.GetRedis().GetEnableMetrics() {
if err := redisotel.InstrumentMetrics(rdb); err != nil {
log.Fatalf("failed open metrics: %s", err.Error())
panic(err)
logger.Fatalf("failed open metrics: %s", err.Error())
return nil
}
}

View File

@@ -41,6 +41,9 @@ func NewConfigSource(c *conf.RemoteConfig) config.Source {
LogDir: "../../configs/log", // 日志目录
NotLoadCacheAtStart: true, // 在启动时不读取本地缓存数据true--不读取false--读取
UpdateCacheWhenEmpty: true, // 当服务列表为空时是否更新本地缓存true--更新,false--不更新
Username: c.Nacos.Username, //用户名
Password: c.Nacos.Password, //密码
NamespaceId: c.Nacos.NamespaceId, //命名空间ID
}
nacosClient, err := nacosClients.NewConfigClient(

View File

@@ -1,8 +1,8 @@
git tag api/v0.0.21 --force
git tag api/v0.0.24 --force
git tag utils/v0.1.4 --force
git tag cache/redis/v0.0.10 --force
git tag cache/redis/v0.0.11 --force
git tag oss/minio/v0.0.10 --force
git tag logger/v0.0.10 --force
git tag rpc/v0.0.14 --force