interceptor

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UnauthenticatedMethods specify gRPC methods that should not be authenticated.
	// This means they can be call publicly.
	UnauthenticatedMethods = []string{
		"/authz.Api/Authenticate",
		"/authz.Api/Check",
	}
)

Functions

func AuthenticationStreamClientInterceptor

func AuthenticationStreamClientInterceptor(authenticator Authenticator) grpc.StreamClientInterceptor

func AuthenticationUnaryClientInterceptor

func AuthenticationUnaryClientInterceptor(authenticator Authenticator) grpc.UnaryClientInterceptor

Types

type Authenticator

type Authenticator interface {
	GetClientID() string
	GetClientSecret() string
	GetExpireDelay() time.Duration
	GetToken() *Token
	SetToken(token *Token)
}

func NewAuthenticator

func NewAuthenticator(clientID string, clientSecret string, options ...AuthenticatorOption) Authenticator

type AuthenticatorOption

type AuthenticatorOption func(*authenticatorOptions)

func WithExpireDelay

func WithExpireDelay(delay time.Duration) AuthenticatorOption

type Token

type Token struct {
	AccessToken string
	ExpireAt    time.Time
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL