Documentation ¶
Index ¶
- Variables
- func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)
- type ActionGrants
- type Actions
- func (a *Actions) AsMap() auth.Actions
- func (*Actions) Descriptor() ([]byte, []int)deprecated
- func (x *Actions) GetActions() map[string]*ActionGrants
- func (*Actions) ProtoMessage()
- func (x *Actions) ProtoReflect() protoreflect.Message
- func (x *Actions) Reset()
- func (x *Actions) String() string
- func (a *Actions) ToMap() (auth.Actions, error)
- type AllowsReq
- func (*AllowsReq) Descriptor() ([]byte, []int)deprecated
- func (x *AllowsReq) GetAction() string
- func (x *AllowsReq) GetActorId() *common.UUID
- func (x *AllowsReq) GetAggregate() *aggregate.Ref
- func (*AllowsReq) ProtoMessage()
- func (x *AllowsReq) ProtoReflect() protoreflect.Message
- func (x *AllowsReq) Reset()
- func (x *AllowsReq) String() string
- type AllowsResp
- type AuthServiceClient
- type AuthServiceServer
- type GrantRevokeReq
- func (*GrantRevokeReq) Descriptor() ([]byte, []int)deprecated
- func (x *GrantRevokeReq) GetActions() []string
- func (x *GrantRevokeReq) GetRoleOrActor() *common.UUID
- func (x *GrantRevokeReq) GetTarget() *aggregate.Ref
- func (*GrantRevokeReq) ProtoMessage()
- func (x *GrantRevokeReq) ProtoReflect() protoreflect.Message
- func (x *GrantRevokeReq) Reset()
- func (x *GrantRevokeReq) String() string
- type LookupActorReq
- type LookupRoleReq
- type Permissions
- func (perms *Permissions) AsDTO() auth.PermissionsDTO
- func (*Permissions) Descriptor() ([]byte, []int)deprecated
- func (x *Permissions) GetActorId() *common.UUID
- func (x *Permissions) GetOfActor() *Actions
- func (x *Permissions) GetOfRoles() *Actions
- func (x *Permissions) GetRoles() []*common.UUID
- func (*Permissions) ProtoMessage()
- func (x *Permissions) ProtoReflect() protoreflect.Message
- func (x *Permissions) Reset()
- func (x *Permissions) String() string
- type UnimplementedAuthServiceServer
- func (UnimplementedAuthServiceServer) Allows(context.Context, *AllowsReq) (*AllowsResp, error)
- func (UnimplementedAuthServiceServer) GetPermissions(context.Context, *common.UUID) (*Permissions, error)
- func (UnimplementedAuthServiceServer) GrantToActor(context.Context, *GrantRevokeReq) (*emptypb.Empty, error)
- func (UnimplementedAuthServiceServer) GrantToRole(context.Context, *GrantRevokeReq) (*emptypb.Empty, error)
- func (UnimplementedAuthServiceServer) LookupActor(context.Context, *LookupActorReq) (*common.UUID, error)
- func (UnimplementedAuthServiceServer) LookupRole(context.Context, *LookupRoleReq) (*common.UUID, error)
- func (UnimplementedAuthServiceServer) RevokeFromActor(context.Context, *GrantRevokeReq) (*emptypb.Empty, error)
- func (UnimplementedAuthServiceServer) RevokeFromRole(context.Context, *GrantRevokeReq) (*emptypb.Empty, error)
- type UnsafeAuthServiceServer
Constants ¶
This section is empty.
Variables ¶
var AuthService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "goes.contrib.auth.AuthService", HandlerType: (*AuthServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetPermissions", Handler: _AuthService_GetPermissions_Handler, }, { MethodName: "Allows", Handler: _AuthService_Allows_Handler, }, { MethodName: "LookupActor", Handler: _AuthService_LookupActor_Handler, }, { MethodName: "LookupRole", Handler: _AuthService_LookupRole_Handler, }, { MethodName: "GrantToActor", Handler: _AuthService_GrantToActor_Handler, }, { MethodName: "GrantToRole", Handler: _AuthService_GrantToRole_Handler, }, { MethodName: "RevokeFromActor", Handler: _AuthService_RevokeFromActor_Handler, }, { MethodName: "RevokeFromRole", Handler: _AuthService_RevokeFromRole_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "goes/contrib/auth/auth.proto", }
AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_goes_contrib_auth_auth_proto protoreflect.FileDescriptor
Functions ¶
func RegisterAuthServiceServer ¶
func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)
RegisterAuthServiceServer registers the given AuthServiceServer to the provided grpc.ServiceRegistrar.
Types ¶
type ActionGrants ¶
type ActionGrants struct { Actions map[string]uint64 `` /* 156-byte string literal not displayed */ // contains filtered or unexported fields }
ActionGrants holds granted actions as the amount of times they were granted to the actor or role.
func (*ActionGrants) Descriptor
deprecated
func (*ActionGrants) Descriptor() ([]byte, []int)
Deprecated: Use ActionGrants.ProtoReflect.Descriptor instead.
func (*ActionGrants) GetActions ¶
func (x *ActionGrants) GetActions() map[string]uint64
func (*ActionGrants) ProtoMessage ¶
func (*ActionGrants) ProtoMessage()
func (*ActionGrants) ProtoReflect ¶
func (x *ActionGrants) ProtoReflect() protoreflect.Message
func (*ActionGrants) Reset ¶
func (x *ActionGrants) Reset()
func (*ActionGrants) String ¶
func (x *ActionGrants) String() string
type Actions ¶
type Actions struct { Actions map[string]*ActionGrants `` /* 155-byte string literal not displayed */ // contains filtered or unexported fields }
Actions maps aggregate names to permitted actions on these aggregates.
func NewActions ¶
NewActions converts auth.Actions to *Actions.
func (*Actions) Descriptor
deprecated
func (*Actions) GetActions ¶
func (x *Actions) GetActions() map[string]*ActionGrants
func (*Actions) ProtoMessage ¶
func (*Actions) ProtoMessage()
func (*Actions) ProtoReflect ¶
func (x *Actions) ProtoReflect() protoreflect.Message
type AllowsReq ¶
type AllowsReq struct { ActorId *common.UUID `protobuf:"bytes,1,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` Aggregate *aggregate.Ref `protobuf:"bytes,2,opt,name=aggregate,proto3" json:"aggregate,omitempty"` Action string `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"` // contains filtered or unexported fields }
AllowsReq is the request for Allows.
func (*AllowsReq) Descriptor
deprecated
func (*AllowsReq) GetActorId ¶
func (*AllowsReq) GetAggregate ¶
func (*AllowsReq) ProtoMessage ¶
func (*AllowsReq) ProtoMessage()
func (*AllowsReq) ProtoReflect ¶
func (x *AllowsReq) ProtoReflect() protoreflect.Message
type AllowsResp ¶
type AllowsResp struct { Allowed bool `protobuf:"varint,1,opt,name=allowed,proto3" json:"allowed,omitempty"` // contains filtered or unexported fields }
AllowsResp is the response for Allows.
func (*AllowsResp) Descriptor
deprecated
func (*AllowsResp) Descriptor() ([]byte, []int)
Deprecated: Use AllowsResp.ProtoReflect.Descriptor instead.
func (*AllowsResp) GetAllowed ¶
func (x *AllowsResp) GetAllowed() bool
func (*AllowsResp) ProtoMessage ¶
func (*AllowsResp) ProtoMessage()
func (*AllowsResp) ProtoReflect ¶
func (x *AllowsResp) ProtoReflect() protoreflect.Message
func (*AllowsResp) Reset ¶
func (x *AllowsResp) Reset()
func (*AllowsResp) String ¶
func (x *AllowsResp) String() string
type AuthServiceClient ¶
type AuthServiceClient interface { // GetPermissions returns the permissions read-model of the given actor. GetPermissions(ctx context.Context, in *common.UUID, opts ...grpc.CallOption) (*Permissions, error) // Allows returns whether an actor is allowed to perform an action. Allows(ctx context.Context, in *AllowsReq, opts ...grpc.CallOption) (*AllowsResp, error) // LookupActor returns the aggregate id of the actor with the given // string-formatted actor id. LookupActor(ctx context.Context, in *LookupActorReq, opts ...grpc.CallOption) (*common.UUID, error) // LookupRole returns the aggregate id of the role with the given name. LookupRole(ctx context.Context, in *LookupRoleReq, opts ...grpc.CallOption) (*common.UUID, error) // GrantToActor grants the given actor permission to perform the given actions. GrantToActor(ctx context.Context, in *GrantRevokeReq, opts ...grpc.CallOption) (*emptypb.Empty, error) // GrantToRole grants the given role permission to perform the given actions. GrantToRole(ctx context.Context, in *GrantRevokeReq, opts ...grpc.CallOption) (*emptypb.Empty, error) // RevokeFromActor revokes from the given actor the permission to perform the given actions. RevokeFromActor(ctx context.Context, in *GrantRevokeReq, opts ...grpc.CallOption) (*emptypb.Empty, error) // RevokeFromRole revokes from the given role the permission to perform the given actions. RevokeFromRole(ctx context.Context, in *GrantRevokeReq, opts ...grpc.CallOption) (*emptypb.Empty, error) }
AuthServiceClient is the client API for AuthService 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 NewAuthServiceClient ¶
func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient
NewAuthServiceClient creates a new client to interact with the AuthService service. It takes a grpc.ClientConnInterface as an argument and returns an AuthServiceClient.
type AuthServiceServer ¶
type AuthServiceServer interface { // GetPermissions returns the permissions read-model of the given actor. GetPermissions(context.Context, *common.UUID) (*Permissions, error) // Allows returns whether an actor is allowed to perform an action. Allows(context.Context, *AllowsReq) (*AllowsResp, error) // LookupActor returns the aggregate id of the actor with the given // string-formatted actor id. LookupActor(context.Context, *LookupActorReq) (*common.UUID, error) // LookupRole returns the aggregate id of the role with the given name. LookupRole(context.Context, *LookupRoleReq) (*common.UUID, error) // GrantToActor grants the given actor permission to perform the given actions. GrantToActor(context.Context, *GrantRevokeReq) (*emptypb.Empty, error) // GrantToRole grants the given role permission to perform the given actions. GrantToRole(context.Context, *GrantRevokeReq) (*emptypb.Empty, error) // RevokeFromActor revokes from the given actor the permission to perform the given actions. RevokeFromActor(context.Context, *GrantRevokeReq) (*emptypb.Empty, error) // RevokeFromRole revokes from the given role the permission to perform the given actions. RevokeFromRole(context.Context, *GrantRevokeReq) (*emptypb.Empty, error) // contains filtered or unexported methods }
AuthServiceServer is the server API for AuthService service. All implementations must embed UnimplementedAuthServiceServer for forward compatibility
type GrantRevokeReq ¶
type GrantRevokeReq struct { RoleOrActor *common.UUID `protobuf:"bytes,1,opt,name=role_or_actor,json=roleOrActor,proto3" json:"role_or_actor,omitempty"` Target *aggregate.Ref `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"` Actions []string `protobuf:"bytes,3,rep,name=actions,proto3" json:"actions,omitempty"` // contains filtered or unexported fields }
GrantRevokeReq is the request for GrantToXXX and RevokeFromXXX.
func (*GrantRevokeReq) Descriptor
deprecated
func (*GrantRevokeReq) Descriptor() ([]byte, []int)
Deprecated: Use GrantRevokeReq.ProtoReflect.Descriptor instead.
func (*GrantRevokeReq) GetActions ¶
func (x *GrantRevokeReq) GetActions() []string
func (*GrantRevokeReq) GetRoleOrActor ¶
func (x *GrantRevokeReq) GetRoleOrActor() *common.UUID
func (*GrantRevokeReq) GetTarget ¶
func (x *GrantRevokeReq) GetTarget() *aggregate.Ref
func (*GrantRevokeReq) ProtoMessage ¶
func (*GrantRevokeReq) ProtoMessage()
func (*GrantRevokeReq) ProtoReflect ¶
func (x *GrantRevokeReq) ProtoReflect() protoreflect.Message
func (*GrantRevokeReq) Reset ¶
func (x *GrantRevokeReq) Reset()
func (*GrantRevokeReq) String ¶
func (x *GrantRevokeReq) String() string
type LookupActorReq ¶
type LookupActorReq struct { StringId string `protobuf:"bytes,1,opt,name=string_id,json=stringId,proto3" json:"string_id,omitempty"` // contains filtered or unexported fields }
LookupActorReq is the request for LookupActor.
func (*LookupActorReq) Descriptor
deprecated
func (*LookupActorReq) Descriptor() ([]byte, []int)
Deprecated: Use LookupActorReq.ProtoReflect.Descriptor instead.
func (*LookupActorReq) GetStringId ¶
func (x *LookupActorReq) GetStringId() string
func (*LookupActorReq) ProtoMessage ¶
func (*LookupActorReq) ProtoMessage()
func (*LookupActorReq) ProtoReflect ¶
func (x *LookupActorReq) ProtoReflect() protoreflect.Message
func (*LookupActorReq) Reset ¶
func (x *LookupActorReq) Reset()
func (*LookupActorReq) String ¶
func (x *LookupActorReq) String() string
type LookupRoleReq ¶
type LookupRoleReq struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
LookupRoleReq is the request for LookupRole.
func (*LookupRoleReq) Descriptor
deprecated
func (*LookupRoleReq) Descriptor() ([]byte, []int)
Deprecated: Use LookupRoleReq.ProtoReflect.Descriptor instead.
func (*LookupRoleReq) GetName ¶
func (x *LookupRoleReq) GetName() string
func (*LookupRoleReq) ProtoMessage ¶
func (*LookupRoleReq) ProtoMessage()
func (*LookupRoleReq) ProtoReflect ¶
func (x *LookupRoleReq) ProtoReflect() protoreflect.Message
func (*LookupRoleReq) Reset ¶
func (x *LookupRoleReq) Reset()
func (*LookupRoleReq) String ¶
func (x *LookupRoleReq) String() string
type Permissions ¶
type Permissions struct { ActorId *common.UUID `protobuf:"bytes,1,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` Roles []*common.UUID `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty"` OfActor *Actions `protobuf:"bytes,3,opt,name=of_actor,json=ofActor,proto3" json:"of_actor,omitempty"` OfRoles *Actions `protobuf:"bytes,4,opt,name=of_roles,json=ofRoles,proto3" json:"of_roles,omitempty"` // contains filtered or unexported fields }
Permissions is the read-model for an actor's permissions.
func NewPermissions ¶
func NewPermissions(perms auth.PermissionsDTO) *Permissions
NewPermissions converts auth.Permissions to *Permissions.
func (*Permissions) AsDTO ¶
func (perms *Permissions) AsDTO() auth.PermissionsDTO
AsDTO converts *Permissions to auth.PermissionsDTO.
func (*Permissions) Descriptor
deprecated
func (*Permissions) Descriptor() ([]byte, []int)
Deprecated: Use Permissions.ProtoReflect.Descriptor instead.
func (*Permissions) GetActorId ¶
func (x *Permissions) GetActorId() *common.UUID
func (*Permissions) GetOfActor ¶
func (x *Permissions) GetOfActor() *Actions
func (*Permissions) GetOfRoles ¶
func (x *Permissions) GetOfRoles() *Actions
func (*Permissions) GetRoles ¶
func (x *Permissions) GetRoles() []*common.UUID
func (*Permissions) ProtoMessage ¶
func (*Permissions) ProtoMessage()
func (*Permissions) ProtoReflect ¶
func (x *Permissions) ProtoReflect() protoreflect.Message
func (*Permissions) Reset ¶
func (x *Permissions) Reset()
func (*Permissions) String ¶
func (x *Permissions) String() string
type UnimplementedAuthServiceServer ¶
type UnimplementedAuthServiceServer struct { }
UnimplementedAuthServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedAuthServiceServer) Allows ¶
func (UnimplementedAuthServiceServer) Allows(context.Context, *AllowsReq) (*AllowsResp, error)
Allows determines whether an actor is allowed to perform an action. It takes a context.Context, a pointer to an AllowsReq, and an optional list of grpc.CallOptions. It returns a pointer to an AllowsResp and an error.
func (UnimplementedAuthServiceServer) GetPermissions ¶
func (UnimplementedAuthServiceServer) GetPermissions(context.Context, *common.UUID) (*Permissions, error)
GetPermissions returns the permissions read-model of the given actor. It takes a context.Context and a *common.UUID as input, and returns a *Permissions and an error as output.
func (UnimplementedAuthServiceServer) GrantToActor ¶
func (UnimplementedAuthServiceServer) GrantToActor(context.Context, *GrantRevokeReq) (*emptypb.Empty, error)
GrantToActor is a function implemented by AuthServiceServer interface. It grants the given actor permission to perform the given actions.
func (UnimplementedAuthServiceServer) GrantToRole ¶
func (UnimplementedAuthServiceServer) GrantToRole(context.Context, *GrantRevokeReq) (*emptypb.Empty, error)
GrantToRole grants the given role permission to perform the given actions. It is a function in the UnimplementedAuthServiceServer struct.
func (UnimplementedAuthServiceServer) LookupActor ¶
func (UnimplementedAuthServiceServer) LookupActor(context.Context, *LookupActorReq) (*common.UUID, error)
LookupActor returns the aggregate id of the actor with the given string-formatted actor id. It is a method of the UnimplementedAuthServiceServer struct, which is embedded in all implementations of the AuthServiceServer interface for forward compatibility.
func (UnimplementedAuthServiceServer) LookupRole ¶
func (UnimplementedAuthServiceServer) LookupRole(context.Context, *LookupRoleReq) (*common.UUID, error)
LookupRole returns the aggregate id of the role with the given name.
func (UnimplementedAuthServiceServer) RevokeFromActor ¶
func (UnimplementedAuthServiceServer) RevokeFromActor(context.Context, *GrantRevokeReq) (*emptypb.Empty, error)
RevokeFromActor revokes from the given actor the permission to perform the given actions. [RevokeFromActor(ctx context.Context, in *GrantRevokeReq, opts ...grpc.CallOption) (*emptypb.Empty, error)]
func (UnimplementedAuthServiceServer) RevokeFromRole ¶
func (UnimplementedAuthServiceServer) RevokeFromRole(context.Context, *GrantRevokeReq) (*emptypb.Empty, error)
RevokeFromRole revokes from the given role the permission to perform the given actions.
type UnsafeAuthServiceServer ¶
type UnsafeAuthServiceServer interface {
// contains filtered or unexported methods
}
UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AuthServiceServer will result in compilation errors.