Skip to content
Snippets Groups Projects
auth_interceptor.go 529 B
Newer Older
  • Learn to ignore specific revisions
  • package server
    
    import (
    	"context"
    
    	log "github.com/sirupsen/logrus"
    	"google.golang.org/grpc"
    )
    
    
    // AuthInterceptor provides an AuthInterceptor
    
    type AuthInterceptor struct {
    }
    
    
    // Unary provides middleware functionality
    
    func (auth AuthInterceptor) Unary() grpc.UnaryServerInterceptor {
    	return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
    		log.Info("Interceptor called")
    
    		// TODO: Implement proper auth logic here
    
    		return handler(ctx, req)
    	}
    }