Documentation ¶
Index ¶
- Variables
- func AppendIdentityToOutgoingStreamContext() grpc.StreamClientInterceptor
- func AppendIdentityToOutgoingUnaryContext() grpc.UnaryClientInterceptor
- func GrantAccessForStreamRequest(role identity.Role) grpc.StreamServerInterceptor
- func GrantAccessForUnaryRequest(role identity.Role) grpc.UnaryServerInterceptor
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidRole = status.Errorf(codes.PermissionDenied, "Invalid role")
)
Functions ¶
func AppendIdentityToOutgoingStreamContext ¶
func AppendIdentityToOutgoingStreamContext() grpc.StreamClientInterceptor
AppendIdentityToOutgoingStreamContext appends identity to outgoing context
https://godoc.org/google.golang.org/grpc#WithStreamInterceptor
conn, err := grpc.Dial("localhost:5000", grpc.WithStreamInterceptor(AppendIdentityToOutgoingStreamContext()))
func AppendIdentityToOutgoingUnaryContext ¶
func AppendIdentityToOutgoingUnaryContext() grpc.UnaryClientInterceptor
AppendIdentityToOutgoingUnaryContext appends identity to outgoing context
https://godoc.org/google.golang.org/grpc#WithUnaryInterceptor
conn, err := grpc.Dial("localhost:5000", grpc.WithUnaryInterceptor(AppendIdentityToOutgoingUnaryContext()))
func GrantAccessForStreamRequest ¶
func GrantAccessForStreamRequest(role identity.Role) grpc.StreamServerInterceptor
GrantAccessForStreamRequest returns error if Identity not set within context or user does not have required role
https://godoc.org/google.golang.org/grpc#StreamInterceptor
opts := []grpc.ServerOption{ grpc.StreamInterceptor(GrantAccessForStreamRequest("admin")), }
s := grpc.NewServer(opts...) pb.RegisterGreeterServer(s, &server{})
func GrantAccessForUnaryRequest ¶
func GrantAccessForUnaryRequest(role identity.Role) grpc.UnaryServerInterceptor
CheckAccessForUnaryRequest returns error if Identity not set within context or user does not have required role
https://godoc.org/google.golang.org/grpc#UnaryInterceptor
opts := []grpc.ServerOption{ grpc.UnaryInterceptor(CheckAccessForUnaryRequest("admin")), }
s := grpc.NewServer(opts...) pb.RegisterGreeterServer(s, &server{})
Types ¶
This section is empty.