Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyAPIKey = errors.New("empty API key") ErrFailedToSetMetadataAuthorizationToken = errors.New("failed to set metadata authorization token") )
Functions ¶
This section is empty.
Types ¶
type Interceptor ¶
type Interceptor struct {
// contains filtered or unexported fields
}
Interceptor is the interceptor for the authentication
func NewInterceptor ¶
func NewInterceptor( methodsToIntercept []string, apiKey string, logger *slog.Logger, ) (*Interceptor, error)
NewInterceptor creates a new authentication interceptor
Parameters:
- methodsToIntercept: a slice of method names to intercept
- apiKey: the API key to use for authentication
- logger: the logger to use for logging
Returns:
- *Interceptor: the interceptor
- error: an error if the interceptions map is nil
func (Interceptor) Authenticate ¶
func (i Interceptor) Authenticate() grpc.UnaryClientInterceptor
Authenticate creates a gRPC unary client interceptor for authentication
Returns:
- grpc.UnaryClientInterceptor: the interceptor
Click to show internal directories.
Click to hide internal directories.