Documentation ¶
Index ¶
- Constants
- func GRPCStreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func GRPCUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func NewContext(ctx context.Context, u *User) context.Context
- func NewGRPCInvalidCertError(err error) error
- func NewGRPCMissingCertError() error
- func NewGRPCPermissionDeniedError() error
- type User
Constants ¶
const ( // AdminRole specified the admin role, with privileges to manage all Jobs. AdminRole = "admin" // UserRole specified the user role, with privileges to manage only owned Jobs. UserRole = "user" )
Variables ¶
This section is empty.
Functions ¶
func GRPCStreamInterceptor ¶
func GRPCStreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
GRPCStreamInterceptor extracts user's information from the client certificates and put it in context.
func GRPCUnaryInterceptor ¶
func GRPCUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
GRPCUnaryInterceptor extracts user's information from the client certificates and put it in context.
func NewContext ¶
NewContext returns a new Context with a given user.
func NewGRPCInvalidCertError ¶
NewGRPCInvalidCertError returns error indicating that client certificate was present on gRPC call but it is incorrect.
func NewGRPCMissingCertError ¶
func NewGRPCMissingCertError() error
NewGRPCMissingCertError returns error indicating that client certificate is missing on gRPC call.
func NewGRPCPermissionDeniedError ¶
func NewGRPCPermissionDeniedError() error
NewGRPCPermissionDeniedError returns error indicating that client certificate was present on gRPC call, it was correct, but given user doesn't have enough permission to perform a given action.
Types ¶
type User ¶
User represent Agent user entity.
func FromContext ¶
FromContext returns the User stored in ctx, or error if not available.
func (*User) CheckAuthorized ¶
CheckAuthorized checks if a given user is authorized to work with a given resource.