Documentation ¶
Index ¶
Constants ¶
View Source
const KeyClaim claim = "claim"
Variables ¶
View Source
var ErrInvalidToken = errors.New("invalid token claims")
View Source
var ErrUnexpectedSigningToken = errors.New("unexpected token signing method")
Functions ¶
func AlwaysAllowFunc ¶
func AlwaysAllowFunc() bool
Types ¶
type Interceptor ¶
type Interceptor struct {
// contains filtered or unexported fields
}
func NewAuthInterceptor ¶
func NewAuthInterceptor(jwtManager *Manager, policyClient *policyclient.Client) *Interceptor
NewAuthInterceptor returns an instance of Interceptor. It takes in Manager struct, and policyClient as input. Policy Client allows to dynamically change authorization policies.
func (*Interceptor) Stream ¶
func (interceptor *Interceptor) Stream() grpc.StreamServerInterceptor
Custom Stream interceptor that adds claim extraction and authorization
func (*Interceptor) Unary ¶
func (interceptor *Interceptor) Unary() grpc.UnaryServerInterceptor
Custom Unary( interceptor that adds claim extraction and authorization
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewJWTManager ¶
type StreamClaimInjector ¶
type StreamClaimInjector struct { grpc.ServerStream Claims *UserClaims }
Custom Stream that allows embedding of user claims for stream grpc (Similar to what describe in: https://stackoverflow.com/questions/60982406/how-to-safely-add-values-to-grpc-serverstream-in-interceptor)
func (StreamClaimInjector) Context ¶
func (s StreamClaimInjector) Context() context.Context
type UserClaims ¶
type UserClaims struct { jwt.RegisteredClaims Username string `json:"username"` TeamID string `json:"team_id"` Role string `json:"role"` }
UserClaims represents contents of JWT token.
Click to show internal directories.
Click to hide internal directories.