mirror of
https://github.com/mainflux/mainflux.git
synced 2025-05-08 19:29:17 +08:00

* Reformat Policies Enpoint to Take Sub Obj Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Redirect to `policies` Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Make Delete Endpoint not to Contain Body Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Remove gRPC unused functions Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Remove Redirect Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Update CLI Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Use Switch Statement Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Uncomment Commented Parts Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Empty Line Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Remove Unused gRPC Req and Resp Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Fix Listing of Policies Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Rename Authorize Functions For Users and Things Service Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Add Authorize To CLI Signed-off-by: rodneyosodo <blackd0t@protonmail.com> --------- Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
380 lines
12 KiB
Go
380 lines
12 KiB
Go
// Copyright (c) Mainflux
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
|
// versions:
|
|
// protoc-gen-go v1.31.0
|
|
// protoc v4.23.3
|
|
// source: users/policies/auth.proto
|
|
|
|
package policies
|
|
|
|
import (
|
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
|
reflect "reflect"
|
|
sync "sync"
|
|
)
|
|
|
|
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)
|
|
)
|
|
|
|
type AuthorizeReq struct {
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
|
|
Object string `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"`
|
|
Action string `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"`
|
|
EntityType string `protobuf:"bytes,4,opt,name=entityType,proto3" json:"entityType,omitempty"`
|
|
}
|
|
|
|
func (x *AuthorizeReq) Reset() {
|
|
*x = AuthorizeReq{}
|
|
if protoimpl.UnsafeEnabled {
|
|
mi := &file_users_policies_auth_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
}
|
|
|
|
func (x *AuthorizeReq) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*AuthorizeReq) ProtoMessage() {}
|
|
|
|
func (x *AuthorizeReq) ProtoReflect() protoreflect.Message {
|
|
mi := &file_users_policies_auth_proto_msgTypes[0]
|
|
if protoimpl.UnsafeEnabled && x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use AuthorizeReq.ProtoReflect.Descriptor instead.
|
|
func (*AuthorizeReq) Descriptor() ([]byte, []int) {
|
|
return file_users_policies_auth_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *AuthorizeReq) GetSubject() string {
|
|
if x != nil {
|
|
return x.Subject
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AuthorizeReq) GetObject() string {
|
|
if x != nil {
|
|
return x.Object
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AuthorizeReq) GetAction() string {
|
|
if x != nil {
|
|
return x.Action
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *AuthorizeReq) GetEntityType() string {
|
|
if x != nil {
|
|
return x.EntityType
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type AuthorizeRes struct {
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Authorized bool `protobuf:"varint,1,opt,name=authorized,proto3" json:"authorized,omitempty"`
|
|
}
|
|
|
|
func (x *AuthorizeRes) Reset() {
|
|
*x = AuthorizeRes{}
|
|
if protoimpl.UnsafeEnabled {
|
|
mi := &file_users_policies_auth_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
}
|
|
|
|
func (x *AuthorizeRes) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*AuthorizeRes) ProtoMessage() {}
|
|
|
|
func (x *AuthorizeRes) ProtoReflect() protoreflect.Message {
|
|
mi := &file_users_policies_auth_proto_msgTypes[1]
|
|
if protoimpl.UnsafeEnabled && x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use AuthorizeRes.ProtoReflect.Descriptor instead.
|
|
func (*AuthorizeRes) Descriptor() ([]byte, []int) {
|
|
return file_users_policies_auth_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *AuthorizeRes) GetAuthorized() bool {
|
|
if x != nil {
|
|
return x.Authorized
|
|
}
|
|
return false
|
|
}
|
|
|
|
type IdentifyReq struct {
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
|
|
}
|
|
|
|
func (x *IdentifyReq) Reset() {
|
|
*x = IdentifyReq{}
|
|
if protoimpl.UnsafeEnabled {
|
|
mi := &file_users_policies_auth_proto_msgTypes[2]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
}
|
|
|
|
func (x *IdentifyReq) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*IdentifyReq) ProtoMessage() {}
|
|
|
|
func (x *IdentifyReq) ProtoReflect() protoreflect.Message {
|
|
mi := &file_users_policies_auth_proto_msgTypes[2]
|
|
if protoimpl.UnsafeEnabled && x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use IdentifyReq.ProtoReflect.Descriptor instead.
|
|
func (*IdentifyReq) Descriptor() ([]byte, []int) {
|
|
return file_users_policies_auth_proto_rawDescGZIP(), []int{2}
|
|
}
|
|
|
|
func (x *IdentifyReq) GetToken() string {
|
|
if x != nil {
|
|
return x.Token
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type IdentifyRes struct {
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
|
}
|
|
|
|
func (x *IdentifyRes) Reset() {
|
|
*x = IdentifyRes{}
|
|
if protoimpl.UnsafeEnabled {
|
|
mi := &file_users_policies_auth_proto_msgTypes[3]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
}
|
|
|
|
func (x *IdentifyRes) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*IdentifyRes) ProtoMessage() {}
|
|
|
|
func (x *IdentifyRes) ProtoReflect() protoreflect.Message {
|
|
mi := &file_users_policies_auth_proto_msgTypes[3]
|
|
if protoimpl.UnsafeEnabled && x != nil {
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
if ms.LoadMessageInfo() == nil {
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
return ms
|
|
}
|
|
return mi.MessageOf(x)
|
|
}
|
|
|
|
// Deprecated: Use IdentifyRes.ProtoReflect.Descriptor instead.
|
|
func (*IdentifyRes) Descriptor() ([]byte, []int) {
|
|
return file_users_policies_auth_proto_rawDescGZIP(), []int{3}
|
|
}
|
|
|
|
func (x *IdentifyRes) GetId() string {
|
|
if x != nil {
|
|
return x.Id
|
|
}
|
|
return ""
|
|
}
|
|
|
|
var File_users_policies_auth_proto protoreflect.FileDescriptor
|
|
|
|
var file_users_policies_auth_proto_rawDesc = []byte{
|
|
0x0a, 0x19, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73,
|
|
0x2f, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x6d, 0x61, 0x69,
|
|
0x6e, 0x66, 0x6c, 0x75, 0x78, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x6f, 0x6c, 0x69,
|
|
0x63, 0x69, 0x65, 0x73, 0x22, 0x78, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a,
|
|
0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18,
|
|
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16,
|
|
0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
|
0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e,
|
|
0x0a, 0x0a, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01,
|
|
0x28, 0x09, 0x52, 0x0a, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x22, 0x2e,
|
|
0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x12, 0x1e,
|
|
0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01,
|
|
0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x64, 0x22, 0x23,
|
|
0x0a, 0x0b, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a,
|
|
0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f,
|
|
0x6b, 0x65, 0x6e, 0x22, 0x1d, 0x0a, 0x0b, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x52,
|
|
0x65, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
|
0x69, 0x64, 0x32, 0xc4, 0x01, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69,
|
|
0x63, 0x65, 0x12, 0x58, 0x0a, 0x08, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x12, 0x24,
|
|
0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x66, 0x6c, 0x75, 0x78, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2e,
|
|
0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66,
|
|
0x79, 0x52, 0x65, 0x71, 0x1a, 0x24, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x66, 0x6c, 0x75, 0x78, 0x2e,
|
|
0x75, 0x73, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x49,
|
|
0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x09,
|
|
0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x12, 0x25, 0x2e, 0x6d, 0x61, 0x69, 0x6e,
|
|
0x66, 0x6c, 0x75, 0x78, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63,
|
|
0x69, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x71,
|
|
0x1a, 0x25, 0x2e, 0x6d, 0x61, 0x69, 0x6e, 0x66, 0x6c, 0x75, 0x78, 0x2e, 0x75, 0x73, 0x65, 0x72,
|
|
0x73, 0x2e, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f,
|
|
0x72, 0x69, 0x7a, 0x65, 0x52, 0x65, 0x73, 0x22, 0x00, 0x42, 0x0c, 0x5a, 0x0a, 0x2e, 0x2f, 0x70,
|
|
0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
}
|
|
|
|
var (
|
|
file_users_policies_auth_proto_rawDescOnce sync.Once
|
|
file_users_policies_auth_proto_rawDescData = file_users_policies_auth_proto_rawDesc
|
|
)
|
|
|
|
func file_users_policies_auth_proto_rawDescGZIP() []byte {
|
|
file_users_policies_auth_proto_rawDescOnce.Do(func() {
|
|
file_users_policies_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_users_policies_auth_proto_rawDescData)
|
|
})
|
|
return file_users_policies_auth_proto_rawDescData
|
|
}
|
|
|
|
var file_users_policies_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
|
var file_users_policies_auth_proto_goTypes = []interface{}{
|
|
(*AuthorizeReq)(nil), // 0: mainflux.users.policies.AuthorizeReq
|
|
(*AuthorizeRes)(nil), // 1: mainflux.users.policies.AuthorizeRes
|
|
(*IdentifyReq)(nil), // 2: mainflux.users.policies.IdentifyReq
|
|
(*IdentifyRes)(nil), // 3: mainflux.users.policies.IdentifyRes
|
|
}
|
|
var file_users_policies_auth_proto_depIdxs = []int32{
|
|
2, // 0: mainflux.users.policies.AuthService.Identify:input_type -> mainflux.users.policies.IdentifyReq
|
|
0, // 1: mainflux.users.policies.AuthService.Authorize:input_type -> mainflux.users.policies.AuthorizeReq
|
|
3, // 2: mainflux.users.policies.AuthService.Identify:output_type -> mainflux.users.policies.IdentifyRes
|
|
1, // 3: mainflux.users.policies.AuthService.Authorize:output_type -> mainflux.users.policies.AuthorizeRes
|
|
2, // [2:4] is the sub-list for method output_type
|
|
0, // [0:2] 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
|
|
}
|
|
|
|
func init() { file_users_policies_auth_proto_init() }
|
|
func file_users_policies_auth_proto_init() {
|
|
if File_users_policies_auth_proto != nil {
|
|
return
|
|
}
|
|
if !protoimpl.UnsafeEnabled {
|
|
file_users_policies_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
|
switch v := v.(*AuthorizeReq); i {
|
|
case 0:
|
|
return &v.state
|
|
case 1:
|
|
return &v.sizeCache
|
|
case 2:
|
|
return &v.unknownFields
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
file_users_policies_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
|
switch v := v.(*AuthorizeRes); i {
|
|
case 0:
|
|
return &v.state
|
|
case 1:
|
|
return &v.sizeCache
|
|
case 2:
|
|
return &v.unknownFields
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
file_users_policies_auth_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
|
switch v := v.(*IdentifyReq); i {
|
|
case 0:
|
|
return &v.state
|
|
case 1:
|
|
return &v.sizeCache
|
|
case 2:
|
|
return &v.unknownFields
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
file_users_policies_auth_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
|
switch v := v.(*IdentifyRes); i {
|
|
case 0:
|
|
return &v.state
|
|
case 1:
|
|
return &v.sizeCache
|
|
case 2:
|
|
return &v.unknownFields
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: file_users_policies_auth_proto_rawDesc,
|
|
NumEnums: 0,
|
|
NumMessages: 4,
|
|
NumExtensions: 0,
|
|
NumServices: 1,
|
|
},
|
|
GoTypes: file_users_policies_auth_proto_goTypes,
|
|
DependencyIndexes: file_users_policies_auth_proto_depIdxs,
|
|
MessageInfos: file_users_policies_auth_proto_msgTypes,
|
|
}.Build()
|
|
File_users_policies_auth_proto = out.File
|
|
file_users_policies_auth_proto_rawDesc = nil
|
|
file_users_policies_auth_proto_goTypes = nil
|
|
file_users_policies_auth_proto_depIdxs = nil
|
|
}
|