 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- func ErrorUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func GetCurrentUserID(ctx context.Context) (id model.UserID, ok bool)
- func GetSessionID(ctx context.Context) (id string, ok bool)
- func RecoverUnaryServerInterceptor() grpc.UnaryServerInterceptor
- func ValidationUnaryServerInterceptor() grpc.UnaryServerInterceptor
- type Authorizator
Constants ¶
      View Source
      
  
const ( // AuthorizationKey is metadata key AuthorizationKey = "authorization" // SessionAuthorizationType is the type in authorization header SessionAuthorizationType = "session" )
Variables ¶
      View Source
      
  
var ( // ErrMetadataNotFound is returned when metadata not found in context ErrMetadataNotFound = errors.New("metadata not found in context") // ErrInvalidAuthorizationMetadata is returned when authorization metadata is invalid ErrInvalidAuthorizationMetadata = status.Error(codes.InvalidArgument, "Invalid authorization metadata") )
Functions ¶
func ErrorUnaryServerInterceptor ¶
func ErrorUnaryServerInterceptor() grpc.UnaryServerInterceptor
ErrorUnaryServerInterceptor returns the error handling interceptor
func GetCurrentUserID ¶
GetCurrentUserID returns the current user's id from context
func GetSessionID ¶
GetSessionID returns the session id from context
func RecoverUnaryServerInterceptor ¶
func RecoverUnaryServerInterceptor() grpc.UnaryServerInterceptor
RecoverUnaryServerInterceptor returns the recover interceptor
func ValidationUnaryServerInterceptor ¶
func ValidationUnaryServerInterceptor() grpc.UnaryServerInterceptor
ValidationUnaryServerInterceptor returns the validation interceptor
Types ¶
type Authorizator ¶
type Authorizator struct {
	di.StoreComponent
}
    Authorizator provide the authorization interceptor
func NewAuthorizator ¶
func NewAuthorizator(store di.StoreComponent) *Authorizator
NewAuthorizator returns new Authorizator
func (*Authorizator) UnaryServerInterceptor ¶
func (a *Authorizator) UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor returns authorization UnaryServerInterceptor
 Click to show internal directories. 
   Click to hide internal directories.