diff --git a/auth/api/grpc/auth/client.go b/auth/api/grpc/auth/client.go index 3e85779c5ed..d7e2f2c6737 100644 --- a/auth/api/grpc/auth/client.go +++ b/auth/api/grpc/auth/client.go @@ -44,15 +44,6 @@ func NewAuthClient(conn *grpc.ClientConn, timeout time.Duration) grpcAuthV1.Auth grpcAuthV1.AuthZRes{}, ).Endpoint(), timeout: timeout, - authorizePAT: kitgrpc.NewClient( - conn, - authSvcName, - "AuthorizePAT", - encodeAuthorizePATRequest, - decodeAuthorizeResponse, - grpcAuthV1.AuthZRes{}, - ).Endpoint(), - timeout: timeout, } } @@ -119,36 +110,3 @@ func encodeAuthorizeRequest(_ context.Context, grpcReq interface{}) (interface{} }, nil } -func (client authGrpcClient) AuthorizePAT(ctx context.Context, req *grpcAuthV1.AuthZReq, _ ...grpc.CallOption) (r *grpcAuthV1.AuthZRes, err error) { - ctx, cancel := context.WithTimeout(ctx, client.timeout) - defer cancel() - - res, err := client.authorize(ctx, authReq{ - Domain: req.GetDomain(), - SubjectType: req.GetSubjectType(), - Subject: req.GetSubject(), - SubjectKind: req.GetSubjectKind(), - Relation: req.GetRelation(), - Permission: req.GetPermission(), - ObjectType: req.GetObjectType(), - Object: req.GetObject(), - }) - if err != nil { - return &grpcAuthV1.AuthZRes{}, grpcapi.DecodeError(err) - } - - ar := res.(authorizeRes) - return &grpcAuthV1.AuthZRes{Authorized: ar.authorized, Id: ar.id}, nil -} - -func encodeAuthorizePATRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { - req := grpcReq.(authPATReq) - return &grpcAuthV1.AuthZpatReq{ - PaToken: req.paToken, - PlatformEntityType: req.platformEntityType, - OptionalDomainID: req.optionalDomainID, - OptionalDomainEntityType: req.optionalDomainEntityType, - Operation: req.operation, - EntityIDs: req.entityIDs, - }, nil -} diff --git a/auth/api/grpc/auth/endpoint.go b/auth/api/grpc/auth/endpoint.go index aeccfcb48b3..adc20eaeaf0 100644 --- a/auth/api/grpc/auth/endpoint.go +++ b/auth/api/grpc/auth/endpoint.go @@ -50,18 +50,3 @@ func authorizeEndpoint(svc auth.Service) endpoint.Endpoint { return authorizeRes{authorized: true}, nil } } - -func authorizePATEndpoint(svc auth.Service) endpoint.Endpoint { - return func(ctx context.Context, request interface{}) (interface{}, error) { - req := request.(authPATReq) - - if err := req.validate(); err != nil { - return authorizeRes{}, err - } - err := svc.AuthorizePAT(ctx, req.paToken, req.platformEntityType, req.optionalDomainID,req.optionalDomainEntityType, req.operation, req.entityIDs) - if err != nil { - return authorizeRes{authorized: false}, err - } - return authorizeRes{authorized: true}, nil - } -} diff --git a/auth/api/grpc/auth/server.go b/auth/api/grpc/auth/server.go index a63d33e13d3..af6833cf9af 100644 --- a/auth/api/grpc/auth/server.go +++ b/auth/api/grpc/auth/server.go @@ -18,7 +18,6 @@ type authGrpcServer struct { grpcAuthV1.UnimplementedAuthServiceServer authorize kitgrpc.Handler authenticate kitgrpc.Handler - authorizePAT kitgrpc.Handler } // NewAuthServer returns new AuthnServiceServer instance. @@ -35,12 +34,6 @@ func NewAuthServer(svc auth.Service) grpcAuthV1.AuthServiceServer { decodeAuthenticateRequest, encodeAuthenticateResponse, ), - - authorizePAT: kitgrpc.NewServer( - (authorizePATEndpoint(svc)), - decodeAuthorizePATRequest, - encodeAuthorizeResponse, - ), } } @@ -88,15 +81,3 @@ func encodeAuthorizeResponse(_ context.Context, grpcRes interface{}) (interface{ res := grpcRes.(authorizeRes) return &grpcAuthV1.AuthZRes{Authorized: res.authorized, Id: res.id}, nil } - -func decodeAuthorizePATRequest(_ context.Context, grpcReq interface{}) (interface{}, error) { - req := grpcReq.(*grpcAuthV1.AuthZpatReq) - return authPATReq{ - paToken: req.GetPaToken(), - platformEntityType: req.GetPlatformEntityType(), - optionalDomainID: req.GetOptionalDomainID(), - optionalDomainEntityType: req.GetOptionalDomainEntityType(), - operation: req.GetOperation(), - entityIDs: req.GetEntityIDs(), - }, nil -} diff --git a/internal/grpc/auth/v1/auth.pb.go b/internal/grpc/auth/v1/auth.pb.go index f9b49d9aed7..c11e1e9e7ca 100644 --- a/internal/grpc/auth/v1/auth.pb.go +++ b/internal/grpc/auth/v1/auth.pb.go @@ -244,93 +244,6 @@ func (x *AuthZReq) GetObjectType() string { return "" } -type AuthZpatReq struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - PaToken string `protobuf:"bytes,1,opt,name=paToken,proto3" json:"paToken,omitempty"` // PaToken - PlatformEntityType string `protobuf:"bytes,2,opt,name=platform_entity_type,json=platformEntityType,proto3" json:"platform_entity_type,omitempty"` // Platform entity type - OptionalDomainID string `protobuf:"bytes,3,opt,name=optional_domainID,json=optionalDomainID,proto3" json:"optional_domainID,omitempty"` // Optional domain id - OptionalDomainEntityType string `protobuf:"bytes,4,opt,name=optional_domain_entity_type,json=optionalDomainEntityType,proto3" json:"optional_domain_entity_type,omitempty"` // Optional domain entity type - Operation string `protobuf:"bytes,5,opt,name=operation,proto3" json:"operation,omitempty"` // Operation - EntityIDs []string `protobuf:"bytes,6,rep,name=entityIDs,proto3" json:"entityIDs,omitempty"` // EntityIDs -} - -func (x *AuthZpatReq) Reset() { - *x = AuthZpatReq{} - if protoimpl.UnsafeEnabled { - mi := &file_auth_v1_auth_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AuthZpatReq) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AuthZpatReq) ProtoMessage() {} - -func (x *AuthZpatReq) ProtoReflect() protoreflect.Message { - mi := &file_auth_v1_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 AuthZpatReq.ProtoReflect.Descriptor instead. -func (*AuthZpatReq) Descriptor() ([]byte, []int) { - return file_auth_v1_auth_proto_rawDescGZIP(), []int{3} -} - -func (x *AuthZpatReq) GetPaToken() string { - if x != nil { - return x.PaToken - } - return "" -} - -func (x *AuthZpatReq) GetPlatformEntityType() string { - if x != nil { - return x.PlatformEntityType - } - return "" -} - -func (x *AuthZpatReq) GetOptionalDomainID() string { - if x != nil { - return x.OptionalDomainID - } - return "" -} - -func (x *AuthZpatReq) GetOptionalDomainEntityType() string { - if x != nil { - return x.OptionalDomainEntityType - } - return "" -} - -func (x *AuthZpatReq) GetOperation() string { - if x != nil { - return x.Operation - } - return "" -} - -func (x *AuthZpatReq) GetEntityIDs() []string { - if x != nil { - return x.EntityIDs - } - return nil -} - type AuthZRes struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -343,7 +256,7 @@ type AuthZRes struct { func (x *AuthZRes) Reset() { *x = AuthZRes{} if protoimpl.UnsafeEnabled { - mi := &file_auth_v1_auth_proto_msgTypes[4] + mi := &file_auth_v1_auth_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -356,7 +269,7 @@ func (x *AuthZRes) String() string { func (*AuthZRes) ProtoMessage() {} func (x *AuthZRes) ProtoReflect() protoreflect.Message { - mi := &file_auth_v1_auth_proto_msgTypes[4] + mi := &file_auth_v1_auth_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -369,7 +282,7 @@ func (x *AuthZRes) ProtoReflect() protoreflect.Message { // Deprecated: Use AuthZRes.ProtoReflect.Descriptor instead. func (*AuthZRes) Descriptor() ([]byte, []int) { - return file_auth_v1_auth_proto_rawDescGZIP(), []int{4} + return file_auth_v1_auth_proto_rawDescGZIP(), []int{3} } func (x *AuthZRes) GetAuthorized() bool { @@ -416,33 +329,13 @@ var file_auth_v1_auth_proto_rawDesc = []byte{ 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x81, 0x02, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x5a, - 0x70, 0x61, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x12, 0x30, 0x0a, 0x14, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x5f, 0x65, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, - 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x64, - 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x49, 0x44, 0x12, - 0x3d, 0x0a, 0x1b, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x6f, 0x6d, 0x61, - 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x18, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x44, 0x6f, - 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x44, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x09, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x44, 0x73, 0x22, 0x3a, 0x0a, 0x08, 0x41, 0x75, - 0x74, 0x68, 0x5a, 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, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0xb5, 0x01, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x7a, 0x65, 0x12, 0x11, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, - 0x74, 0x68, 0x5a, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, - 0x2e, 0x41, 0x75, 0x74, 0x68, 0x5a, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x0c, 0x41, - 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x50, 0x41, 0x54, 0x12, 0x14, 0x2e, 0x61, 0x75, - 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x5a, 0x70, 0x61, 0x74, 0x52, 0x65, + 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x5a, 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, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, + 0x69, 0x64, 0x32, 0x7a, 0x0a, 0x0b, 0x41, 0x75, 0x74, 0x68, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x33, 0x0a, 0x09, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x65, 0x12, 0x11, + 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x5a, 0x52, 0x65, 0x71, 0x1a, 0x11, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x5a, 0x52, 0x65, 0x73, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x11, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x76, 0x31, @@ -466,23 +359,20 @@ func file_auth_v1_auth_proto_rawDescGZIP() []byte { return file_auth_v1_auth_proto_rawDescData } -var file_auth_v1_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_auth_v1_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_auth_v1_auth_proto_goTypes = []any{ - (*AuthNReq)(nil), // 0: auth.v1.AuthNReq - (*AuthNRes)(nil), // 1: auth.v1.AuthNRes - (*AuthZReq)(nil), // 2: auth.v1.AuthZReq - (*AuthZpatReq)(nil), // 3: auth.v1.AuthZpatReq - (*AuthZRes)(nil), // 4: auth.v1.AuthZRes + (*AuthNReq)(nil), // 0: auth.v1.AuthNReq + (*AuthNRes)(nil), // 1: auth.v1.AuthNRes + (*AuthZReq)(nil), // 2: auth.v1.AuthZReq + (*AuthZRes)(nil), // 3: auth.v1.AuthZRes } var file_auth_v1_auth_proto_depIdxs = []int32{ 2, // 0: auth.v1.AuthService.Authorize:input_type -> auth.v1.AuthZReq - 3, // 1: auth.v1.AuthService.AuthorizePAT:input_type -> auth.v1.AuthZpatReq - 0, // 2: auth.v1.AuthService.Authenticate:input_type -> auth.v1.AuthNReq - 4, // 3: auth.v1.AuthService.Authorize:output_type -> auth.v1.AuthZRes - 4, // 4: auth.v1.AuthService.AuthorizePAT:output_type -> auth.v1.AuthZRes - 1, // 5: auth.v1.AuthService.Authenticate:output_type -> auth.v1.AuthNRes - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type + 0, // 1: auth.v1.AuthService.Authenticate:input_type -> auth.v1.AuthNReq + 3, // 2: auth.v1.AuthService.Authorize:output_type -> auth.v1.AuthZRes + 1, // 3: auth.v1.AuthService.Authenticate:output_type -> auth.v1.AuthNRes + 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 @@ -531,18 +421,6 @@ func file_auth_v1_auth_proto_init() { } } file_auth_v1_auth_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*AuthZpatReq); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_auth_v1_auth_proto_msgTypes[4].Exporter = func(v any, i int) any { switch v := v.(*AuthZRes); i { case 0: return &v.state @@ -561,7 +439,7 @@ func file_auth_v1_auth_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_auth_v1_auth_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/internal/grpc/auth/v1/auth_grpc.pb.go b/internal/grpc/auth/v1/auth_grpc.pb.go index 25042060d54..c1ff612fe14 100644 --- a/internal/grpc/auth/v1/auth_grpc.pb.go +++ b/internal/grpc/auth/v1/auth_grpc.pb.go @@ -23,7 +23,6 @@ const _ = grpc.SupportPackageIsVersion8 const ( AuthService_Authorize_FullMethodName = "/auth.v1.AuthService/Authorize" - AuthService_AuthorizePAT_FullMethodName = "/auth.v1.AuthService/AuthorizePAT" AuthService_Authenticate_FullMethodName = "/auth.v1.AuthService/Authenticate" ) @@ -35,7 +34,6 @@ const ( // functionalities for magistrala services. type AuthServiceClient interface { Authorize(ctx context.Context, in *AuthZReq, opts ...grpc.CallOption) (*AuthZRes, error) - AuthorizePAT(ctx context.Context, in *AuthZpatReq, opts ...grpc.CallOption) (*AuthZRes, error) Authenticate(ctx context.Context, in *AuthNReq, opts ...grpc.CallOption) (*AuthNRes, error) } @@ -57,16 +55,6 @@ func (c *authServiceClient) Authorize(ctx context.Context, in *AuthZReq, opts .. return out, nil } -func (c *authServiceClient) AuthorizePAT(ctx context.Context, in *AuthZpatReq, opts ...grpc.CallOption) (*AuthZRes, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(AuthZRes) - err := c.cc.Invoke(ctx, AuthService_AuthorizePAT_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *authServiceClient) Authenticate(ctx context.Context, in *AuthNReq, opts ...grpc.CallOption) (*AuthNRes, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(AuthNRes) @@ -85,7 +73,6 @@ func (c *authServiceClient) Authenticate(ctx context.Context, in *AuthNReq, opts // functionalities for magistrala services. type AuthServiceServer interface { Authorize(context.Context, *AuthZReq) (*AuthZRes, error) - AuthorizePAT(context.Context, *AuthZpatReq) (*AuthZRes, error) Authenticate(context.Context, *AuthNReq) (*AuthNRes, error) mustEmbedUnimplementedAuthServiceServer() } @@ -97,9 +84,6 @@ type UnimplementedAuthServiceServer struct { func (UnimplementedAuthServiceServer) Authorize(context.Context, *AuthZReq) (*AuthZRes, error) { return nil, status.Errorf(codes.Unimplemented, "method Authorize not implemented") } -func (UnimplementedAuthServiceServer) AuthorizePAT(context.Context, *AuthZpatReq) (*AuthZRes, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthorizePAT not implemented") -} func (UnimplementedAuthServiceServer) Authenticate(context.Context, *AuthNReq) (*AuthNRes, error) { return nil, status.Errorf(codes.Unimplemented, "method Authenticate not implemented") } @@ -134,24 +118,6 @@ func _AuthService_Authorize_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _AuthService_AuthorizePAT_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(AuthZpatReq) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(AuthServiceServer).AuthorizePAT(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: AuthService_AuthorizePAT_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(AuthServiceServer).AuthorizePAT(ctx, req.(*AuthZpatReq)) - } - return interceptor(ctx, in, info, handler) -} - func _AuthService_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AuthNReq) if err := dec(in); err != nil { @@ -181,10 +147,6 @@ var AuthService_ServiceDesc = grpc.ServiceDesc{ MethodName: "Authorize", Handler: _AuthService_Authorize_Handler, }, - { - MethodName: "AuthorizePAT", - Handler: _AuthService_AuthorizePAT_Handler, - }, { MethodName: "Authenticate", Handler: _AuthService_Authenticate_Handler, diff --git a/internal/grpc/channels/v1/channels.pb.go b/internal/grpc/channels/v1/channels.pb.go index 7a227e0d9c3..904c0ea796e 100644 --- a/internal/grpc/channels/v1/channels.pb.go +++ b/internal/grpc/channels/v1/channels.pb.go @@ -207,9 +207,11 @@ type AuthzReq struct { func (x *AuthzReq) Reset() { *x = AuthzReq{} - mi := &file_channels_v1_channels_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_channels_v1_channels_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *AuthzReq) String() string { @@ -220,7 +222,7 @@ func (*AuthzReq) ProtoMessage() {} func (x *AuthzReq) ProtoReflect() protoreflect.Message { mi := &file_channels_v1_channels_proto_msgTypes[4] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -280,9 +282,11 @@ type AuthzRes struct { func (x *AuthzRes) Reset() { *x = AuthzRes{} - mi := &file_channels_v1_channels_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_channels_v1_channels_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *AuthzRes) String() string { @@ -293,7 +297,7 @@ func (*AuthzRes) ProtoMessage() {} func (x *AuthzRes) ProtoReflect() protoreflect.Message { mi := &file_channels_v1_channels_proto_msgTypes[5] - if x != nil { + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -461,6 +465,30 @@ func file_channels_v1_channels_proto_init() { return nil } } + file_channels_v1_channels_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*AuthzReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_channels_v1_channels_proto_msgTypes[5].Exporter = func(v any, i int) any { + switch v := v.(*AuthzRes); 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{ diff --git a/internal/grpc/things/v1/things.pb.go b/internal/grpc/things/v1/things.pb.go index c042f56fa83..41eb01e2891 100644 --- a/internal/grpc/things/v1/things.pb.go +++ b/internal/grpc/things/v1/things.pb.go @@ -35,9 +35,11 @@ type AuthnReq struct { func (x *AuthnReq) Reset() { *x = AuthnReq{} - mi := &file_things_v1_things_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_things_v1_things_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *AuthnReq) String() string { @@ -88,9 +90,11 @@ type AuthnRes struct { func (x *AuthnRes) Reset() { *x = AuthnRes{} - mi := &file_things_v1_things_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if protoimpl.UnsafeEnabled { + mi := &file_things_v1_things_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } func (x *AuthnRes) String() string { @@ -432,7 +436,7 @@ func file_things_v1_things_proto_init() { } if !protoimpl.UnsafeEnabled { file_things_v1_things_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*AuthzReq); i { + switch v := v.(*AuthnReq); i { case 0: return &v.state case 1: @@ -444,7 +448,7 @@ func file_things_v1_things_proto_init() { } } file_things_v1_things_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*AuthzRes); i { + switch v := v.(*AuthnRes); i { case 0: return &v.state case 1: diff --git a/internal/proto/auth/v1/auth.proto b/internal/proto/auth/v1/auth.proto index 99b7e28b883..74bb04fcc0e 100644 --- a/internal/proto/auth/v1/auth.proto +++ b/internal/proto/auth/v1/auth.proto @@ -10,7 +10,6 @@ option go_package = "github.com/absmach/magistrala/internal/grpc/auth/v1"; // functionalities for magistrala services. service AuthService { rpc Authorize(AuthZReq) returns (AuthZRes) {} - rpc AuthorizePAT(AuthZpatReq) returns (AuthZRes) {} rpc Authenticate(AuthNReq) returns (AuthNRes) {} } @@ -37,15 +36,6 @@ message AuthZReq { string object_type = 9; // Thing, User, Group } -message AuthZpatReq { - string paToken = 1; // PaToken - string platform_entity_type = 2; // Platform entity type - string optional_domainID = 3; // Optional domain id - string optional_domain_entity_type = 4; // Optional domain entity type - string operation = 5; // Operation - repeated string entityIDs = 6; // EntityIDs -} - message AuthZRes { bool authorized = 1; string id = 2;