permission

package
v0.0.0-...-2c311f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 9 Imported by: 0

README

权限认证

鉴权的要素:

  • User
  • Namespace
  • Endpioint

Documentation

Index

Constants

View Source
const (
	AppName = "permissions"
)

Variables

View Source
var File_apps_permission_pb_rpc_proto protoreflect.FileDescriptor
View Source
var RPC_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "go9.devcloud.permission.RPC",
	HandlerType: (*RPCServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CheckPermission",
			Handler:    _RPC_CheckPermission_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "apps/permission/pb/rpc.proto",
}

RPC_ServiceDesc is the grpc.ServiceDesc for RPC service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterRPCServer

func RegisterRPCServer(s grpc.ServiceRegistrar, srv RPCServer)

Types

type CheckPermissionRequest

type CheckPermissionRequest struct {

	// 用户Id
	// @gotags: bson:"user_id" json:"user_id"
	UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id" bson:"user_id"`
	// 用户Id
	// @gotags: bson:"namespace" json:"namespace"
	Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace" bson:"namespace"`
	// service id
	// @gotags: bson:"service_id" json:"service_id"
	ServiceId string `protobuf:"bytes,3,opt,name=service_id,json=serviceId,proto3" json:"service_id" bson:"service_id"`
	// 用户Id
	// @gotags: bson:"http_method" json:"http_method"
	HttpMethod string `protobuf:"bytes,4,opt,name=http_method,json=httpMethod,proto3" json:"http_method" bson:"http_method"`
	// 用户Id
	// @gotags: bson:"http_path" json:"http_path"
	HttpPath string `protobuf:"bytes,5,opt,name=http_path,json=httpPath,proto3" json:"http_path" bson:"http_path"`
	// contains filtered or unexported fields
}

谁在访问那个服务的那个接口 在那个空间

func NewCheckPermissionRequest

func NewCheckPermissionRequest() *CheckPermissionRequest

func (*CheckPermissionRequest) Descriptor deprecated

func (*CheckPermissionRequest) Descriptor() ([]byte, []int)

Deprecated: Use CheckPermissionRequest.ProtoReflect.Descriptor instead.

func (*CheckPermissionRequest) GetHttpMethod

func (x *CheckPermissionRequest) GetHttpMethod() string

func (*CheckPermissionRequest) GetHttpPath

func (x *CheckPermissionRequest) GetHttpPath() string

func (*CheckPermissionRequest) GetNamespace

func (x *CheckPermissionRequest) GetNamespace() string

func (*CheckPermissionRequest) GetServiceId

func (x *CheckPermissionRequest) GetServiceId() string

func (*CheckPermissionRequest) GetUserId

func (x *CheckPermissionRequest) GetUserId() string

func (*CheckPermissionRequest) ProtoMessage

func (*CheckPermissionRequest) ProtoMessage()

func (*CheckPermissionRequest) ProtoReflect

func (x *CheckPermissionRequest) ProtoReflect() protoreflect.Message

func (*CheckPermissionRequest) Reset

func (x *CheckPermissionRequest) Reset()

func (*CheckPermissionRequest) String

func (x *CheckPermissionRequest) String() string

type CheckPermissionResponse

type CheckPermissionResponse struct {

	// 鉴权结构
	// @gotags: bson:"has_permisson" json:"has_permisson"
	HasPermisson bool `protobuf:"varint,1,opt,name=has_permisson,json=hasPermisson,proto3" json:"has_permisson" bson:"has_permisson"`
	// 那个角色允许
	// @gotags: bson:"role" json:"role"
	Role *role.Role `protobuf:"bytes,2,opt,name=role,proto3" json:"role" bson:"role"`
	// contains filtered or unexported fields
}

func NewCheckPermissionResponse

func NewCheckPermissionResponse() *CheckPermissionResponse

func (*CheckPermissionResponse) Descriptor deprecated

func (*CheckPermissionResponse) Descriptor() ([]byte, []int)

Deprecated: Use CheckPermissionResponse.ProtoReflect.Descriptor instead.

func (*CheckPermissionResponse) GetHasPermisson

func (x *CheckPermissionResponse) GetHasPermisson() bool

func (*CheckPermissionResponse) GetRole

func (x *CheckPermissionResponse) GetRole() *role.Role

func (*CheckPermissionResponse) ProtoMessage

func (*CheckPermissionResponse) ProtoMessage()

func (*CheckPermissionResponse) ProtoReflect

func (x *CheckPermissionResponse) ProtoReflect() protoreflect.Message

func (*CheckPermissionResponse) Reset

func (x *CheckPermissionResponse) Reset()

func (*CheckPermissionResponse) String

func (x *CheckPermissionResponse) String() string

type RPCClient

type RPCClient interface {
	CheckPermission(ctx context.Context, in *CheckPermissionRequest, opts ...grpc.CallOption) (*CheckPermissionResponse, error)
}

RPCClient is the client API for RPC service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewRPCClient

func NewRPCClient(cc grpc.ClientConnInterface) RPCClient

type RPCServer

type RPCServer interface {
	CheckPermission(context.Context, *CheckPermissionRequest) (*CheckPermissionResponse, error)
	// contains filtered or unexported methods
}

RPCServer is the server API for RPC service. All implementations must embed UnimplementedRPCServer for forward compatibility

type Service

type Service interface {
	RPCServer
}

type UnimplementedRPCServer

type UnimplementedRPCServer struct {
}

UnimplementedRPCServer must be embedded to have forward compatible implementations.

func (UnimplementedRPCServer) CheckPermission

type UnsafeRPCServer

type UnsafeRPCServer interface {
	// contains filtered or unexported methods
}

UnsafeRPCServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RPCServer will result in compilation errors.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL